Mercurial > mplayer.hg
annotate DOCS/tech/encoding-tips.txt @ 14561:a226d301eec1
Handle missing palettes in the info part of VobSubs in Matroska files correctly by giving mplayer a NULL pointer. This way it will use a default palette instead of black only. Patch by Csillag Kristof (fenwick () freemail ! hu)
author | mosu |
---|---|
date | Fri, 21 Jan 2005 18:25:44 +0000 |
parents | 53cd01eabc3e |
children | 23237af42335 |
rev | line source |
---|---|
9012 | 1 |
2 Some important URLs: | |
3 ~~~~~~~~~~~~~~~~~~~~ | |
4 http://www.mplayerhq.hu/~michael/codec-features.html <- lavc vs. divx5 vs. xvid | |
5 http://rguyom.chez.tiscali.fr/libavcodec_tests.html <- lavc benchmarks, options | |
6 http://cutka.szm.sk/ffdshow/index.html <- lavc for win32 :) | |
7 http://www.bunkus.org/dvdripping4linux/index.html <- a nice tutorial | |
13199
53cd01eabc3e
URL with lavc option descriptions, pointed out by Attila.
diego
parents:
13047
diff
changeset
|
8 http://forum.zhentarim.net/viewtopic.php?p=237 <- lavc option comparison |
9012 | 9 |
11423
dffc970f1922
FIXING A/V SYNC WHEN ENCODING, from an old mail by Rich:
diego
parents:
11271
diff
changeset
|
10 |
9012 | 11 ================================================================================ |
8463
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
12 |
11423
dffc970f1922
FIXING A/V SYNC WHEN ENCODING, from an old mail by Rich:
diego
parents:
11271
diff
changeset
|
13 |
dffc970f1922
FIXING A/V SYNC WHEN ENCODING, from an old mail by Rich:
diego
parents:
11271
diff
changeset
|
14 FIXING A/V SYNC WHEN ENCODING |
dffc970f1922
FIXING A/V SYNC WHEN ENCODING, from an old mail by Rich:
diego
parents:
11271
diff
changeset
|
15 |
dffc970f1922
FIXING A/V SYNC WHEN ENCODING, from an old mail by Rich:
diego
parents:
11271
diff
changeset
|
16 I know this is a popular topic on the list, so I thought I'd share a |
dffc970f1922
FIXING A/V SYNC WHEN ENCODING, from an old mail by Rich:
diego
parents:
11271
diff
changeset
|
17 few comments on my experience fixing a/v sync. As everyone seems to |
dffc970f1922
FIXING A/V SYNC WHEN ENCODING, from an old mail by Rich:
diego
parents:
11271
diff
changeset
|
18 know, mencoder unfortunately doesn't have a -delay option. But that |
dffc970f1922
FIXING A/V SYNC WHEN ENCODING, from an old mail by Rich:
diego
parents:
11271
diff
changeset
|
19 doesn't mean you can't fix a/v sync. There are a couple ways to still |
dffc970f1922
FIXING A/V SYNC WHEN ENCODING, from an old mail by Rich:
diego
parents:
11271
diff
changeset
|
20 do it. |
dffc970f1922
FIXING A/V SYNC WHEN ENCODING, from an old mail by Rich:
diego
parents:
11271
diff
changeset
|
21 |
dffc970f1922
FIXING A/V SYNC WHEN ENCODING, from an old mail by Rich:
diego
parents:
11271
diff
changeset
|
22 In example 1, we'll suppose you want to re-encode the audio anyway. |
dffc970f1922
FIXING A/V SYNC WHEN ENCODING, from an old mail by Rich:
diego
parents:
11271
diff
changeset
|
23 This will be essential if your source audio isn't mp3, e.g. for DVD's |
dffc970f1922
FIXING A/V SYNC WHEN ENCODING, from an old mail by Rich:
diego
parents:
11271
diff
changeset
|
24 or nasty avi files with divx/wma audio. This approach makes things |
dffc970f1922
FIXING A/V SYNC WHEN ENCODING, from an old mail by Rich:
diego
parents:
11271
diff
changeset
|
25 much easier. |
dffc970f1922
FIXING A/V SYNC WHEN ENCODING, from an old mail by Rich:
diego
parents:
11271
diff
changeset
|
26 |
dffc970f1922
FIXING A/V SYNC WHEN ENCODING, from an old mail by Rich:
diego
parents:
11271
diff
changeset
|
27 Step 1: Dump the audio with mplayer -ao pcm -nowaveheader. There are |
dffc970f1922
FIXING A/V SYNC WHEN ENCODING, from an old mail by Rich:
diego
parents:
11271
diff
changeset
|
28 various options that can be used to speed this up, most notably -vo |
dffc970f1922
FIXING A/V SYNC WHEN ENCODING, from an old mail by Rich:
diego
parents:
11271
diff
changeset
|
29 null, -vc null, and/or -hardframedrop. -benchmark also seemed to help |
dffc970f1922
FIXING A/V SYNC WHEN ENCODING, from an old mail by Rich:
diego
parents:
11271
diff
changeset
|
30 in the past. :) |
dffc970f1922
FIXING A/V SYNC WHEN ENCODING, from an old mail by Rich:
diego
parents:
11271
diff
changeset
|
31 |
dffc970f1922
FIXING A/V SYNC WHEN ENCODING, from an old mail by Rich:
diego
parents:
11271
diff
changeset
|
32 Step 2: Figure out what -delay value syncs the audio right in mplayer. |
dffc970f1922
FIXING A/V SYNC WHEN ENCODING, from an old mail by Rich:
diego
parents:
11271
diff
changeset
|
33 If this number is positive, use a command like the following: |
dffc970f1922
FIXING A/V SYNC WHEN ENCODING, from an old mail by Rich:
diego
parents:
11271
diff
changeset
|
34 |
dffc970f1922
FIXING A/V SYNC WHEN ENCODING, from an old mail by Rich:
diego
parents:
11271
diff
changeset
|
35 dd if=audiodump.wav bs=1764 skip=[delay] | lame -x - out.mp3 |
dffc970f1922
FIXING A/V SYNC WHEN ENCODING, from an old mail by Rich:
diego
parents:
11271
diff
changeset
|
36 |
dffc970f1922
FIXING A/V SYNC WHEN ENCODING, from an old mail by Rich:
diego
parents:
11271
diff
changeset
|
37 where [delay] is replaced by your delay amount in hundredths of a |
dffc970f1922
FIXING A/V SYNC WHEN ENCODING, from an old mail by Rich:
diego
parents:
11271
diff
changeset
|
38 second (1/10 the value you use with mplayer). Otherwise, if delay is |
dffc970f1922
FIXING A/V SYNC WHEN ENCODING, from an old mail by Rich:
diego
parents:
11271
diff
changeset
|
39 negative, use a command like this: |
dffc970f1922
FIXING A/V SYNC WHEN ENCODING, from an old mail by Rich:
diego
parents:
11271
diff
changeset
|
40 |
dffc970f1922
FIXING A/V SYNC WHEN ENCODING, from an old mail by Rich:
diego
parents:
11271
diff
changeset
|
41 ( dd if=/dev/zero bs=1764 skip=[delay] ; cat audiodump.wav ) | lame -x - out.mp3 |
dffc970f1922
FIXING A/V SYNC WHEN ENCODING, from an old mail by Rich:
diego
parents:
11271
diff
changeset
|
42 |
dffc970f1922
FIXING A/V SYNC WHEN ENCODING, from an old mail by Rich:
diego
parents:
11271
diff
changeset
|
43 Don't include the minus (-) sign in delay. Also, keep in mind you'll |
dffc970f1922
FIXING A/V SYNC WHEN ENCODING, from an old mail by Rich:
diego
parents:
11271
diff
changeset
|
44 have to change the 1764 number and provide additional options to lame |
13047 | 45 if your audio stream isn't 44100/16bit/little-endian/stereo. |
11423
dffc970f1922
FIXING A/V SYNC WHEN ENCODING, from an old mail by Rich:
diego
parents:
11271
diff
changeset
|
46 |
dffc970f1922
FIXING A/V SYNC WHEN ENCODING, from an old mail by Rich:
diego
parents:
11271
diff
changeset
|
47 Step 3: Use mencoder to remux your new mp3 file with the movie: |
dffc970f1922
FIXING A/V SYNC WHEN ENCODING, from an old mail by Rich:
diego
parents:
11271
diff
changeset
|
48 |
dffc970f1922
FIXING A/V SYNC WHEN ENCODING, from an old mail by Rich:
diego
parents:
11271
diff
changeset
|
49 mencoder -audiofile out.mp3 -oac copy ... |
dffc970f1922
FIXING A/V SYNC WHEN ENCODING, from an old mail by Rich:
diego
parents:
11271
diff
changeset
|
50 |
dffc970f1922
FIXING A/V SYNC WHEN ENCODING, from an old mail by Rich:
diego
parents:
11271
diff
changeset
|
51 You can either copy video as-is (with -ovc copy) or re-encode it at |
dffc970f1922
FIXING A/V SYNC WHEN ENCODING, from an old mail by Rich:
diego
parents:
11271
diff
changeset
|
52 the same time you merge in the audio like this. |
dffc970f1922
FIXING A/V SYNC WHEN ENCODING, from an old mail by Rich:
diego
parents:
11271
diff
changeset
|
53 |
dffc970f1922
FIXING A/V SYNC WHEN ENCODING, from an old mail by Rich:
diego
parents:
11271
diff
changeset
|
54 Finally, as a variation on this method (makes things a good bit faster |
dffc970f1922
FIXING A/V SYNC WHEN ENCODING, from an old mail by Rich:
diego
parents:
11271
diff
changeset
|
55 and doesn't use tons of temporary disk space) you can merge steps 1 |
dffc970f1922
FIXING A/V SYNC WHEN ENCODING, from an old mail by Rich:
diego
parents:
11271
diff
changeset
|
56 and 2 by making a named pipe called "audiodump.wav" (type mkfifo |
dffc970f1922
FIXING A/V SYNC WHEN ENCODING, from an old mail by Rich:
diego
parents:
11271
diff
changeset
|
57 audiodump.wav) and have mplayer write the audio to it at the same time |
dffc970f1922
FIXING A/V SYNC WHEN ENCODING, from an old mail by Rich:
diego
parents:
11271
diff
changeset
|
58 you're running lame to encode. |
dffc970f1922
FIXING A/V SYNC WHEN ENCODING, from an old mail by Rich:
diego
parents:
11271
diff
changeset
|
59 |
dffc970f1922
FIXING A/V SYNC WHEN ENCODING, from an old mail by Rich:
diego
parents:
11271
diff
changeset
|
60 Now for example 2. This time we won't re-encode audio at all. Just |
dffc970f1922
FIXING A/V SYNC WHEN ENCODING, from an old mail by Rich:
diego
parents:
11271
diff
changeset
|
61 dump the mp3 stream from the avi file with mplayer -dumpaudio. Then, |
dffc970f1922
FIXING A/V SYNC WHEN ENCODING, from an old mail by Rich:
diego
parents:
11271
diff
changeset
|
62 you have to cut and paste the raw mp3 stream a bit... |
dffc970f1922
FIXING A/V SYNC WHEN ENCODING, from an old mail by Rich:
diego
parents:
11271
diff
changeset
|
63 |
dffc970f1922
FIXING A/V SYNC WHEN ENCODING, from an old mail by Rich:
diego
parents:
11271
diff
changeset
|
64 If delay is negative, things are easier. Just use lame to encode |
dffc970f1922
FIXING A/V SYNC WHEN ENCODING, from an old mail by Rich:
diego
parents:
11271
diff
changeset
|
65 silence for the duration of delay, at the same samplerate and |
dffc970f1922
FIXING A/V SYNC WHEN ENCODING, from an old mail by Rich:
diego
parents:
11271
diff
changeset
|
66 samplesize used in your avi file. Then, do something like: |
dffc970f1922
FIXING A/V SYNC WHEN ENCODING, from an old mail by Rich:
diego
parents:
11271
diff
changeset
|
67 |
dffc970f1922
FIXING A/V SYNC WHEN ENCODING, from an old mail by Rich:
diego
parents:
11271
diff
changeset
|
68 cat silence.mp3 stream.dump > out.mp3 |
dffc970f1922
FIXING A/V SYNC WHEN ENCODING, from an old mail by Rich:
diego
parents:
11271
diff
changeset
|
69 mencoder -audiofile out.mp3 -oac copy ... |
dffc970f1922
FIXING A/V SYNC WHEN ENCODING, from an old mail by Rich:
diego
parents:
11271
diff
changeset
|
70 |
dffc970f1922
FIXING A/V SYNC WHEN ENCODING, from an old mail by Rich:
diego
parents:
11271
diff
changeset
|
71 On the other hand, if delay is positive, you'll need to crop off part |
dffc970f1922
FIXING A/V SYNC WHEN ENCODING, from an old mail by Rich:
diego
parents:
11271
diff
changeset
|
72 of the mp3 from the beginning. If it's (at least roughly) CBR this is |
dffc970f1922
FIXING A/V SYNC WHEN ENCODING, from an old mail by Rich:
diego
parents:
11271
diff
changeset
|
73 easy -- just take off the first (bitrate*delay/8) bytes of the file. |
dffc970f1922
FIXING A/V SYNC WHEN ENCODING, from an old mail by Rich:
diego
parents:
11271
diff
changeset
|
74 You can use the excellent dd tool, or just your favorite |
dffc970f1922
FIXING A/V SYNC WHEN ENCODING, from an old mail by Rich:
diego
parents:
11271
diff
changeset
|
75 binary-friendly text editor to do this. Otherwise, you'll have to |
dffc970f1922
FIXING A/V SYNC WHEN ENCODING, from an old mail by Rich:
diego
parents:
11271
diff
changeset
|
76 experiment with cutting off different amounts. You can test with |
dffc970f1922
FIXING A/V SYNC WHEN ENCODING, from an old mail by Rich:
diego
parents:
11271
diff
changeset
|
77 mplayer -audiofile before actually spending time remuxing/encoding |
dffc970f1922
FIXING A/V SYNC WHEN ENCODING, from an old mail by Rich:
diego
parents:
11271
diff
changeset
|
78 with mencoder to make sure you cut the right amount. |
dffc970f1922
FIXING A/V SYNC WHEN ENCODING, from an old mail by Rich:
diego
parents:
11271
diff
changeset
|
79 |
dffc970f1922
FIXING A/V SYNC WHEN ENCODING, from an old mail by Rich:
diego
parents:
11271
diff
changeset
|
80 I hope this has all been informative. If anyone would like to clean |
dffc970f1922
FIXING A/V SYNC WHEN ENCODING, from an old mail by Rich:
diego
parents:
11271
diff
changeset
|
81 this message up a bit and make it into part of the docs, feel free. Of |
dffc970f1922
FIXING A/V SYNC WHEN ENCODING, from an old mail by Rich:
diego
parents:
11271
diff
changeset
|
82 course mencoder should eventually just get -delay. :) |
dffc970f1922
FIXING A/V SYNC WHEN ENCODING, from an old mail by Rich:
diego
parents:
11271
diff
changeset
|
83 |
dffc970f1922
FIXING A/V SYNC WHEN ENCODING, from an old mail by Rich:
diego
parents:
11271
diff
changeset
|
84 Rich |
dffc970f1922
FIXING A/V SYNC WHEN ENCODING, from an old mail by Rich:
diego
parents:
11271
diff
changeset
|
85 |
dffc970f1922
FIXING A/V SYNC WHEN ENCODING, from an old mail by Rich:
diego
parents:
11271
diff
changeset
|
86 |
dffc970f1922
FIXING A/V SYNC WHEN ENCODING, from an old mail by Rich:
diego
parents:
11271
diff
changeset
|
87 ================================================================================ |
dffc970f1922
FIXING A/V SYNC WHEN ENCODING, from an old mail by Rich:
diego
parents:
11271
diff
changeset
|
88 |
dffc970f1922
FIXING A/V SYNC WHEN ENCODING, from an old mail by Rich:
diego
parents:
11271
diff
changeset
|
89 |
8463
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
90 ENCODING QUALITY - OR WHY AUTOMATISM IS BAD. |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
91 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
92 Hi everyone. |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
93 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
94 Some days ago someone suggested adding some preset options to mencoder. |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
95 At that time I replied 'don't do that', and now I decided to elaborate |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
96 on that. |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
97 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
98 Warning: this is rather long, and it involves mathematics. But if you |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
99 don't want to bother with either then why are you encoding in the |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
100 first place? Go do something different! |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
101 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
102 The good news is: it's all about the bpp (bits per pixel). |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
103 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
104 The bad news is: it's not THAT easy ;) |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
105 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
106 This mail is about encoding a DVD to MPEG4. It's about the video |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
107 quality, not (primarily) about the audio quality or some other fancy |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
108 things like subtitles. |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
109 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
110 The first step is to encode the audio. Why? Well if you encode the |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
111 audio prior to the video you'll have to make the video fit onto one |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
112 (or two) CD(s). That way you can use oggenc's quality based encoding |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
113 mode which is much more sophisticated than its ABR based mode. |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
114 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
115 After encoding the audio you have a certain amount of space left to |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
116 fill with video. Let's assume the audio takes 60M (no problem with |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
117 Vorbis), and you aim at a 700M CD. This leaves you 640M for the video. |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
118 Let's further assume that the video is 100 minutes or 6000 seconds |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
119 long, encoded at 25fps (those nasty NTSC fps values give me |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
120 headaches. Adjust to your needs, of course!). This leaves you with |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
121 a video bitrate of: |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
122 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
123 $videosize * 8 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
124 $videobitrate = -------------- |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
125 $length * 1000 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
126 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
127 $videosize in bytes, $length in seconds, $videobitrate in kbit/s. |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
128 In my example I end up with $videobitrate = 895. |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
129 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
130 And now comes the question: how do I chose my encoding parameters |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
131 so that the results will be good? First let's take a look at a |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
132 typical mencoder line: |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
133 |
10405 | 134 mencoder dvd://1 -o /dev/null -oac copy -ovc lavc \ |
8463
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
135 -lavcopts vcodec=mpeg4:vbitrate=1000:vhq:vqmin=2:\ |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
136 vlelim=-4:vcelim=9:lumi_mask=0.05:dark_mask=0.01:vpass=1 \ |
9644
0fe056bdb135
vop -> vf change, small fixes. The Polish documentation should be checked for correctness.
jonas
parents:
9012
diff
changeset
|
137 -vf crop=716:572:2:2,scale=640:480 |
8463
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
138 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
139 Phew, all those parameters! Which ones should I change? NEVER leave |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
140 out 'vhq'. Never ever. 'vqmin=2' is always good if you aim for sane |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
141 settings - like 'normal length' movies on one CD, 'very long movies' |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
142 on two CDs and so on. vcodec=mpeg4 is mandatory. |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
143 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
144 The 'vlelim=-4:vcelim=9:lumi_mask=0.05:dark_mask=0.01' are parameters |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
145 suggested by D Richard Felker for non-animated movies, and they |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
146 improve quality a bit. |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
147 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
148 But the two things that have the most influence on quality are |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
149 vbitate and scale. Why? Because both together tell the codec how |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
150 many bits it may spend on each frame for each bit: and this is |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
151 the 'bpp' value (bits per pixel). It's simply defined as |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
152 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
153 $videobitrate * 1000 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
154 $bpp = ----------------------- |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
155 $width * $height * $fps |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
156 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
157 I've attached a small Perl script that calculates the $bpp for |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
158 a movie. You'll have to give it four parameters: |
9644
0fe056bdb135
vop -> vf change, small fixes. The Polish documentation should be checked for correctness.
jonas
parents:
9012
diff
changeset
|
159 a) the cropped but unscaled resolution (use '-vf cropdetect'), |
8463
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
160 b) the encoded aspect ratio. All DVDs come at 720x576 but contain |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
161 a flag that tells the player wether it should display the DVD at |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
162 an aspect ratio of 4/3 (1.333) or at 16/9 (1.777). Have a look |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
163 at mplayer's output - there's something about 'prescaling'. That's |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
164 what you are looking for. |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
165 c) the video bitrate in kbit/s and |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
166 d) the fps. |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
167 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
168 In my example the command line and calcbpp.pl's output would look |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
169 like this (warning - long lines ahead): |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
170 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
171 mosu@anakin:~$ ./calcbpp.pl 720x440 16/9 896 25 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
172 Prescaled picture: 1023x440, AR 2.33 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
173 720x304, diff 5, new AR 2.37, AR error 1.74% scale=720:304 bpp: 0.164 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
174 704x304, diff -1, new AR 2.32, AR error 0.50% scale=704:304 bpp: 0.167 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
175 688x288, diff 8, new AR 2.39, AR error 2.58% scale=688:288 bpp: 0.181 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
176 672x288, diff 1, new AR 2.33, AR error 0.26% scale=672:288 bpp: 0.185 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
177 656x288, diff -6, new AR 2.28, AR error 2.17% scale=656:288 bpp: 0.190 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
178 640x272, diff 3, new AR 2.35, AR error 1.09% scale=640:272 bpp: 0.206 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
179 624x272, diff -4, new AR 2.29, AR error 1.45% scale=624:272 bpp: 0.211 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
180 608x256, diff 5, new AR 2.38, AR error 2.01% scale=608:256 bpp: 0.230 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
181 592x256, diff -2, new AR 2.31, AR error 0.64% scale=592:256 bpp: 0.236 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
182 576x240, diff 8, new AR 2.40, AR error 3.03% scale=576:240 bpp: 0.259 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
183 560x240, diff 1, new AR 2.33, AR error 0.26% scale=560:240 bpp: 0.267 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
184 544x240, diff -6, new AR 2.27, AR error 2.67% scale=544:240 bpp: 0.275 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
185 528x224, diff 3, new AR 2.36, AR error 1.27% scale=528:224 bpp: 0.303 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
186 512x224, diff -4, new AR 2.29, AR error 1.82% scale=512:224 bpp: 0.312 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
187 496x208, diff 5, new AR 2.38, AR error 2.40% scale=496:208 bpp: 0.347 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
188 480x208, diff -2, new AR 2.31, AR error 0.85% scale=480:208 bpp: 0.359 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
189 464x192, diff 7, new AR 2.42, AR error 3.70% scale=464:192 bpp: 0.402 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
190 448x192, diff 1, new AR 2.33, AR error 0.26% scale=448:192 bpp: 0.417 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
191 432x192, diff -6, new AR 2.25, AR error 3.43% scale=432:192 bpp: 0.432 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
192 416x176, diff 3, new AR 2.36, AR error 1.54% scale=416:176 bpp: 0.490 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
193 400x176, diff -4, new AR 2.27, AR error 2.40% scale=400:176 bpp: 0.509 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
194 384x160, diff 5, new AR 2.40, AR error 3.03% scale=384:160 bpp: 0.583 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
195 368x160, diff -2, new AR 2.30, AR error 1.19% scale=368:160 bpp: 0.609 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
196 352x144, diff 7, new AR 2.44, AR error 4.79% scale=352:144 bpp: 0.707 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
197 336x144, diff 0, new AR 2.33, AR error 0.26% scale=336:144 bpp: 0.741 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
198 320x144, diff -6, new AR 2.22, AR error 4.73% scale=320:144 bpp: 0.778 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
199 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
200 A word for the $bpp. For a fictional movie which is only black and |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
201 white: if you have a $bpp of 1 then the movie would be stored |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
202 uncompressed :) For a real life movie with 24bit color depth you |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
203 need compression of course. And the $bpp can be used to make the |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
204 decision easier. |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
205 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
206 As you can see the resolutions suggested by the script are all |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
207 dividable by 16. This will make the aspect ratio slightly wrong, |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
208 but no one will notice. |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
209 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
210 Now if you want to decide which resolution (and scaling parameters) |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
211 to chose you can do that by looking at the $bpp: |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
212 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
213 < 0.10: don't do it. Please. I beg you! |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
214 < 0.15: It will look bad. |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
215 < 0.20: You will notice blocks, but it will look ok. |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
216 < 0.25: It will look really good. |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
217 > 0.25: It won't really improve visually. |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
218 > 0.30: Don't do that either - try a bigger resolution instead. |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
219 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
220 Of course these values are not absolutes! For movies with really lots |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
221 of black areas 0.15 may look very good. Action movies with only high |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
222 motion scenes on the other hand may not look perfect at 0.25. But these |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
223 values give you a great idea about which resolution to chose. |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
224 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
225 I see a lot of people always using 512 for the width and scaling |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
226 the height accordingly. For my (real-world-)example this would be |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
227 simply a waste of bandwidth. The encoder would probably not even |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
228 need the full bitrate, and the resulting file would be smaller |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
229 than my targetted 700M. |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
230 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
231 After encoding you'll do your 'quality check'. First fire up the movie |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
232 and see whether it looks good to you or not. But you can also do a |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
233 more 'scientific' analysis. The second Perl script I attached counts |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
234 the quantizers used for the encoding. Simply call it with |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
235 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
236 countquant.pl < divx2pass.log |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
237 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
238 It will print out which quantizer was used how often. If you see that |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
239 e.g. the lowest quantizer (vqmin=2) gets used for > 95% of the frames |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
240 then you can safely increase your picture size. |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
241 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
242 > The "counting the quantesizer"-thing could improve the quality of |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
243 > full automated scripts, as I understand ? |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
244 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
245 Yes, the log file analysis can be used be tools to automatically adjust |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
246 the scaling parameters (if you'd do that you'd end up with a three-pass |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
247 encoding for the video only ;)), but it can also provide answers for |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
248 you as a human. From time to time there's a question like 'hey, |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
249 mencoder creates files that are too small! I specified this bitrate and |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
250 the resulting file is 50megs short of the target file size!'. The |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
251 reason is probably that the codec already uses the minimum quantizer |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
252 for nearly all frames so it simply does not need more bits. A quick |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
253 glance at the distribution of the quantizers can be enlightening. |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
254 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
255 Another thing is that q=2 and q=3 look really good while the 'bigger' |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
256 quantizers really lose quality. So if your distribution shows the |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
257 majority of quantizers at 4 and above then you should probably decrease |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
258 the resolution (you'll definitly see block artefacts). |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
259 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
260 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
261 Well... Several people will probably disagree with me on certain |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
262 points here, especially when it comes down to hard values (like the |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
263 $bpp categories and the percentage of the quantizers used). But |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
264 the idea is still valid. |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
265 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
266 And that's why I think that there should NOT be presets in mencoder |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
267 like the presets lame knows. 'Good quality' or 'perfect quality' are |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
268 ALWAYS relative. They always depend on a person's personal preferences. |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
269 If you want good quality then spend some time reading and - more |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
270 important - understanding what steps are involved in video encoding. |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
271 You cannot do it without mathematics. Oh well, you can, but you'll |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
272 end up with movies that could certainly look better. |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
273 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
274 Now please shoot me if you have any complaints ;) |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
275 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
276 -- |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
277 ==> Ciao, Mosu (Moritz Bunkus) |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
278 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
279 =========== |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
280 ANOTHER APPROACH: BITS PER BLOCK: |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
281 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
282 > $videobitrate * 1000 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
283 > $bpp = ----------------------- |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
284 > $width * $height * $fps |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
285 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
286 Well, I came to similar equation going through different route. Only I |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
287 didn't use bits per pixel, in my case it was bits per block (BPB). The block |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
288 is 16x16 because lots of software depends on video width/height being |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
289 divisable by 16. And because I didn't like this 0.2 bit per pixel, when |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
290 bit is quite atomic ;) |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
291 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
292 So the equation was something like: |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
293 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
294 bitrate |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
295 bpb = ----------------- |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
296 fps * ((width * height) / (16 * 16)) |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
297 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
298 (width and height are from destination video size, and bitrate is in |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
299 bits (i.e. 900kbps is 900000)) |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
300 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
301 This way it apeared that the minimum bits per block is ~40, very |
11271
252fb0cf331a
spelling fixes, mostly by <ismail.donmez@boun.edu.tr>
diego
parents:
10432
diff
changeset
|
302 good results are with ~50, and everything above 60 is a waste of bandwidth. |
8463
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
303 And what's actually funny is that it was independant of codec used. The |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
304 results were exactly the same, whether I used DIV3 (with tricky nandub's |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
305 magick), ffmpeg odivx, DivX5 on Windows or XviD. |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
306 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
307 Surprisingly there is one advantage of using nandub-DIV3 for bitrate |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
308 starved encoding: ringing almost never apears this way. |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
309 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
310 But I also found out, that the quality/BPB isn't constant for |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
311 drastically different resolutions. Smaller picture (like MPEG1 sizes) |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
312 need more BPB to look good than say typical MPEG2 resolutions. |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
313 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
314 Robert |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
315 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
316 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
317 =========== |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
318 DON'T SCALE DOWN TOO MUCH |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
319 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
320 Sometimes I found that encoding to y-scaled only DVD qualty (ie 704 x |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
321 288 for a 2.85 film) gives better visual quality than a scaled-down |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
322 version even if the quantizers are significantly higher than for the |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
323 scaled-down version. |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
324 Keep in mind that blocs, fuzzy parts and generaly mpeg artefacts in a |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
325 704x288 image will be harder to spot in full-screen mode than on a |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
326 512x208 image. In fact I've see example where the same movie looks |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
327 better compressed to 704x288 with an average weighted quantizer of |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
328 ~3 than the same movie scaled to 576x240 with an average weighted |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
329 quantizer of 2.4. |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
330 Btw, a print of the weighted average quantizer would be nice in |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
331 countquant.pl :) |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
332 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
333 Another point in favor of not trying to scale down too much : on hard |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
334 scaled-down movies, the MPEG codec will need to compress relatively |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
335 high frequencies rather than low frequencies and it doesn't like that |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
336 at all. You will see less and less returns while you scale down and |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
337 scale down again in desesperate need of some bandwidth :) |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
338 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
339 In my experience, don't try to go below a width of 576 without closely |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
340 watching what's going on. |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
341 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
342 -- |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
343 Rémi |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
344 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
345 =========== |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
346 TIPS FOR ENCODING |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
347 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
348 That being said, with video you have some tradeoffs you can make. Most |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
349 people seem to encode with really basic options, but if you play with |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
350 single coefficient elimination and luma masking settings, you can save lots |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
351 of bits, resulting in lower quantizers, which means less blockiness and |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
352 less ugly noise (ringing) around sharp borders. The tradeoff, however, is |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
353 that you'll get some "muddiness" in some parts of the image. Play around |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
354 with the settings and see for yourself. The options I typically use for |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
355 (non-animated) movies are: |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
356 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
357 vlelim=-4 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
358 vcelim=9 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
359 lumi_mask=0.05 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
360 dark_mask=0.01 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
361 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
362 If things look too muddy, making the numbers closer to 0. For anime and |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
363 other animation, the above recommendations may not be so good. |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
364 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
365 Another option that may be useful is allowing four motion vectors per |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
366 macroblock (v4mv). This will increase encoding time quite a bit, and |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
367 last I checked it wasn't compatible with B frames. AFAIK, specifying |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
368 v4mv should never reduce quality, but it may prevent some old junky |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
369 versions of DivX from decoding it (can anyone conform?). Another issue |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
370 might be increased cpu time needed for decoding (again, can anyone |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
371 confirm?). |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
372 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
373 To get more fair distribution of bits between low-detail and |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
374 high-detail scenes, you should probably try increasing vqcomp from the |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
375 default (0.5) to something in the range 0.6-0.8. |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
376 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
377 Of course you also want to make sure you crop ALL of the black border and |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
378 any half-black pixels at the edge of the image, and make sure the final |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
379 image dimensions after cropping and scaling are multiples of 16. Failing to |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
380 do so will drastically reduce quality. |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
381 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
382 Finally, if you can't seem to get good results, you can try scaling the |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
383 movie down a bit smaller or applying a weak gaussian blur to reduce the |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
384 amount of detail. |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
385 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
386 Now, my personal success story! I just recently managed to fit a beautiful |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
387 encode of Kundun (well over 2 hours long, but not too many high-motion |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
388 scenes) on one cd at 640x304, with 66 kbit/sec abr ogg audio, using the |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
389 options I described above. So, IMHO it's definitely possible to get very |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
390 good results with libavcodec (certainly MUCH better than all the idiot |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
391 "release groups" using DivX3 make), as long as you take some time to play |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
392 around with the options. |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
393 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
394 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
395 Rich |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
396 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
397 ============ |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
398 ABOUT VLELIM, VCELIM, LUMI_MASK AND DARK_MASK PART I: LUMA & CHROMA |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
399 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
400 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
401 The l/c in vlelim and vcelim stands for luma (brightness plane) and chroma |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
402 (color planes). These are encoded separately in all mpeg-like algorithms. |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
403 Anyway, the idea behind these options is (at least from what I understand) |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
404 to use some good heuristics to determine when the change in a block is less |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
405 than the threshold you specify, and in such a case, to just encode the |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
406 block as "no change". This saves bits and perhaps speeds up encoding. Using |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
407 a negative value for either one means the same thing as the corresponding |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
408 positive value, but the DC coefficient is also considered. Unfortunately |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
409 I'm not familiar enough with the mpeg terminology to know what this means |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
410 (my first guess would be that it's the constant term from the DCT), but it |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
411 probably makes the encoder less likely to apply single coefficient |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
412 elimination in cases where it would look bad. It's presumably recommended |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
413 to use negative values for luma (which is more noticable) and positive for |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
414 chroma. |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
415 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
416 The other options -- lumi_mask and dark_mask -- control how the quantizer |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
417 is adjusted for really dark or bright regions of the picture. You're |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
418 probably already at least a bit familiar with the concept of quantizers |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
419 (qscale, lower = more precision, higher quality, but more bits needed to |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
420 encode). What not everyone seems to know is that the quantizer you see |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
421 (e.g. in the 2pass logs) is just an average for the whole frame, and lower |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
422 or higher quantizers may in fact be used in parts of the picture with more |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
423 or less detail. Increasing the values of lumi_mask and dark_mask will cause |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
424 lavc to aggressively increase the quantizer in very dark or very bright |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
425 regions of the picture (which are presumably not as noticable to the human |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
426 eye) in order to save bits for use elsewhere. |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
427 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
428 Rich |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
429 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
430 =================== |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
431 ABOUT VLELIM, VCELIM, LUMI_MASK AND DARK_MASK PART II: VQSCALE |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
432 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
433 OK, a quick explanation. The quantizer you set with vqscale=N is the |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
434 per-frame quantizer parameter (aka qp). However, with mpeg4 it's |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
435 allowed (and recommended!) for the encoder to vary the quantizer on a |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
436 per-macroblock (mb) basis (as I understand it, macroblocks are 16x16 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
437 regions composed of 4 8x8 luma blocks and 2 8x8 chroma blocks, u and |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
438 v). To do this, lavc scores each mb with a complexity value and |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
439 weights the quantizer accordingly. However, you can control this |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
440 behavior somewhat with scplx_mask, tcplx_mask, dark_mask, and |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
441 lumi_mask. |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
442 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
443 scplx_mask -- raise quantizer on mb's with lots of spacial complexity. |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
444 Spacial complexity is measured by variance of the texture (this is |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
445 just the actual image for I blocks and the difference from the |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
446 previous coded frame for P blocks). |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
447 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
448 tcplx_mask -- raise quantizer on mb's with lots of temporal |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
449 complexity. Temporal complexity is measured according to motion |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
450 vectors. |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
451 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
452 dark_mask -- raise quantizer on very dark mb's. |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
453 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
454 lumi_mask -- raise quantizer on very bright mb's. |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
455 Somewhere around 0-0.15 is a safe range for these values, IMHO. You |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
456 might try as high as 0.25 or 0.3. You should probably never go over |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
457 0.5 or so. |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
458 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
459 Now, about naq. When you adjust the quantizers on a per-mb basis like |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
460 this (called adaptive quantization), you might decrease or (more |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
461 likely) increase the average quantizer used, so that it no longer |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
462 matches the requested average quantizer (qp) for the frame. This will |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
463 result in weird things happening with the bitrate, at least from my |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
464 experience. What naq does is "normalize adaptive quantization". That |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
465 is, after the above masking parameters are applied on a per-mb basis, |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
466 the quantizers of all the blocks are rescaled so that the average |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
467 stays fixed at the desired qp. |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
468 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
469 So, if I used vqscale=4 with naq and fairly large values for the |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
470 masking parameters, I might be likely to see lots of frames using |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
471 qscale 2,3,4,5,6,7 across different macroblocks as needed, but with |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
472 the average sticking around 4. However, I haven't actually tested such |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
473 a setup yet, so it's just speculation right now. |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
474 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
475 Have fun playing around with it. |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
476 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
477 Rich |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
478 |
11423
dffc970f1922
FIXING A/V SYNC WHEN ENCODING, from an old mail by Rich:
diego
parents:
11271
diff
changeset
|
479 |
dffc970f1922
FIXING A/V SYNC WHEN ENCODING, from an old mail by Rich:
diego
parents:
11271
diff
changeset
|
480 ================================================================================ |
dffc970f1922
FIXING A/V SYNC WHEN ENCODING, from an old mail by Rich:
diego
parents:
11271
diff
changeset
|
481 |
dffc970f1922
FIXING A/V SYNC WHEN ENCODING, from an old mail by Rich:
diego
parents:
11271
diff
changeset
|
482 |
8463
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
483 TIPS FOR ENCODING OLD BLACK & WHITE MOVIES: |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
484 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
485 I found myself that 4:3 B&W old movies are very hard to compress well. In |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
486 addition to the 4:3 aspect ratio which eats lots of bits, those movies are |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
487 typically very "noisy", which doesn't help at all. Anyway : |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
488 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
489 > After a few tries I am |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
490 > still a little bit disappointed with the video quality. Since it is a |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
491 > "dark" movies, there is a lot of black on the pictures, and on the |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
492 > encoded avi I can see a lot of annoying "mpeg squares". I am using |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
493 > avifile codec, but the best I think is to give you the command line I |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
494 > used to encode a preview of the result: |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
495 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
496 > |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
497 > First pass: |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
498 > mencoder TITLE01-ANGLE1.VOB -oac copy -ovc lavc -lavcopts |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
499 > vcodec=mpeg4:vhq:vpass=1:vbitrate=800:keyint=48 -ofps 23.976 -npp lb |
9644
0fe056bdb135
vop -> vf change, small fixes. The Polish documentation should be checked for correctness.
jonas
parents:
9012
diff
changeset
|
500 > -ss 2:00 -endpos 0:30 -vf scale -zoom -xy 640 -o movie.avi |
8463
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
501 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
502 1) keyint=48 is way too low. The default value is 250, this is in *frames* |
13022 | 503 not seconds. Keyframes are significantly larger than P or B frames, so the |
504 less keyframes you have, better the overall movie will be. (huh, like Yoda | |
8463
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
505 I speak ;). Try keyint=300 or 350. Don't go beyond that if you want |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
506 relatively precise seeking. |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
507 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
508 2) you may want to play with vlelim and vcelim options. This can gives you |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
509 a significant "quality" boost. Try one of these couples : |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
510 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
511 vlelim=-2:vcelim=3 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
512 vlelim=-3:vcelim=5 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
513 vlelim=-4:vcelim=7 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
514 (and yes, there's a minus) |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
515 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
516 3) crop & rescale the movie before passing it to the codec. First crop the |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
517 movie to not encode black bars if there's any. For a 1h40mn movie |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
518 compressed to a 700 MB file, I would try something between 512x384 and |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
519 480x320. Don't go below that if you want something relatively sharp when |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
520 viewed fullscreen. |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
521 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
522 4) I would recommend using the Ogg Vorbis audio codec with the .ogm |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
523 container format. Ogg Vorbis compress audio better than MP3. On a typical |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
524 old, mono-only audio stream, a 45 kbits/s Vorbis stream is ok. How to |
10432 | 525 extract & compress an audio stream from a ripped DVD (mplayer dvd://1 |
8463
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
526 -dumpstream) : |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
527 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
528 rm -f audiodump.pcm ; mkfifo -m 600 audiodump.pcm |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
529 mplayer -quiet -vc null -vo null -aid 128 -ao pcm -nowaveheader stream.dump & |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
530 oggenc --raw --raw-bits=16 --raw-chan=2 --raw-rate=48000 -q 1 -o audio-us.ogg |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
531 +audiodump.pcm & |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
532 wait |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
533 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
534 For a nice set of utilities to manager the .ogm format, see Moritz Bunkus' |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
535 ogmtools (google is your friend). |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
536 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
537 5) use the "v4mv" option. This could gives you a few more bits at the |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
538 expense of a slightly longer encoding. This is a "lossless" option, I mean |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
539 with this option you don't throw away some video information, it just |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
540 selects a more precise motion estimation method. Be warned that on some |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
541 very un-typical scenes this option may gives you a longer file than |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
542 without, although it's very rare and on a whole film I think it's always a |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
543 win. |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
544 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
545 6) you can try the new luminance & darkness masking code. Play |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
546 with the "lumi_mask" and "dark_mask" options. I would recommend using |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
547 something like : |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
548 lumi_mask=0.07:dark_mask=0.10:naq: |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
549 lumi_mask=0.10:dark_mask=0.12:naq: |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
550 lumi_mask=0.12:dark_mask=0.15:naq |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
551 lumi_mask=0.13:dark_mask=0.16:naq: |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
552 Be warned that these options are really experimental and the result |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
553 could be very good or very bad depending on your visualization device |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
554 (computer CRT, TV or TFT screen). Don't push too hard these options. |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
555 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
556 > Second pass: |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
557 > the same with vpass=2 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
558 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
559 7) I've found that lavc gives better results when the first pass is done |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
560 with "vqscale=2" instead of a target bitrate. The statistics collected |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
561 seems to be more precise. YMMV. |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
562 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
563 > I am new to mencoder, so please tell me any idea you have even if it |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
564 > obvious. I also tried the "gray" option of lavc, to encode B&W only, |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
565 > but strangely it gives me "pink" squares from time to time. |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
566 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
567 Yes, I've seen that too. Playing the resulting file with "-lavdopts gray" |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
568 fix the problem but it's not very nice ... |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
569 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
570 > So if you could tell me what option of mencoder or lavc I should be |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
571 > looking at to lower the number of "squares" on the image, it would be |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
572 > great. The version of mencoder i use is 0.90pre8 on a macos x PPC |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
573 > platform. I guess I would have the same problem by encoding anime |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
574 > movies, where there are a lot of region of the image with the same |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
575 > color. So if you managed to solve this problem... |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
576 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
577 You could also try the "mpeg_quant" flag. It selects a different set of |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
578 quantizers and produce somewhat sharper pictures and less blocks on large |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
579 zones with the same or similar luminance, at the expense of some bits. |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
580 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
581 > This is completely off topic, but do you know how I can create good |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
582 > subtitles from vobsub subtitles ? I checked the -dumpmpsub option of |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
583 > mplayer, but is there a way to do it really fast (ie without having to |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
584 > play the whole movie) ? |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
585 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
586 I didn't find a way under *nix to produce reasonably good text subtitles |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
587 from vobsubs. OCR *nix softwares seems either not suited to the task, not |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
588 powerful enough or both. I'm extracting the vobsub subtitles and simply use |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
589 them with the .ogm |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
590 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
591 / .avi : |
10405 | 592 1) rip the DVD to harddisk with "mplayer dvd://1 -dumpstream" |
8463
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
593 2) mount the DVD and copy the .ifo file |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
594 2) extract all vobsubs to one single file with something like : |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
595 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
596 for f in 0 1 2 3 4 5 6 7 8 9 10 11 ; do \ |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
597 mencoder -ovc copy -oac copy -o /dev/null -sid $f -vobsubout sous-titres |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
598 +-vobsuboutindex $f -ifo vts_01_0.ifo stream.dump |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
599 done |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
600 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
601 (and yes, I've a DVD with 12 subtitles) |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
602 -- |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
603 Rémi |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
604 |
11423
dffc970f1922
FIXING A/V SYNC WHEN ENCODING, from an old mail by Rich:
diego
parents:
11271
diff
changeset
|
605 |
dffc970f1922
FIXING A/V SYNC WHEN ENCODING, from an old mail by Rich:
diego
parents:
11271
diff
changeset
|
606 ================================================================================ |
dffc970f1922
FIXING A/V SYNC WHEN ENCODING, from an old mail by Rich:
diego
parents:
11271
diff
changeset
|
607 |
8463
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
608 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
609 TIPS FOR SMOKE & CLOUDS |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
610 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
611 Q: I'm trying to encode Dante's Peak and I'm having problems with clouds, |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
612 fog and smoke: They don't look fine (they look very bad if I watch the |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
613 movie in TVout). There are some artifacts, white clouds looks as snow |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
614 mountains, there are things likes hip in the colors so one can see frontier |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
615 curves between white and light gray and dark gray ... (I don't know if you |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
616 can understand me, I want to mean that the colors don't change smoothly) |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
617 In particular I'm using vqscale=2:vhq:v4mv |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
618 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
619 A: Try adding "vqcomp=0.7:vqblur=0.2:mpeg_quant" to lavcopts. |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
620 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
621 Q: I tried your suggestion and it improved the image a little ... but not |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
622 enough. I was playing with different options and I couldn't find the way. |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
623 I suppose that the vob is not so good (watching it in TV trough the |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
624 computer looks better than my encoding, but it isn't a lot of better). |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
625 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
626 A: Yes, those scenes with qscale=2 looks terrible :-( |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
627 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
628 Try with vqmin=1 in addition to mpeg_quant:vlelim=-4:vcelim=-7 (and maybe |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
629 with "-sws 10 -ssf ls=1" to sharpen a bit the image) and read about vqmin=1 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
630 in DOCS/tech/libavc-options.txt. |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
631 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
632 If after the whole movie is encoded you still see the same problem, it will |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
633 means that the second pass didn't picked-up q=1 for this scene. Force q=1 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
634 with the "vrc_override" option. |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
635 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
636 Q: By the way, is there a special difficult in encode clouds or smoke? |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
637 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
638 A: I would say it depends on the sharpness of these clouds / smokes and the |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
639 fact that they are mostly black/white/grey or colored. The codec will do |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
640 the right thing with vqmin=2 for example on a cigarette smoke (sharp) or on |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
641 a red/yellow cloud (explosion, cloud of fire). But may not with a grey and |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
642 very fuzzy cloud like in the chocolat scene. Note that I don't know exactly |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
643 why ;) |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
644 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
645 A = Rémi |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
646 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
647 |