Mercurial > mplayer.hg
annotate DOCS/tech/encoding-tips.txt @ 12232:d644640c9bc1
translation prepared by frogu <frogu(at)frogu.emdej.pl>
author | paszczi |
---|---|
date | Sun, 18 Apr 2004 20:23:05 +0000 |
parents | dffc970f1922 |
children | 7b8c281f9311 |
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 | |
8 | |
11423
dffc970f1922
FIXING A/V SYNC WHEN ENCODING, from an old mail by Rich:
diego
parents:
11271
diff
changeset
|
9 |
9012 | 10 ================================================================================ |
8463
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
11 |
11423
dffc970f1922
FIXING A/V SYNC WHEN ENCODING, from an old mail by Rich:
diego
parents:
11271
diff
changeset
|
12 |
dffc970f1922
FIXING A/V SYNC WHEN ENCODING, from an old mail by Rich:
diego
parents:
11271
diff
changeset
|
13 FIXING A/V SYNC WHEN ENCODING |
dffc970f1922
FIXING A/V SYNC WHEN ENCODING, from an old mail by Rich:
diego
parents:
11271
diff
changeset
|
14 |
dffc970f1922
FIXING A/V SYNC WHEN ENCODING, from an old mail by Rich:
diego
parents:
11271
diff
changeset
|
15 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
|
16 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
|
17 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
|
18 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
|
19 do it. |
dffc970f1922
FIXING A/V SYNC WHEN ENCODING, from an old mail by Rich:
diego
parents:
11271
diff
changeset
|
20 |
dffc970f1922
FIXING A/V SYNC WHEN ENCODING, from an old mail by Rich:
diego
parents:
11271
diff
changeset
|
21 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
|
22 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
|
23 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
|
24 much easier. |
dffc970f1922
FIXING A/V SYNC WHEN ENCODING, from an old mail by Rich:
diego
parents:
11271
diff
changeset
|
25 |
dffc970f1922
FIXING A/V SYNC WHEN ENCODING, from an old mail by Rich:
diego
parents:
11271
diff
changeset
|
26 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
|
27 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
|
28 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
|
29 in the past. :) |
dffc970f1922
FIXING A/V SYNC WHEN ENCODING, from an old mail by Rich:
diego
parents:
11271
diff
changeset
|
30 |
dffc970f1922
FIXING A/V SYNC WHEN ENCODING, from an old mail by Rich:
diego
parents:
11271
diff
changeset
|
31 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
|
32 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
|
33 |
dffc970f1922
FIXING A/V SYNC WHEN ENCODING, from an old mail by Rich:
diego
parents:
11271
diff
changeset
|
34 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
|
35 |
dffc970f1922
FIXING A/V SYNC WHEN ENCODING, from an old mail by Rich:
diego
parents:
11271
diff
changeset
|
36 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
|
37 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
|
38 negative, use a command like this: |
dffc970f1922
FIXING A/V SYNC WHEN ENCODING, from an old mail by Rich:
diego
parents:
11271
diff
changeset
|
39 |
dffc970f1922
FIXING A/V SYNC WHEN ENCODING, from an old mail by Rich:
diego
parents:
11271
diff
changeset
|
40 ( 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
|
41 |
dffc970f1922
FIXING A/V SYNC WHEN ENCODING, from an old mail by Rich:
diego
parents:
11271
diff
changeset
|
42 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
|
43 have to change the 1764 number and provide additional options to lame |
dffc970f1922
FIXING A/V SYNC WHEN ENCODING, from an old mail by Rich:
diego
parents:
11271
diff
changeset
|
44 if your audio stream isn't 44100/16bit/littleendian/stereo. |
dffc970f1922
FIXING A/V SYNC WHEN ENCODING, from an old mail by Rich:
diego
parents:
11271
diff
changeset
|
45 |
dffc970f1922
FIXING A/V SYNC WHEN ENCODING, from an old mail by Rich:
diego
parents:
11271
diff
changeset
|
46 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
|
47 |
dffc970f1922
FIXING A/V SYNC WHEN ENCODING, from an old mail by Rich:
diego
parents:
11271
diff
changeset
|
48 mencoder -audiofile out.mp3 -oac copy ... |
dffc970f1922
FIXING A/V SYNC WHEN ENCODING, from an old mail by Rich:
diego
parents:
11271
diff
changeset
|
49 |
dffc970f1922
FIXING A/V SYNC WHEN ENCODING, from an old mail by Rich:
diego
parents:
11271
diff
changeset
|
50 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
|
51 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
|
52 |
dffc970f1922
FIXING A/V SYNC WHEN ENCODING, from an old mail by Rich:
diego
parents:
11271
diff
changeset
|
53 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
|
54 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
|
55 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
|
56 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
|
57 you're running lame to encode. |
dffc970f1922
FIXING A/V SYNC WHEN ENCODING, from an old mail by Rich:
diego
parents:
11271
diff
changeset
|
58 |
dffc970f1922
FIXING A/V SYNC WHEN ENCODING, from an old mail by Rich:
diego
parents:
11271
diff
changeset
|
59 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
|
60 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
|
61 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
|
62 |
dffc970f1922
FIXING A/V SYNC WHEN ENCODING, from an old mail by Rich:
diego
parents:
11271
diff
changeset
|
63 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
|
64 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
|
65 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
|
66 |
dffc970f1922
FIXING A/V SYNC WHEN ENCODING, from an old mail by Rich:
diego
parents:
11271
diff
changeset
|
67 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
|
68 mencoder -audiofile out.mp3 -oac copy ... |
dffc970f1922
FIXING A/V SYNC WHEN ENCODING, from an old mail by Rich:
diego
parents:
11271
diff
changeset
|
69 |
dffc970f1922
FIXING A/V SYNC WHEN ENCODING, from an old mail by Rich:
diego
parents:
11271
diff
changeset
|
70 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
|
71 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
|
72 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
|
73 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
|
74 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
|
75 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
|
76 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
|
77 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
|
78 |
dffc970f1922
FIXING A/V SYNC WHEN ENCODING, from an old mail by Rich:
diego
parents:
11271
diff
changeset
|
79 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
|
80 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
|
81 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
|
82 |
dffc970f1922
FIXING A/V SYNC WHEN ENCODING, from an old mail by Rich:
diego
parents:
11271
diff
changeset
|
83 Rich |
dffc970f1922
FIXING A/V SYNC WHEN ENCODING, from an old mail by Rich:
diego
parents:
11271
diff
changeset
|
84 |
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 |
8463
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
89 ENCODING QUALITY - OR WHY AUTOMATISM IS BAD. |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
90 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
91 Hi everyone. |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
92 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
93 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
|
94 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
|
95 on that. |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
96 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
97 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
|
98 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
|
99 first place? Go do something different! |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
100 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
101 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
|
102 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
103 The bad news is: it's not THAT easy ;) |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
104 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
105 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
|
106 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
|
107 things like subtitles. |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
108 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
109 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
|
110 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
|
111 (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
|
112 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
|
113 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
114 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
|
115 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
|
116 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
|
117 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
|
118 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
|
119 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
|
120 a video bitrate of: |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
121 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
122 $videosize * 8 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
123 $videobitrate = -------------- |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
124 $length * 1000 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
125 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
126 $videosize in bytes, $length in seconds, $videobitrate in kbit/s. |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
127 In my example I end up with $videobitrate = 895. |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
128 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
129 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
|
130 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
|
131 typical mencoder line: |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
132 |
10405 | 133 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
|
134 -lavcopts vcodec=mpeg4:vbitrate=1000:vhq:vqmin=2:\ |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
135 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
|
136 -vf crop=716:572:2:2,scale=640:480 |
8463
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
137 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
138 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
|
139 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
|
140 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
|
141 on two CDs and so on. vcodec=mpeg4 is mandatory. |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
142 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
143 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
|
144 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
|
145 improve quality a bit. |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
146 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
147 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
|
148 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
|
149 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
|
150 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
|
151 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
152 $videobitrate * 1000 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
153 $bpp = ----------------------- |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
154 $width * $height * $fps |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
155 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
156 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
|
157 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
|
158 a) the cropped but unscaled resolution (use '-vf cropdetect'), |
8463
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
159 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
|
160 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
|
161 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
|
162 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
|
163 what you are looking for. |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
164 c) the video bitrate in kbit/s and |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
165 d) the fps. |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
166 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
167 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
|
168 like this (warning - long lines ahead): |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
169 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
170 mosu@anakin:~$ ./calcbpp.pl 720x440 16/9 896 25 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
171 Prescaled picture: 1023x440, AR 2.33 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
172 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
|
173 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
|
174 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
|
175 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
|
176 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
|
177 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
|
178 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
|
179 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
|
180 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
|
181 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
|
182 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
|
183 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
|
184 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
|
185 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
|
186 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
|
187 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
|
188 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
|
189 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
|
190 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
|
191 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
|
192 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
|
193 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
|
194 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
|
195 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
|
196 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
|
197 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
|
198 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
199 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
|
200 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
|
201 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
|
202 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
|
203 decision easier. |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
204 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
205 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
|
206 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
|
207 but no one will notice. |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
208 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
209 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
|
210 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
|
211 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
212 < 0.10: don't do it. Please. I beg you! |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
213 < 0.15: It will look bad. |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
214 < 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
|
215 < 0.25: It will look really good. |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
216 > 0.25: It won't really improve visually. |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
217 > 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
|
218 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
219 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
|
220 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
|
221 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
|
222 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
|
223 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
224 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
|
225 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
|
226 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
|
227 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
|
228 than my targetted 700M. |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
229 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
230 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
|
231 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
|
232 more 'scientific' analysis. The second Perl script I attached counts |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
233 the quantizers used for the encoding. Simply call it with |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
234 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
235 countquant.pl < divx2pass.log |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
236 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
237 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
|
238 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
|
239 then you can safely increase your picture size. |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
240 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
241 > The "counting the quantesizer"-thing could improve the quality of |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
242 > full automated scripts, as I understand ? |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
243 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
244 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
|
245 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
|
246 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
|
247 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
|
248 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
|
249 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
|
250 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
|
251 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
|
252 glance at the distribution of the quantizers can be enlightening. |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
253 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
254 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
|
255 quantizers really lose quality. So if your distribution shows the |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
256 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
|
257 the resolution (you'll definitly see block artefacts). |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
258 |
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 Well... Several people will probably disagree with me on certain |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
261 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
|
262 $bpp categories and the percentage of the quantizers used). But |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
263 the idea is still valid. |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
264 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
265 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
|
266 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
|
267 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
|
268 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
|
269 important - understanding what steps are involved in video encoding. |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
270 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
|
271 end up with movies that could certainly look better. |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
272 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
273 Now please shoot me if you have any complaints ;) |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
274 |
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 ==> Ciao, Mosu (Moritz Bunkus) |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
277 |
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 ANOTHER APPROACH: BITS PER BLOCK: |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
280 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
281 > $videobitrate * 1000 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
282 > $bpp = ----------------------- |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
283 > $width * $height * $fps |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
284 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
285 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
|
286 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
|
287 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
|
288 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
|
289 bit is quite atomic ;) |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
290 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
291 So the equation was something like: |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
292 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
293 bitrate |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
294 bpb = ----------------- |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
295 fps * ((width * height) / (16 * 16)) |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
296 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
297 (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
|
298 bits (i.e. 900kbps is 900000)) |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
299 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
300 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
|
301 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
|
302 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
|
303 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
|
304 magick), ffmpeg odivx, DivX5 on Windows or XviD. |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
305 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
306 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
|
307 starved encoding: ringing almost never apears this way. |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
308 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
309 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
|
310 drastically different resolutions. Smaller picture (like MPEG1 sizes) |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
311 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
|
312 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
313 Robert |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
314 |
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 DON'T SCALE DOWN TOO MUCH |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
318 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
319 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
|
320 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
|
321 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
|
322 scaled-down version. |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
323 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
|
324 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
|
325 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
|
326 better compressed to 704x288 with an average weighted quantizer of |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
327 ~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
|
328 quantizer of 2.4. |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
329 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
|
330 countquant.pl :) |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
331 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
332 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
|
333 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
|
334 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
|
335 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
|
336 scale down again in desesperate need of some bandwidth :) |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
337 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
338 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
|
339 watching what's going on. |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
340 |
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 Rémi |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
343 |
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 TIPS FOR ENCODING |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
346 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
347 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
|
348 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
|
349 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
|
350 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
|
351 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
|
352 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
|
353 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
|
354 (non-animated) movies are: |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
355 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
356 vlelim=-4 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
357 vcelim=9 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
358 lumi_mask=0.05 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
359 dark_mask=0.01 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
360 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
361 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
|
362 other animation, the above recommendations may not be so good. |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
363 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
364 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
|
365 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
|
366 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
|
367 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
|
368 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
|
369 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
|
370 confirm?). |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
371 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
372 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
|
373 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
|
374 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
|
375 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
376 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
|
377 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
|
378 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
|
379 do so will drastically reduce quality. |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
380 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
381 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
|
382 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
|
383 amount of detail. |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
384 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
385 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
|
386 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
|
387 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
|
388 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
|
389 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
|
390 "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
|
391 around with the options. |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
392 |
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 Rich |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
395 |
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 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
|
398 |
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 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
|
401 (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
|
402 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
|
403 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
|
404 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
|
405 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
|
406 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
|
407 positive value, but the DC coefficient is also considered. Unfortunately |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
408 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
|
409 (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
|
410 probably makes the encoder less likely to apply single coefficient |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
411 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
|
412 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
|
413 chroma. |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
414 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
415 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
|
416 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
|
417 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
|
418 (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
|
419 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
|
420 (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
|
421 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
|
422 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
|
423 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
|
424 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
|
425 eye) in order to save bits for use elsewhere. |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
426 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
427 Rich |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
428 |
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 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
|
431 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
432 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
|
433 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
|
434 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
|
435 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
|
436 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
|
437 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
|
438 weights the quantizer accordingly. However, you can control this |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
439 behavior somewhat with scplx_mask, tcplx_mask, dark_mask, and |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
440 lumi_mask. |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
441 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
442 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
|
443 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
|
444 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
|
445 previous coded frame for P blocks). |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
446 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
447 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
|
448 complexity. Temporal complexity is measured according to motion |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
449 vectors. |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
450 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
451 dark_mask -- raise quantizer on very dark mb's. |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
452 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
453 lumi_mask -- raise quantizer on very bright mb's. |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
454 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
|
455 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
|
456 0.5 or so. |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
457 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
458 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
|
459 this (called adaptive quantization), you might decrease or (more |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
460 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
|
461 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
|
462 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
|
463 experience. What naq does is "normalize adaptive quantization". That |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
464 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
|
465 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
|
466 stays fixed at the desired qp. |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
467 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
468 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
|
469 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
|
470 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
|
471 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
|
472 a setup yet, so it's just speculation right now. |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
473 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
474 Have fun playing around with it. |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
475 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
476 Rich |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
477 |
11423
dffc970f1922
FIXING A/V SYNC WHEN ENCODING, from an old mail by Rich:
diego
parents:
11271
diff
changeset
|
478 |
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 |
8463
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
482 TIPS FOR ENCODING OLD BLACK & WHITE MOVIES: |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
483 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
484 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
|
485 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
|
486 typically very "noisy", which doesn't help at all. Anyway : |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
487 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
488 > After a few tries I am |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
489 > 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
|
490 > "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
|
491 > 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
|
492 > 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
|
493 > used to encode a preview of the result: |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
494 |
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 > First pass: |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
497 > mencoder TITLE01-ANGLE1.VOB -oac copy -ovc lavc -lavcopts |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
498 > 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
|
499 > -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
|
500 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
501 1) keyint=48 is way too low. The default value is 250, this is in *frames* |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
502 not seconds. Key frames are significantly larger than P or B frames, so the |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
503 less key frames you have, better the overall movie will be. (huh, like Yoda |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
504 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
|
505 relatively precise seeking. |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
506 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
507 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
|
508 a significant "quality" boost. Try one of these couples : |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
509 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
510 vlelim=-2:vcelim=3 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
511 vlelim=-3:vcelim=5 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
512 vlelim=-4:vcelim=7 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
513 (and yes, there's a minus) |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
514 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
515 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
|
516 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
|
517 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
|
518 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
|
519 viewed fullscreen. |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
520 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
521 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
|
522 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
|
523 old, mono-only audio stream, a 45 kbits/s Vorbis stream is ok. How to |
10432 | 524 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
|
525 -dumpstream) : |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
526 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
527 rm -f audiodump.pcm ; mkfifo -m 600 audiodump.pcm |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
528 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
|
529 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
|
530 +audiodump.pcm & |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
531 wait |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
532 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
533 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
|
534 ogmtools (google is your friend). |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
535 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
536 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
|
537 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
|
538 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
|
539 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
|
540 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
|
541 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
|
542 win. |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
543 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
544 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
|
545 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
|
546 something like : |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
547 lumi_mask=0.07:dark_mask=0.10:naq: |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
548 lumi_mask=0.10:dark_mask=0.12:naq: |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
549 lumi_mask=0.12:dark_mask=0.15:naq |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
550 lumi_mask=0.13:dark_mask=0.16:naq: |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
551 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
|
552 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
|
553 (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
|
554 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
555 > Second pass: |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
556 > the same with vpass=2 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
557 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
558 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
|
559 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
|
560 seems to be more precise. YMMV. |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
561 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
562 > 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
|
563 > 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
|
564 > 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
|
565 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
566 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
|
567 fix the problem but it's not very nice ... |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
568 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
569 > 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
|
570 > 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
|
571 > 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
|
572 > 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
|
573 > 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
|
574 > color. So if you managed to solve this problem... |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
575 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
576 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
|
577 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
|
578 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
|
579 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
580 > 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
|
581 > subtitles from vobsub subtitles ? I checked the -dumpmpsub option of |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
582 > 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
|
583 > play the whole movie) ? |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
584 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
585 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
|
586 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
|
587 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
|
588 them with the .ogm |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
589 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
590 / .avi : |
10405 | 591 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
|
592 2) mount the DVD and copy the .ifo file |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
593 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
|
594 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
595 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
|
596 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
|
597 +-vobsuboutindex $f -ifo vts_01_0.ifo stream.dump |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
598 done |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
599 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
600 (and yes, I've a DVD with 12 subtitles) |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
601 -- |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
602 Rémi |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
603 |
11423
dffc970f1922
FIXING A/V SYNC WHEN ENCODING, from an old mail by Rich:
diego
parents:
11271
diff
changeset
|
604 |
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 |
8463
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
607 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
608 TIPS FOR SMOKE & CLOUDS |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
609 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
610 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
|
611 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
|
612 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
|
613 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
|
614 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
|
615 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
|
616 In particular I'm using vqscale=2:vhq:v4mv |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
617 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
618 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
|
619 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
620 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
|
621 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
|
622 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
|
623 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
|
624 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
625 A: Yes, those scenes with qscale=2 looks terrible :-( |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
626 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
627 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
|
628 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
|
629 in DOCS/tech/libavc-options.txt. |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
630 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
631 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
|
632 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
|
633 with the "vrc_override" option. |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
634 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
635 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
|
636 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
637 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
|
638 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
|
639 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
|
640 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
|
641 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
|
642 why ;) |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
643 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
644 A = Rémi |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
645 |
e421b4ab7815
encoding tips - collected from mplayer-users list mailings by
arpi
parents:
diff
changeset
|
646 |