15219
|
1 <?xml version="1.0" encoding="iso-8859-2"?>
|
|
2 <!-- Synced with: 1.52 -->
|
|
3 <chapter id="mencoder">
|
|
4 <title>Enkódování s <application>MEncoder</application>em</title>
|
|
5
|
|
6 <para>
|
|
7 Úplný seznam dostupných voleb a příkladů pro <application>MEncoder</application>
|
|
8 naleznete v man stránce. Řadu užitečných příkladů a podrobných návodů pro
|
|
9 použití mnoha enkódovacích voleb naleznete v
|
|
10 <ulink url="../../tech/encoding-tips.txt">tipech pro enkódování</ulink>, které
|
|
11 byly získány z několika diskusí v konferenci MPlayer-users. Prohledejte
|
|
12 <ulink url="http://mplayerhq.hu/pipermail/mplayer-users/">archivy</ulink>,
|
|
13 chcete-li bohatost diskusí o všech aspektech a problémech vztažených
|
|
14 k enkódování <application>MEncoder</application>em.
|
|
15 </para>
|
|
16
|
|
17 <sect1 id="menc-feat-mpeg4">
|
|
18 <title>Dvouprůchodové enkódování MPEG-4 ("DivX")</title>
|
|
19
|
|
20 <para>
|
|
21 Název vychází z faktu, že soubor je enkódován <emphasis>dvakrát</emphasis>.
|
|
22 První enkódování (dubbed pass) vytvoří dočasné soubory
|
|
23 (<filename>*.log</filename>) velikosti několika megabajtů, které zatím nemažte
|
|
24 (můžete smazat AVI). Ve druhém průchodu je vytvořen dvouprůchodový výstupní
|
|
25 soubor s použitím řízení datového toku z dočasných souborů. Výsledný soubor
|
|
26 bude mít lepší kvalitu obrazu. Pokud jste o tom teď slyšeli poprvé, měli byste
|
|
27 si prostudovat některé návody dostupné na netu.
|
|
28 </para>
|
|
29
|
|
30 <example>
|
|
31 <title>kopírování zvukové stopy</title>
|
|
32 <para>
|
|
33 Dvouprůchodové enkódování DVD do MPEG-4 ("DivX") AVI zatímco se zvuk
|
|
34 pouze zkopíruje.
|
|
35 <screen>
|
|
36 mencoder dvd://2 -ovc lavc -lavcopts vcodec=mpeg4:vpass=1 -oac copy -o <replaceable>film.avi</replaceable>
|
|
37 mencoder dvd://2 -ovc lavc -lavcopts vcodec=mpeg4:vpass=2 -oac copy -o <replaceable>film.avi</replaceable>
|
|
38 </screen>
|
|
39 </para>
|
|
40 </example>
|
|
41
|
|
42 <example>
|
|
43 <title>enkódování zvukové stopy</title>
|
|
44 <para>
|
|
45 Dvouprůchodové enkódování DVD do MPEG-4 ("DivX") AVI a současně
|
|
46 enkódování zvukové stopy do MP3.
|
|
47 <screen>
|
|
48 mencoder dvd://2 -ovc lavc -lavcopts vcodec=mpeg4:vpass=1 -oac mp3lame -lameopts vbr=3 -o <replaceable>film.avi</replaceable>
|
|
49 mencoder dvd://2 -ovc lavc -lavcopts vcodec=mpeg4:vpass=2 -oac mp3lame -lameopts vbr=3 -o <replaceable>film.avi</replaceable>
|
|
50 </screen>
|
|
51 </para>
|
|
52 </example>
|
|
53 </sect1>
|
|
54
|
|
55 <sect1 id="menc-feat-mpeg">
|
|
56 <title>Enkódování do MPEG formátu</title>
|
|
57 <para>
|
|
58 <application>MEncoder</application> umí vytvořit výstupní soubor formátu
|
|
59 MPEG (MPEG-PS). To je pravděpodobně použitelné pouze s <emphasis>mpeg1video</emphasis>
|
|
60 kodekem z <systemitem class="library">libavcodec</systemitem></link>, protože
|
|
61 přehrávače – s výjimkou <application>MPlayer</application>u –
|
|
62 očekávají MPEG-1 video a MPEG-1 layer 2 (MP2) audio proudy v MPEG souborech.
|
|
63 </para>
|
|
64
|
|
65 <para>
|
|
66 Tato vlastnost nyní není moc užitečná, pomiňme že má asi mnoho chyb, ale hlavně
|
|
67 proto, že <application>MEncoder</application> v současnosti neumí enkódovat
|
|
68 MPEG-1 layer 2 (MP2) zvuk, který všechny ostatní přehrávače očekávají v MPEG
|
|
69 souborech.
|
|
70 </para>
|
|
71
|
|
72 <para>
|
|
73 Výstupní souborový formát <application>MEncoder</application>u změníte použitím
|
|
74 volby <option>-of mpeg</option>.
|
|
75 </para>
|
|
76
|
|
77 <para>
|
|
78 Example:
|
|
79 <screen>
|
|
80 mencoder -of mpeg -ovc lavc -lavcopts vcodec=mpeg1video -oac copy <replaceable>další_volby</replaceable> <replaceable>media.avi</replaceable> -o <replaceable>výstup.mpg</replaceable>
|
|
81 </screen>
|
|
82 </para>
|
|
83 </sect1>
|
|
84
|
|
85
|
|
86 <sect1 id="menc-feat-rescale">
|
|
87 <title>Škálování (změna velikosti) filmů</title>
|
|
88
|
|
89 <para>
|
|
90 Často potřebujeme změnit velikost obrázků ve filmu a to z mnoha důvodů: zmenšení
|
|
91 souboru, zátěže sítě atd. Mnoho lidí dokonce mění velikost při převodu DVD nebo
|
|
92 SVCD do DivX AVI. Pokud si přejete video přeškálovat, přečtěte si sekci
|
|
93 <link linkend="aspect">Zachování poměru stran</link>.
|
|
94 </para>
|
|
95
|
|
96 <para>
|
|
97 Samotný proces škálování je prováděn video filtrem <literal>scale</literal>:
|
|
98 <option>-vf scale=<replaceable>šířka</replaceable>:<replaceable>výška</replaceable></option>.
|
|
99 Jeho kvalita může být nastavena volbou <option>-sws</option>.
|
|
100 Pokud ji neuvedete, <application>MEncoder</application> použije 2: bikubickou.
|
|
101 </para>
|
|
102
|
|
103 <para>
|
|
104 Použití:
|
|
105 <screen>
|
|
106 mencoder <replaceable>vstup.mpg</replaceable> -ovc lavc -lavcopts vcodec=mpeg4 -vf scale=640:480 -o <replaceable>výstup.avi</replaceable>
|
|
107 </screen>
|
|
108 </para>
|
|
109 </sect1>
|
|
110
|
|
111
|
|
112 <sect1 id="menc-feat-streamcopy">
|
|
113 <title>Proudové kopírování</title>
|
|
114
|
|
115 <para>
|
|
116 <application>MEncoder</application> může zpracovat vstupní datové proudy dvěma
|
|
117 způsoby:
|
|
118 <emphasis role="bold">enkóduje</emphasis> je, nebo je
|
|
119 <emphasis role="bold">kopíruje</emphasis>. Tato část je o
|
|
120 <emphasis role="bold">kopírování</emphasis>.
|
|
121 </para>
|
|
122
|
|
123 <itemizedlist>
|
|
124 <listitem><para>
|
|
125 <emphasis role="bold">Video proud</emphasis> (volba <option>-ovc copy</option>):
|
|
126 můžete dělat pěkné věci :) Jako umístění (nikoli konverze!) FLI nebo VIVO nebo
|
|
127 MPEG-1 videa do AVI souboru! Samozřejmě takové soubory přehraje pouze
|
|
128 <application>MPlayer</application> :) A proto to nejspíš nemá žádnou rozumnou
|
|
129 hodnotu. A teď vážně: kopírování video proudu může být užitečné například
|
|
130 tehdy, když má být enkódován pouze zvuk (např. nekomprimovaný PCM do MP3).
|
|
131 </para></listitem>
|
|
132 <listitem><para>
|
|
133 <emphasis role="bold">Audio proud</emphasis> (volba <option>-oac copy</option>):
|
|
134 jednoduché. Je možné vzít externí zvukový soubor (MP3, WAV) a namultiplexovat
|
|
135 jej do výstupního proudu. K tomu použijte volbu
|
|
136 <option>-audiofile <replaceable>soubor</replaceable></option>.
|
|
137 </para></listitem>
|
|
138 </itemizedlist>
|
|
139 </sect1>
|
|
140
|
|
141
|
|
142 <sect1 id="menc-feat-enc-libavcodec">
|
|
143 <title>Enkódování s rodinou kodeků <systemitem class="library">libavcodec</systemitem>
|
|
144 </title>
|
|
145
|
|
146 <para>
|
|
147 <link linkend="ffmpeg"><systemitem class="library">libavcodec</systemitem></link>
|
|
148 zajišťuje jednoduché enkódování do mnoha zajímavých video a audio formátů.
|
|
149 Můžete enkódovat do následujících kodeků (více méně aktuální):
|
|
150
|
|
151 <informaltable frame="all">
|
|
152 <tgroup cols="2">
|
|
153 <thead>
|
|
154 <row><entry>Jméno kodeku</entry><entry>Popis</entry></row>
|
|
155 </thead>
|
|
156 <tbody>
|
|
157 <row><entry>mjpeg</entry><entry>
|
|
158 Motion JPEG
|
|
159 </entry></row>
|
|
160 <row><entry>ljpeg</entry><entry>
|
|
161 Lossless (bezztrátový) JPEG
|
|
162 </entry></row>
|
|
163 <row><entry>h263</entry><entry>
|
|
164 H.263
|
|
165 </entry></row>
|
|
166 <row><entry>h263p</entry><entry>
|
|
167 H.263+
|
|
168 </entry></row>
|
|
169 <row><entry>mpeg4</entry><entry>
|
|
170 standardní ISO MPEG-4 (DivX 5, XVID kompatibilní)
|
|
171 </entry></row>
|
|
172 <row><entry>msmpeg4</entry><entry>
|
|
173 prvotní MPEG-4 varianta od MS, v3 (DivX3)
|
|
174 </entry></row>
|
|
175 <row><entry>msmpeg4v2</entry><entry>
|
|
176 prvotní MPEG-4 od MS, v2 (použitý ve starých asf souborech)
|
|
177 </entry></row>
|
|
178 <row><entry>wmv1</entry><entry>
|
|
179 Windows Media Video, verze 1 (WMV7)
|
|
180 </entry></row>
|
|
181 <row><entry>wmv2</entry><entry>
|
|
182 Windows Media Video, verze 2 (WMV8)
|
|
183 </entry></row>
|
|
184 <row><entry>rv10</entry><entry>
|
|
185 starý RealVideo kodek
|
|
186 </entry></row>
|
|
187 <row><entry>mpeg1video</entry><entry>
|
|
188 MPEG-1 video
|
|
189 </entry></row>
|
|
190 <row><entry>mpeg2video</entry><entry>
|
|
191 MPEG-2 video
|
|
192 </entry></row>
|
|
193 <row><entry>huffyuv</entry><entry>
|
|
194 bezztrátová komprese
|
|
195 </entry></row>
|
|
196 <row><entry>asv1</entry><entry>
|
|
197 ASUS Video v1
|
|
198 </entry></row>
|
|
199 <row><entry>asv2</entry><entry>
|
|
200 ASUS Video v2
|
|
201 </entry></row>
|
|
202 <row><entry>ffv1</entry><entry>
|
|
203 bezztrátový video kodek z FFmpeg
|
|
204 </entry></row>
|
|
205 </tbody>
|
|
206 </tgroup>
|
|
207 </informaltable>
|
|
208
|
|
209 První pole obsahuje názvy kodeků, které můžete přiřadit konfiguračnímu parametru
|
|
210 <literal>vcodec</literal>, např: <option>-lavcopts vcodec=msmpeg4</option>
|
|
211 </para>
|
|
212
|
|
213 <informalexample>
|
|
214 <para>
|
|
215 Příklad, s MJPEG kompresí:
|
|
216 <screen>mencoder dvd://2 -o titul2.avi -ovc lavc -lavcopts vcodec=mjpeg -oac copy</screen>
|
|
217 </para>
|
|
218 </informalexample>
|
|
219 </sect1>
|
|
220
|
|
221
|
|
222 <sect1 id="menc-feat-enc-images">
|
|
223 <title>Enkódování z množství vstupních obrázkových souborů (JPEG, PNG, TGA, SGI)</title>
|
|
224
|
|
225 <para>
|
|
226 <application>MEncoder</application> je schopen vytvořit film z jednoho nebo více
|
|
227 JPEG, PNG nebo TGA souborů. Pomocí jednoduchého snímkového kopírování může
|
|
228 vytvořit MJPEG (Motion JPEG), MPNG (Motion PNG) nebo MTGA (Motion TGA) soubory.
|
|
229 </para>
|
|
230
|
|
231 <orderedlist>
|
|
232 <title>Vysvětlení procesu:</title>
|
|
233 <listitem><para>
|
|
234 <application>MEncoder</application> <emphasis>dekóduje</emphasis> vstupní
|
|
235 soubor(y) pomocí knihovny <systemitem class="library">libjpeg</systemitem>
|
|
236 (když dekóduje PNG, použije <systemitem class="library">libpng</systemitem>).
|
|
237 </para></listitem>
|
|
238 <listitem><para>
|
|
239 Potom <application>MEncoder</application> nakrmí dekódovaný snímek do
|
|
240 zvoleného video kompresoru (DivX4, XviD, FFmpeg msmpeg4, atd).
|
|
241 </para></listitem>
|
|
242 </orderedlist>
|
|
243
|
|
244 <formalpara>
|
|
245 <title>Příklady</title>
|
|
246 <para>
|
|
247 Vysvětlení volby <option>-mf</option> je v man stránce.
|
|
248
|
|
249 <informalexample>
|
|
250 <para>
|
|
251 Vytvoření MPEG-4 souboru ze všech JPEG souborů v aktuálním adresáři:
|
|
252 <screen>
|
|
253 mencoder mf://*.jpg -mf w=800:h=600:fps=25:type=jpg -ovc lavc -lavcopts vcodec=mpeg4 -oac copy -o <replaceable>výstup.avi</replaceable>
|
|
254 </screen>
|
|
255 </para>
|
|
256 </informalexample>
|
|
257
|
|
258 <informalexample>
|
|
259 <para>
|
|
260 Vytvoření MPEG-4 souboru z některých JPEG souborů v aktuálním adresáři:
|
|
261 <screen>
|
|
262 mencoder mf://<replaceable>snímek001.jpg,snímek002.jpg</replaceable> -mf w=800:h=600:fps=25:type=jpg -ovc lavc -lavcopts vcodec=mpeg4 -oac copy -o <replaceable>výstup.avi</replaceable>
|
|
263 </screen>
|
|
264 </para>
|
|
265 </informalexample>
|
|
266
|
|
267 <informalexample>
|
|
268 <para>
|
|
269 Vytvoření Motion JPEG (MJPEG) souboru ze všech JPEG souborů v aktuálním
|
|
270 adresáři:
|
|
271 <screen>
|
|
272 mencoder mf://*.jpg -mf w=800:h=600:fps=25:type=jpg -ovc copy -oac copy -o <replaceable>výstup.avi</replaceable>
|
|
273 </screen>
|
|
274 </para>
|
|
275 </informalexample>
|
|
276
|
|
277 <informalexample>
|
|
278 <para>
|
|
279 Vytvoření nekomprimovaného souboru ze všech PNG souborů v aktuálním adresáři:
|
|
280 <screen>
|
|
281 mencoder mf:// -mf w=800:h=600:fps=25:type=png -ovc raw -oac copy -o <replaceable>výstup.avi</replaceable>
|
|
282 </screen>
|
|
283 </para>
|
|
284 </informalexample>
|
|
285
|
|
286 <note><para>
|
|
287 Šířka musí být celé číslo násobek 4, to je dáno omezením RAW RGB AVI formátu.
|
|
288 </para></note>
|
|
289
|
|
290 <informalexample>
|
|
291 <para>
|
|
292 Vytvoření Motion PNG (MPNG) souboru ze všech PNG souborů v aktuálním adresáři:
|
|
293 <screen>
|
|
294 mencoder mf://*.png -mf w=800:h=600:fps=25:type=png -ovc copy -oac copy -o <replaceable>výstup.avi</replaceable> <!--
|
|
295 --></screen>
|
|
296 </para>
|
|
297 </informalexample>
|
|
298
|
|
299 <informalexample>
|
|
300 <para>
|
|
301 Vytvoření Motion TGA (MTGA) souboru ze všech TGA souborů v aktuálním adresáři:
|
|
302 <screen>
|
|
303 mencoder mf://*.tga -mf w=800:h=600:fps=25:type=tga -ovc copy -oac copy -o <replaceable>výstup.avi</replaceable><!--
|
|
304 --></screen>
|
|
305 </para>
|
|
306 </informalexample>
|
|
307
|
|
308 </para>
|
|
309 </formalpara>
|
|
310 </sect1>
|
|
311
|
|
312
|
|
313 <sect1 id="menc-feat-extractsub">
|
|
314 <title>Extrakce DVD titulků do VOBsub souboru</title>
|
|
315
|
|
316 <para>
|
|
317 <application>MEncoder</application> je schopen vyextrahovat titulky z DVD do
|
|
318 VOBsub formátovaných souborů. Ty sestávají ze dvou souborů zakončených
|
|
319 <filename>.idx</filename> a <filename>.sub</filename> a jsou obvykle zabaleny
|
|
320 v jediném <filename>.rar</filename> archivu.
|
|
321 <application>MPlayer</application> je umí přehrávat s pomocí voleb
|
|
322 <option>-vobsub</option> a <option>-vobsubid</option>.
|
|
323 </para>
|
|
324
|
|
325 <para>
|
|
326 Zadejte základní jméno (čili bez přípony <filename>.idx</filename> nebo
|
|
327 <filename>.sub</filename>) výstupních souborů pomocí volby
|
|
328 <option>-vobsubout</option> a index pro tyto titulky ve zbývajících souborech
|
|
329 pomocí <option>-vobsuboutindex</option>.
|
|
330 </para>
|
|
331
|
|
332 <para>
|
|
333 Pokud není vstup z DVD, měli byste použít <option>-ifo</option> pro indikaci
|
|
334 <filename>.ifo</filename> souboru nutného k vytvoření výsledného
|
|
335 <filename>.idx</filename> souboru.
|
|
336 </para>
|
|
337
|
|
338 <para>
|
|
339 Pokud vstup není z DVD a nemáte <filename>.ifo</filename> soubor, budete muset
|
|
340 použít volbu <option>-vobsubid</option> k nastavení, pro které id jazyka se má
|
|
341 vytvořit <filename>.idx</filename> soubor.
|
|
342 </para>
|
|
343
|
|
344 <para>
|
|
345 Každým spuštěním se přidají běžící titulky pokud soubory <filename>.idx</filename>
|
|
346 a <filename>.sub</filename> již existují. Takže byste je měli všechny odstranit
|
|
347 dříve než začnete.
|
|
348 </para>
|
|
349
|
|
350 <example>
|
|
351 <title>Kopírování dvojích titulků z DVD během dvouprůchodového enkódování</title>
|
|
352 <screen>
|
|
353 rm titulky.idx titulky.sub
|
|
354 mencoder dvd://1 -oac copy -ovc lavc -lavcopts vcodec=mpeg4:vpass=1 -vobsubout titulky -vobsuboutindex 0 -sid 2
|
|
355 mencoder dvd://1 -oac copy -ovc lavc -lavcopts vcodec=mpeg4:vpass=2 -vobsubout titulky -vobsuboutindex 1 -sid 5<!--
|
|
356 --></screen>
|
|
357 </example>
|
|
358
|
|
359 <example>
|
|
360 <title>Kopírování francouzských titulků z MPEG souboru</title>
|
|
361 <screen>
|
|
362 rm titulky.idx titulky.sub
|
|
363 mencoder <replaceable>film.mpg</replaceable> -ifo <replaceable>film.ifo</replaceable> -vobsubout titulky -vobsuboutindex 0 -vobsuboutid fr -sid 1<!--
|
|
364 --></screen>
|
|
365 </example>
|
|
366
|
|
367 </sect1>
|
|
368
|
|
369 <sect1 id="aspect">
|
|
370 <title>Zachování poměru stran</title>
|
|
371 <para>
|
|
372 DVD a SVCD (čili MPEG-1/2) soubory obsahují hodnotu poměru stran,
|
|
373 popisující, jak by měl přehrávač škálovat video proud, takže lidé nebudou mít
|
|
374 šišaté hlavy (př.: 480x480 + 4:3 = 640x480). Pokud ovšem enkódujeme do AVI
|
|
375 (DivX) souborů, mějte na paměti, že AVI hlavičky neukládají tuto hodnotu.
|
|
376 Přeškálování videa je odporné a časově náročné, takže musí být lepší způsob!
|
|
377 </para>
|
|
378
|
|
379 <para>A zde jej máte</para>
|
|
380
|
|
381 <para>
|
|
382 MPEG-4 má unikátní vlastnost: video proud může obsahovat svůj požadovaný poměr
|
|
383 stran. Ano, přesně jako MPEG-1/2 (DVD, SVCD) a H.263 soubory. Naneštěstí,
|
|
384 <emphasis role="bold">žádný</emphasis> video přehrávač nepodporuje tento atribut
|
|
385 MPEG-4, s výjimkou <application>MPlayer</application>u.
|
|
386 </para>
|
|
387
|
|
388 <para>
|
|
389 Tato vlastnost může být použita pouze s kodekem <systemitem>mpeg4</systemitem> z
|
|
390 <link linkend="ffmpeg"><systemitem class="library">libavcodec</systemitem></link>u.
|
|
391 Mějte na paměti: ačkoli
|
|
392 <application>MPlayer</application> korektně přehraje vytvořený soubor, ostatní
|
|
393 přehrávače použijí špatný poměr stran.
|
|
394 </para>
|
|
395
|
|
396 <para>
|
|
397 Opravdu byste měli oříznout černé okraje nad a pod filmem.
|
|
398 Nastudujte si použití filtrů <systemitem>cropdetect</systemitem> a
|
|
399 <systemitem>crop</systemitem> v man stránce.
|
|
400 </para>
|
|
401
|
|
402 <para>
|
|
403 Použití
|
|
404 <screen>mencoder <replaceable>vzorové-svcd.mpg</replaceable> -ovc lavc -lavcopts vcodec=mpeg4:autoaspect -vf crop=714:548:0:14 -oac copy -o <replaceable>výstup.avi</replaceable></screen>
|
|
405 </para>
|
|
406 </sect1>
|
|
407
|
|
408 <sect1 id="custommatrices"><title>Uživatelské inter/intra matice</title>
|
|
409
|
|
410 <para>
|
|
411 Díky této vlastnosti
|
|
412 <link linkend="ffmpeg"><systemitem class="library">libavcodec</systemitem></link>u
|
|
413 můžete nastavit uživatelskou inter (I-snímky/klíčové snímky) a intra
|
|
414 (P-snímky/predikované (rozumějte vypočítané) snímky) matice. To je podporováno
|
|
415 mnoha kodeky:
|
|
416 <systemitem>mpeg1video</systemitem> a <systemitem>mpeg2video</systemitem>
|
|
417 jsou hlášeny jako funkční.
|
|
418 </para>
|
|
419
|
|
420 <para>
|
|
421 Typické použití této vlastnosti je nastavení matic preferovaných
|
|
422 <ulink url="http://www.kvcd.net/">KVCD</ulink> specifikacemi.
|
|
423 </para>
|
|
424
|
|
425 <para>
|
|
426 <emphasis role="bold">Kvantizační Matice KVCD "Notch":</emphasis>
|
|
427 </para>
|
|
428
|
|
429 <para>
|
|
430 Intra:
|
|
431 <screen>
|
|
432 8 9 12 22 26 27 29 34
|
|
433 9 10 14 26 27 29 34 37
|
|
434 12 14 18 27 29 34 37 38
|
|
435 22 26 27 31 36 37 38 40
|
|
436 26 27 29 36 39 38 40 48
|
|
437 27 29 34 37 38 40 48 58
|
|
438 29 34 37 38 40 48 58 69
|
|
439 34 37 38 40 48 58 69 79
|
|
440 </screen>
|
|
441
|
|
442 Inter:
|
|
443 <screen>
|
|
444 16 18 20 22 24 26 28 30
|
|
445 18 20 22 24 26 28 30 32
|
|
446 20 22 24 26 28 30 32 34
|
|
447 22 24 26 30 32 32 34 36
|
|
448 24 26 28 32 34 34 36 38
|
|
449 26 28 30 32 34 36 38 40
|
|
450 28 30 32 34 36 38 42 42
|
|
451 30 32 34 36 38 40 42 44
|
|
452 </screen>
|
|
453 </para>
|
|
454
|
|
455 <para>
|
|
456 Použití:
|
|
457 <screen>
|
|
458 $ mencoder <replaceable>vstup.avi</replaceable> -o <replaceable>výstup.avi</replaceable> -oac copy -ovc lavc -lavcopts inter_matrix=...:intra_matrix=...
|
|
459 </screen>
|
|
460 </para>
|
|
461
|
|
462 <para>
|
|
463 <screen>
|
|
464 $ mencoder <replaceable>vstup.avi</replaceable> -ovc lavc -lavcopts
|
|
465 vcodec=mpeg2video:intra_matrix=8,9,12,22,26,27,29,34,9,10,14,26,27,29,34,37,
|
|
466 12,14,18,27,29,34,37,38,22,26,27,31,36,37,38,40,26,27,29,36,39,38,40,48,27,
|
|
467 29,34,37,38,40,48,58,29,34,37,38,40,48,58,69,34,37,38,40,48,58,69,79
|
|
468 :inter_matrix=16,18,20,22,24,26,28,30,18,20,22,24,26,28,30,32,20,22,24,26,
|
|
469 28,30,32,34,22,24,26,30,32,32,34,36,24,26,28,32,34,34,36,38,26,28,30,32,34,
|
|
470 36,38,40,28,30,32,34,36,38,42,42,30,32,34,36,38,40,42,44 -oac copy -o svcd.mpg
|
|
471 </screen>
|
|
472 </para>
|
|
473 </sect1>
|
|
474
|
|
475 <sect1 id="menc-feat-dvd-mpeg4">
|
|
476 <title>Vytvoření MPEG-4 ("DivX") ripu DVD filmu ve vysoké kvalitě</title>
|
|
477
|
|
478 <para>
|
|
479 Velmi častou otázkou je "Jak mohu vytvořit rip v nejvyšší možné kvalitě pro
|
|
480 danou velikost?". Další otázkou je "Jak vytvořím DVD rip v nejvyšší možné
|
|
481 kvalitě? Velikost souboru mě nezajímá, chci tu nejvyšší kvalitu."
|
|
482 </para>
|
|
483
|
|
484 <para>
|
|
485 Druhá otázka je poněkud špatně položená. Konec konců, pokud je vám lhostejná
|
|
486 velikost souboru, proč prostě nezkopírujete celý MPEG-2 video proud z DVD?
|
|
487 Jistěže vaše AVI bude mít kolem 5 GB, ale pokud chcete nejvyšší kvalitu a
|
|
488 na velikosti nezáleží, je to jistě nejlepší volba.
|
|
489 </para>
|
|
490
|
|
491 <para>
|
|
492 Ve skutečnosti, důvodem převodu DVD do MPEG-4 je právě to, že vám na velikosti
|
|
493 souboru <emphasis role="bold">záleží</emphasis>.
|
|
494 </para>
|
|
495
|
|
496 <para>
|
|
497 Je těžké nabídnout kuchařku jak vytvořit DVD rip ve velmi vysoké kvalitě. Je
|
|
498 nutné uvážit množství faktorů a měli byste rozumět těmto detailům, jinak
|
|
499 budete asi zklamáni výsledkem. Níže prozkoumáme některé z těchto věcí a
|
|
500 pak se podíváme na příklad. Předpokládáme, že použijete
|
|
501 <systemitem class="library">libavcodec</systemitem> pro enkódování videa,
|
|
502 ačkoli teorie je stejná i pro ostatní kodeky.
|
|
503 </para>
|
|
504
|
|
505 <para>
|
|
506 Pokud je toho na vás moc, asi byste měli použít některý z pěkných frontendů,
|
|
507 které jsou zmíněny v
|
|
508 <ulink url="http://mplayerhq.hu/homepage/design7/projects.html#mencoder_frontends">sekci MEncoder</ulink>
|
|
509 na naší stránce odvozených projektů.
|
|
510 Takto budete schopni dosahovat vysoce kvalitních ripů bez velkého přemýšlení,
|
|
511 protože většina těchto nástrojů je navržena tak, aby dělala vhodná rozhodnutí
|
|
512 za vás.
|
|
513 </para>
|
|
514
|
|
515 <sect2 id="menc-feat-dvd-mpeg4-2pass">
|
|
516 <title>Pevný kvantizer vs. dva průchody</title>
|
|
517
|
|
518 <para>
|
|
519 Jsou tři přístupy k enkódování videa: pevný datový tok (CBR), pevný kvantizer
|
|
520 a dvouprůchodový (ABR, nebili průměrovaný datový tok).
|
|
521 </para>
|
|
522
|
|
523 <para>
|
|
524 V každém z těchto režimů <systemitem class="library">libavcodec</systemitem>
|
|
525 rozbije videosnímek na makrobloky 16x16 pixelů a potom na každý makroblok
|
|
526 aplikuje kvantizer. Čím je nižší kvantizer, tím je vyšší kvalita a datový tok.
|
|
527 Metoda, kterou <systemitem class="library">libavcodec</systemitem> používá pro
|
|
528 určení jaký kvantizer použít pro daný makroblok, se liší a je vysoce
|
|
529 ovlivnitelná. (Toto je extrémní zjednodušení daného procesu, ale je vhodné
|
|
530 rozumět základnímu principu.)
|
|
531 </para>
|
|
532
|
|
533 <para>
|
|
534 Pokud nastavíte konstantní datový tok, <systemitem
|
|
535 class="library">libavcodec</systemitem> bude enkódovat video tak, že zahodí
|
|
536 detaily podle potřeby a jen tolik, aby se udržel pod zadaným datovým tokem.
|
|
537 Pokud je vám opravdu lhostejná velikost souboru, můžete také použít CBR a
|
|
538 nastavit datový tok na nekonečno. (V praxi to znamená nastavit hodnotu tak
|
|
539 vysoko, aby nijak neomezovala, jako 10000 Kbitů.) Bez reálného omezení
|
|
540 datového toku použije <systemitem class="library">libavcodec</systemitem>
|
|
541 nejnižší možný kvantizer pro každý makroblok (ten je nastaven pomocí
|
|
542 <option>vqmin</option>, výchozí je 2). Jakmile nastavíte dostatečně nižší
|
|
543 datový tok, takže je <systemitem class="library">libavcodec</systemitem>
|
|
544 přinucen použít vyšší kvantizer, pak téměř jistě snížíte kvalitu svého videa.
|
|
545 Abyste se tomu vyhnuli, měli byste zvážit zmenšení videa podle postupu
|
|
546 popsaného později v této příručce.
|
|
547 </para>
|
|
548
|
|
549 <para>
|
|
550 Při konstantním kvantizeru <systemitem class="library">libavcodec</systemitem>
|
|
551 používá kvantizer nastavený volbou <option>vqscale</option> na každý makroblok.
|
|
552 Pokud chcete maximálně kvalitní rip, opět bez ohledu na datový tok, můžete
|
|
553 použít <option>vqscale=2</option>. To povede ke stejnému datovému toku a PSNR
|
|
554 (odstup signál–šum) jako CBR s <option>vbitrate</option>=infinity a
|
|
555 výchozím <option>vqmin</option> rovným 2.
|
|
556 </para>
|
|
557
|
|
558 <para>
|
|
559 Problém s konstantní kvantizací je ten, že používá zadaný kvantizer ať to daný
|
|
560 makroblok potřebuje či nikoli. Je totiž možné použít vyšší kvantizer na
|
|
561 makroblok bez obětování viditelné kvality. Proč tedy plýtvat bity s nemístně
|
|
562 nízkým kvantizerem? Váše CPU má tolik cyklů, kolik máte času, ale na harddisku
|
|
563 máte jen určitý počet bitů.
|
|
564 </para>
|
|
565
|
|
566 <para>
|
|
567 Při dvouprůchodovém enkódování se v prvním průchodu projde film jakoby měl být
|
|
568 CBR, ale vlastnosti každého snímku se zaznamenají do logu. Tato data jsou pak
|
|
569 použita při druhém průchodu pro inteligentní stanovení použitého kvantizeru.
|
|
570 V rychlých scénách nebo scénách s malým počtem detailů budou častěji používány
|
|
571 vyšší kvantizery a v pomalých nebo detailních scénách zase nižší kvantizery.
|
|
572 </para>
|
|
573
|
|
574 <para>
|
|
575 Pokud použijete <option>vqscale=2</option>, plýtváte bity. Pokud použijete
|
|
576 <option>vqscale=3</option>, pak nedostanete nejkvalitnější možný rip.
|
|
577 Dejme tomu, že ripujete DVD při <option>vqscale=3</option> a
|
|
578 výsledkem je 1800Kbit. Pokud provedete dvouprůchodové enkódování
|
|
579 s <option>vbitrate=1800</option>, výsledné video bude mít <emphasis
|
|
580 role="bold">vyšší kvalitu</emphasis> při
|
|
581 <emphasis role="bold">stejném datovém toku</emphasis>.
|
|
582 </para>
|
|
583
|
|
584 <para>
|
|
585 Jelikož jsme vás nyní přesvědčili, že dvouprůchodový režim je správná volba,
|
|
586 skutečnou otázkou je, jaký datový tok použít? Odpověď je, že není jediná
|
|
587 odpověď. Ideálně byste měli zvolit takový datový tok, který zajistí nejlepší
|
|
588 rovnováhu mezi kvalitou a velikostí souboru. Ten bude pokaždé jiný
|
|
589 v závislosti na zdrojovém videu.
|
|
590 </para>
|
|
591
|
|
592 <para>
|
|
593 Pokud na velikosti souboru nezáleží, pak je dobrý startovní můstek pro rip
|
|
594 s velmi vysokou kvalitou je kolem 2000 Kbitů plus-mínus 200 Kbitů.
|
|
595 Pro rychlé akční nebo vysoce detailní zdrojové video, nebo máte-li velmi
|
|
596 kritické oko, se budete rozhodovat mezi 2400 nebo 2600.
|
|
597 U některých DVD nepoznáte rozdíl při 1400 Kbitech. Je vhodné experimentovat
|
|
598 se scénami při různých datových tocích, abyste pro to dostali cit.
|
|
599 </para>
|
|
600
|
|
601 <para>
|
|
602 Pokud se snažíte o určitou velikost, budete muset nějak spočítat datový tok.
|
|
603 Ale ještě předtím musíte zjistit, kolik místa byste měli rezervovat pro
|
|
604 zvukové(ou) stopy(u), takže byste si
|
|
605 <link linkend="menc-feat-dvd-mpeg4-audio">je měli ripnout</link> jako první.
|
|
606 Můžete si pak spočítat datový tok pomocí následující rovnice:
|
|
607 <systemitem>datový_tok = (požadovaná_velikost_v_Mbajtech - velikost_zvuku_v_Mbajtech) *
|
|
608 1024 * 1024 / délka_v_sek * 8 / 1000</systemitem>
|
|
609 Například abyste nacpali dvouhodinový film na 702MB CD, se 60MB zvukovou
|
|
610 stopou, bude muset být datový tok videa:
|
|
611 <systemitem>(702 - 60) * 1024 * 1024 / (120*60) * 8 / 1000
|
|
612 = 740kbps (kilobitů za sekundu)</systemitem>
|
|
613 </para>
|
|
614
|
|
615 </sect2>
|
|
616
|
|
617
|
|
618 <sect2 id="menc-feat-dvd-mpeg4-constraints">
|
|
619 <title>Omezení pro efektivní enkódování</title>
|
|
620
|
|
621 <para>
|
|
622 Ze samé podstaty komprese typu MPEG vyplývají určitá omezení, která byste měli
|
|
623 ctít, pokud chcete maximální kvalitu.
|
|
624 MPEG rozdělí video na čtverce 16x16 nazývané makrobloky, které se skládají
|
|
625 ze čtyř bloků 8x8 jasové (luma) složky a dvou bloků 8x8 barevné (chroma)
|
|
626 složky v polovičním rozlišení (jeden pro osu červená-cyan (modrozelená) a druhý pro osu
|
|
627 modrá-žlutá).
|
|
628 Dokonce i když šířka a výška vašeho videa nejsou násobky 16, použije enkodér
|
|
629 dostatek 16x16 makrobloků, aby pokryl celou oblast obrazu a zabere místo
|
|
630 navíc, které přijde vniveč.
|
|
631 Takže chcete-li maximalizovat kvalitu při dané velikosti souboru, není dobrý
|
|
632 nápad používat rozměry které nejsou násobky 16.
|
|
633 </para>
|
|
634
|
|
635 <para>
|
|
636 Většina DVD má také různě velké černé okraje videa. Ponechání těchto ploch
|
|
637 může různým způsobem snížit kvalitu.
|
|
638 </para>
|
|
639
|
|
640 <orderedlist>
|
|
641 <listitem>
|
|
642 <para>
|
|
643 Komprese typu MPEG je rovněž velmi závislá na plošných frekvenčních
|
|
644 transformacích, konkrétně Diskrétní Kosinové Transformaci (DCT), která se
|
|
645 podobá Fourierově transformaci. Tento druh enkódování je efektivní na
|
|
646 reprezentaci opakujících se vzorů a pozvolné přechody, ale má potíže s ostrými
|
|
647 přechody. Chcete-li je enkódovat, musíte použít mnoho bitů, jinak se objeví
|
|
648 artefakty známé jako kroužkování.
|
|
649 </para>
|
|
650
|
|
651 <para>
|
|
652 Frekvenční transformace (DCT) je provedena zvlášť pro každý makroblok
|
|
653 (ve skutečnosti na každý blok), takže problém nastane pouze tehdy, je-li ostrý
|
|
654 přechod uvnitř bloku. Pokud vaše černé okraje začínají přesně na hranicích
|
|
655 násobků 16 pixelů, pak to není problém. Černé okraje jsou však na DVD jen
|
|
656 málokdy pěkně umístěny, takže je v praxi budete muset vždy odstranit, abyste
|
|
657 se vyhnuli tomuto problému.
|
|
658 </para>
|
|
659 </listitem>
|
|
660 </orderedlist>
|
|
661
|
|
662 <para>
|
|
663 Navíc k plošně frekvenčním transformacím používá komprese typu MPEG vektory
|
|
664 pohybu k popisu změn od jednoho snímku ke druhému. Vektory pohybu přirozeně
|
|
665 pracují méně efektivně s novým obsahem přicházejícím zpoza okrajů snímku,
|
|
666 protože ten nebyl přítomen na předchozím snímku. Dokud se obraz rozšiřuje
|
|
667 směrem k okrajům snímku, nemají s tím vektory pohybu žádný problém, ale
|
|
668 jsou-li zde černé okraje, může problém nastat:
|
|
669 </para>
|
|
670
|
|
671 <orderedlist continuation="continues">
|
|
672 <listitem>
|
|
673 <para>
|
|
674 Komprese typu MPEG ukládá pro každý makroblok vektor, identifikující která
|
|
675 část předchozího obrázku by měla být zkopírována onoho makrobloku jako základ
|
|
676 pro predikci následujícího snímku. Pouze zbývající odlišnosti musí být
|
|
677 enkódovány. Pokud makroblok přesahuje okraj obrázku a obsahuje část černého
|
|
678 okraje, vektory pohybu z ostatních částí obrázku přepíší černý okraj.
|
|
679 To znamená mnoho bitů spotřebovaných buď na znovuzačernění, nebo se (spíš)
|
|
680 vektory pohybu nepoužijí vůbec a všechny změny v tomto makrobloku se budou
|
|
681 kódovat přímo. Jinými slovy se velmi sníží efektivita enkódování.
|
|
682 </para>
|
|
683
|
|
684 <para>
|
|
685 Tento problém nastává opět jen v případě, že černé okraje nezačínají na lince
|
|
686 jejíž pozice je násobkem 16.
|
|
687 </para>
|
|
688 </listitem>
|
|
689
|
|
690 <listitem>
|
|
691 <para>
|
|
692 Nakonec zde máme makroblok uvnitř obrázku do nějž se posunuje objekt z okraje
|
|
693 obrázku. Kódování typu MPEG neumí říct "zkopíruj to co je na obrázku, ale ne
|
|
694 černý okraj." Takže se zkopíruje i černý okraj a spotřebuje se spousta bitů
|
|
695 na enkódování té části obrázku, která tu měla být.
|
|
696 </para>
|
|
697
|
|
698 <para>
|
|
699 Pokud se obrázek dostane úplně ven z enkódované oblasti, má MPEG speciální
|
|
700 optimalizace pro opakované kopírování pixelů na okraj obrázku pokud přijde
|
|
701 vektor pohybu zvenčí enkódované oblasti. Tato vlastnost bude k ničemu, pokud
|
|
702 má film černé okraje. Na rozdíl od problémů 1 a 2 zde umístění okrajů na
|
|
703 násobky 16 nepomůže.
|
|
704 </para>
|
|
705 </listitem>
|
|
706
|
|
707 <listitem>
|
|
708 <para>
|
|
709 Navzdory tomu, že okraje jsou úplně černé a nikdy se nemění, je zde vždy
|
|
710 alespoň minimální datový tok spotřebovaný na větší množství makrobloků.
|
|
711 </para>
|
|
712 </listitem>
|
|
713 </orderedlist>
|
|
714
|
|
715 <para>
|
|
716 Ze všech těchto důvodů doporučujeme zcela odstranit černé okraje. Dále, pokud
|
|
717 je na okraji obrázku oblast se šumem/zkreslením, jejím odstřižením se ještě
|
|
718 zvýší efektivita enkódování. Videofilní puristé, kteří chtějí zůstat tak
|
|
719 blízko originálu, jak je to jen možné, mohou protestovat proti tomuto ořezání,
|
|
720 ale pokud nehodláte enkódovat s konstantním kvantizerem, kvalita kterou
|
|
721 dostanete díky ořezání znatelně převýší množství ztracených informací na
|
|
722 okrajích.
|
|
723 </para>
|
|
724 </sect2>
|
|
725
|
|
726
|
|
727 <sect2 id="menc-feat-dvd-mpeg4-crop">
|
|
728 <title>Ořezávání a škálování</title>
|
|
729
|
|
730 <para>
|
|
731 Nativní DVD rozlišení je 720x480 pro NTSC a 720x576 pro PAL, ale je zde ještě
|
|
732 příznak poměru stran, který udává, zda se jedná o obrazovku (full-screen)(4:3),
|
|
733 nebo širokoúhlý film (wide-screen)(16:9). Mnoho (jestli ne většina)
|
|
734 širokoúhlých DVD není přesně 16:9, ale bude buď 1.85:1 anebo 2.35:1
|
|
735 (cinescope). To znamená, že zde budou ve videu černé okraje, které bude nutné
|
|
736 odstřihnout.
|
|
737 </para>
|
|
738
|
|
739 <para>
|
|
740 <application>MPlayer</application> poskytuje filtr pro detekci potřebného
|
|
741 ořezu, který stanoví ořezový obdélník (<option>-vf cropdetect</option>).
|
|
742 Protože MPEG-4 používá makrobloky 16x16, měli byste se ujistit, že oba rozměry
|
|
743 videa jsou násobkem 16, jinak snížíte kvalitu, zvlášť při nízkých datových
|
|
744 tocích. Můžete to zajistit zaokrouhlením šířky a výšky ořezového obdélníku
|
|
745 dolů na nejbližší násobek 16. Při ořezávání byste měli zvýšit odsazení
|
|
746 (offset) v ose y o polovinu rozdílu mezi starou a novou výškou, takže bude
|
|
747 výsledné video bráno ze středu snímku. Z důvodu principu vzorkování DVD videa
|
|
748 se ujistěte, že je odsazení sudé číslo. (Popravdě, přijměte jako pravidlo,
|
|
749 nikdy nepoužívat liché hodnoty pro jakýkoli z parametrů při ořezávání a
|
|
750 škálování videa.) Pokud nechcete zahodit těch několik pixelů navíc, můžete
|
|
751 místo toho raději změnit velikost videa (škálovat). Na to se podíváme
|
|
752 v příkladu níže.
|
|
753 V praxi můžete nechat filtr <option>cropdetect</option> udělat všechnu práci
|
|
754 zmíněnou výše, jelikož má volitelný parametr <option>round</option>
|
|
755 (zaokrouhlení), jehož výchozí hodnota je 16.
|
|
756 </para>
|
|
757
|
|
758 <para>
|
|
759 Rovněž buďte opatrní na "napůl černé" pixely na okrajích. Vždy je rovněž
|
|
760 odstřihněte, jinak zde budete plýtvat bity, které můžete použít jinde.
|
|
761 </para>
|
|
762
|
|
763 <para>
|
|
764 Poté co provedete vše, co jsme si doposud řekli, budete mít video, které asi
|
|
765 nebude právě 1.85:1 nebo 2.35:1, ale někde poblíž. Můžete spočítat nový poměr
|
|
766 stran ručně, ale <application>MEncoder</application> nabízí volbu pro
|
|
767 class="library">libavcodec</systemitem> nazývanou <option>autoaspect</option>,
|
|
768 která to za vás udělá. Nezvětšujte video jen proto, abyste dosáhli čtvercových
|
|
769 pixelů, pokud je vám milé místo na disku. Škálování by mělo být provedeno při
|
|
770 přehrávání, kdy přehrávač použije poměr stran uložený v AVI pro zajištění
|
|
771 správného rozlišení.
|
|
772 Naneštěstí ne všechny přehrávače uplatňují tuto autoškálovací informaci,
|
|
773 takže můžete přece jen chtít škálovat.
|
|
774 </para>
|
|
775
|
|
776 <para>
|
|
777 Nejdřív byste si měli spočítat enkódovaný poměr stran:
|
|
778 <systemitem>PSo = (Šo x (PSa / PRdvd )) / Vo</systemitem>
|
|
779 <itemizedlist>
|
|
780 <title>kde:</title>
|
|
781 <listitem><para>
|
|
782 Šo a Vo jsou šířka a výška ořezaného videa,
|
|
783 </para></listitem>
|
|
784 <listitem><para>
|
|
785 PRdvd je poměr pixelů v DVD, který je roven 1.25=(720/576) pro DVD
|
|
786 </para></listitem>
|
|
787 <listitem><para>
|
|
788 v PALu a 1.5=(720/480) pro DVD v NTSC,
|
|
789 </para></listitem>
|
|
790 </itemizedlist>
|
|
791 </para>
|
|
792
|
|
793 <para>
|
|
794 Pak si můžete spočítat rozlišení X a Y podle určitého faktoru kvality komprese
|
|
795 (CQ):
|
|
796 <systemitem>RozY = INT(SQRT( 1000*Datový_tok/25/PSo/CQ )/16) * 16</systemitem>
|
|
797 <systemitem>RozX = INT( RozY * PSo / 16) * 16</systemitem>
|
|
798 </para>
|
|
799
|
|
800 <para>
|
|
801 Dobře, ale co je ten CQ?
|
|
802 CQ odpovídá počtu bitů na pixel a na snímek v zakódování. Jinými slovy, čím
|
|
803 vyšší je CQ, tím nižší je šance uvidět enkódovací artefakty.
|
|
804 Pokud ovšem máte cílový rozměr vašeho filmu (1 nebo 2 CD například), máte jen
|
|
805 omezené množství bitů, které můžete spotřebovat; takže je nutné najít vhodný
|
|
806 kompromis mezi komprimovatelností a kvalitou.
|
|
807 </para>
|
|
808
|
|
809 <para>
|
|
810 CQ závisí jak na datovém toku, tak na rozlišení filmu. Abyste zvýšili CQ,
|
|
811 obvykle zmenšíte daný film, takže je datový tok spočítán ve funkci cílové
|
|
812 velikosti a délky filmu, které jsou konstantní.
|
|
813 CQ pod 0.18 obvykle vede k velmi čtverečkovanému obrazu, protože není dostatek
|
|
814 bitů pro zakódování informací každého makrobloku (MPEG4, stejně jako mnoho
|
|
815 jiných kodeků seskupuje pixely do bloků při komprimaci obrázku; pokud není
|
|
816 dostatek bitů, jsou viditelné hranice těchto bloků).
|
|
817 Proto je rozumné volit CQ v rozmezí 0.20 až 0.22 pro rip na 1 CD a
|
|
818 0.26 až 0.28 pro 2 CD.
|
|
819 </para>
|
|
820
|
|
821 <para>
|
|
822 Prosíme berte v potaz, že CQ je jen informační pomůcka závisející na
|
|
823 enkódovaném obsahu. CQ okolo 0.18 může být dostatečně dobrý pro Bergmana,
|
|
824 na rozdíl od filmu jako je Matrix, který obsahuje mnoho rychlých scén.
|
|
825 Na druhou stranu je zbytečné zvyšovat CQ výš než 0.30, jelikož budete plýtvat
|
|
826 bity za minimální zisk kvality.
|
|
827 </para>
|
|
828
|
|
829 </sect2>
|
|
830
|
|
831 <sect2 id="menc-feat-dvd-mpeg4-audio">
|
|
832 <title>Zvuk</title>
|
|
833
|
|
834 <para>
|
|
835 Zvuk je mnohem jednodušší problém k řešení: pokud prahnete po kvalitě, prostě
|
|
836 jej nechte tak jak je.
|
|
837 Dokonce i AC3 5.1 datové proudy mají nanejvýš 448Kbitů/s a stojí za každý bit.
|
|
838 Možná jste v pokušení převést zvuk do Ogg Vorbis při vysoké kvalitě, ale jen
|
|
839 proto, že dnes nemáte A/V receiver pro hardwarové dekódování AC3 neznamená,
|
|
840 že jej nebudete mít zítra. Připravte své DVD ripy zachováním AC3 datových
|
|
841 proudů.
|
|
842 Datový proud AC3 můžete zachovat buď jeho zkopírováním přímo do video proudu
|
|
843 <link linkend="menc-feat-mpeg4">během enkódování</link>.
|
|
844 Také můžete extrahovat AC3 proud, abyste jej pak namixovali do nosičů jako je
|
|
845 NUT nebo Matroska.
|
|
846 <screen>mplayer <replaceable>zdrojový_soubor.vob</replaceable> -aid 129 -dumpaudio -dumpfile <replaceable>zvuk.ac3</replaceable></screen>
|
|
847 vytáhne do souboru <replaceable>zvuk.ac3</replaceable> zvukovou stopu
|
|
848 číslo 129 ze souboru <replaceable>zdrojový_soubor.vob</replaceable> (NB: DVD
|
|
849 VOB soubory obvykle používají odlišné číslování audia,
|
|
850 což znamená, že VOB zvuková stopa 120 je druhou zvukovou stopou v souboru).
|
|
851 </para>
|
|
852
|
|
853 <para>
|
|
854 Někdy ovšem opravdu nemáte jinou možnost než dále zkomprimovat zvuk, aby vám
|
|
855 zbylo více bitů na video.
|
|
856 Většina lidí volí komprimaci buď pomocí MP3 nebo Vorbis audio kodeků.
|
|
857 Zatímco ten druhý je efektivnější z prostorového hlediska, MP3 je lépe
|
|
858 podporován hardwarovými přehrávači, ačkoli časy se mění.
|
|
859 </para>
|
|
860
|
|
861 <para>
|
|
862 Nejdříve ze všeho budete muset převést DVD zvuk do WAV souboru, který pak
|
|
863 použije zvukový kodek jako vstup.
|
|
864 Například:
|
|
865 <screen>mplayer <replaceable>zdrojový_soubor.vob</replaceable> -ao pcm:file=<replaceable>výsledný_zvuk.wav</replaceable> -vc dummy -aid 1 -vo null</screen>
|
|
866 vylije druhou zvukovou stopu ze souboru
|
|
867 <replaceable>zdrojový_soubor.vob</replaceable> do souboru
|
|
868 <replaceable>výsledný_zvuk.wav</replaceable>.
|
|
869 Měli byste normalizovat zvuk před enkódováním, protože DVD zvukové stopy jsou
|
|
870 obvykle nahrávány při nízkých hlasitostech.
|
|
871 Můžete například použít nástroj <application>normalize</application>, který je
|
|
872 k dispozici ve většině distribucí.
|
|
873 Pokud používáte Windows, stejnou práci udělá nástroj jako
|
|
874 <application>BeSweet</application>.
|
|
875 Komprimovat budete buď ve Vorbisu nebo MP3.
|
|
876 Například:
|
|
877 <screen>oggenc -q1 <replaceable>cílový_zvuk.wav</replaceable></screen>
|
|
878 provede enkódování <replaceable>cílového_zvuku.wav</replaceable> s kvalitou 1,
|
|
879 která přibližně odpovídá 80Kb/s a je to minimální kvalita na kterou byste měli
|
|
880 enkódovat, pokud vám záleží na kvalitě.
|
|
881 Poznamenejme, že <application>MEncoder</application> v současnosti neumí
|
|
882 muxovat Vorbis zvukové stopy do výstupního souboru, protože podporuje pouze
|
|
883 AVI a MPEG kontejnery jako výstup. Pro oba platí, že některé přehrávače mohou
|
|
884 mít problémy s udržením audio/video synchronizace, pokud je přítomen VBR zvuk
|
|
885 jako je Vorbis.
|
|
886 Nemějte obavy, v tomto dokumentu vám ukážeme, jak to lze udělat pomocí
|
|
887 programů třetích stran.
|
|
888 </para>
|
|
889
|
|
890 </sect2>
|
|
891
|
|
892 <sect2 id="menc-feat-dvd-mpeg4-interlacing">
|
|
893 <title>Prokládání a Telecine</title>
|
|
894
|
|
895 <para>
|
|
896 Téměř veškeré filmy jsou natáčeny při 24 snímcích/s. Jelikož NTSC má
|
|
897 snímkovou rychlost 30000/1001 snímků/s, je třeba provést úpravu těchto
|
|
898 24 snímků/s videí, aby měly správnou NTSC snímkovou rychlost. Tato úprava se
|
|
899 jmenuje 3:2 pulldown a obecně je známa jako telecine (protože je pulldown
|
|
900 často prováděn během přenosu filmu na video) a, jednoduše řečeno, pracuje tak,
|
|
901 že se film zpomalí na 24000/1001 snímků/s a každý čtvrtý snímek se zopakuje.
|
|
902 </para>
|
|
903
|
|
904 <para>
|
|
905 Naopak žádné speciální úpravy se neprovádějí videu pro PAL DVD, která běží
|
|
906 při 25 snímcích/s. (Technicky lze na PAL provést telecine, tzv. 2:2 pulldown,
|
|
907 ale v praxi se nepoužívá.) Film s 24 snímky/s je jednoduše přehráván rychlostí
|
|
908 25 snímků/s. Výsledkem je, že video běží o něco rychleji, ale pokud nejste
|
|
909 vetřelec, tak si rozdílu ani nevšimnete. Většina filmů má navíc výškově
|
|
910 korigovaný zvuk, takže při přehrávání 25 snímků/s vše zní jak má i přesto, že
|
|
911 zvuk (a proto i celé video) má o 4% kratší dobu přehrávání než NTSC DVD.
|
|
912 </para>
|
|
913
|
|
914 <para>
|
|
915 Jelikož video na PAL DVD nebylo upravováno, nemusíte si dělat starosti s jeho
|
|
916 snímkovou rychlostí. Zdroj má 25 snímků/s, váš rip také. Pokud ovšem ripujete
|
|
917 NTSC DVD film, musíte provést inverzní telecine.
|
|
918 </para>
|
|
919
|
|
920 <para>
|
|
921 Filmy točené rychlostí 24 snímků/s jsou na NTSC DVD uloženy buď jako
|
|
922 30000/1001 po telecine, nebo jako progresivní (neprokládaný) se snímkovou
|
|
923 24000/1001 snímků/s, na kterých by měl provést telecine DVD přehrávač za letu.
|
|
924 Není to ale zákon: některé TV série jsou prokládané (např. Buffy Lovec upírů),
|
|
925 zatímco jiné jsou porůznu neprokládané nebo prokládané (např. Anděl, nebo 24
|
|
926 hodin).
|
|
927 </para>
|
|
928
|
|
929 <para>
|
|
930 Doporučujeme, abyste si přečetli sekci o tom
|
|
931 <link linkend="menc-feat-telecine">Jak si poradit s telecine a prokladem na NTSC DVD</link>
|
|
932 a naučili se jak využít různé možnosti.
|
|
933 </para>
|
|
934
|
|
935 <para>
|
|
936 Pokud ovšem většinou ripujete pouze filmy, nejspíš se setkáváte
|
|
937 s neprokládaným nebo prokládaným videem 24 snímků/s. V tom případě můžete
|
|
938 použít <option>pullup</option> filtr <option>-vf pullup,softskip</option>.
|
|
939 </para>
|
|
940
|
|
941 </sect2>
|
|
942
|
|
943
|
|
944 <sect2 id="menc-feat-dvd-mpeg4-filtering">
|
|
945 <title>Filtrování</title>
|
|
946
|
|
947 <para>
|
|
948 Obecně byste měli filtrovat video tak málo, jak je to jen možné, abyste
|
|
949 zůstali co nejblíž DVD originálu. Ořezání je často nutné (jak jsme již řekli),
|
|
950 ale neškálujte video. Ačkoli zmenšení rozlišení je občas upřednostňováno před
|
|
951 použitím vyšších kvantizerů, musíme se vyhnout oběma případům: pamatujme, že
|
|
952 jsme se již na začátku rozhodli obětovat bity za kvalitu.
|
|
953 </para>
|
|
954
|
|
955 <para>
|
|
956 Rovněž neupravujte gamu, kontrast, jas, atd. Co vypadá dobře na vaší
|
|
957 obrazovce, nemusí vypadat dobře na jiných. Tato přizpůsobení by měla být
|
|
958 prováděna pouze při přehrávání.
|
|
959 </para>
|
|
960
|
|
961 <para>
|
|
962 Jednu věc byste však udělat měli, a to protáhnout video velmi lehkým
|
|
963 odšumovací filtr, jako je <option>-vf hqdn3d=2:1:2</option>.
|
|
964 Opět je to proto, abychom mohli některé bity lépe využít: proč s nimi plýtvat
|
|
965 na šum, když si jej můžete přidat při přehrávání? Zvýšení parametrů pro
|
|
966 <option>hqdn3d</option> ještě více zvýší komprimovatelnost, ale pokud to
|
|
967 přeženete, riskujete zhoršení viditelnosti obrazu. Doporučené hodnoty okolo
|
|
968 (<option>2:1:2</option>) jsou dost konzervativní; měli byste volně
|
|
969 experimentovat s vyššími hodnotami a posoudit výsledek sami.
|
|
970 </para>
|
|
971
|
|
972 </sect2>
|
|
973
|
|
974 <sect2 id="menc-feat-dvd-mpeg4-lavc-encoding-options">
|
|
975 <title>Enkódovací volby libavcodecu</title>
|
|
976
|
|
977 <para>
|
|
978 V ideálním případě byste asi chtěli jen říct enkodéru, aby se přepnul do
|
|
979 režimu "vysoká kvalita" a šel na to.
|
|
980 To by bylo jistě hezké, ale naneštěstí je to těžké zavést, jelikož různé
|
|
981 volby enkódování vedou k různé kvalitě v závislosti na zdrojovém materiálu.
|
|
982 To proto, že komprese závisí na vizuálních vlastnostech daného videa.
|
|
983 Například anime a živá akce mají zcela rozdílné vlastnosti a tedy vyžadují
|
|
984 odlišné volby pro dosažení optimálního enkódování.
|
|
985 Dobrá zpráva je, že některé volby by nikdy neměly chybět, jako
|
|
986 <option>mbd=2</option>, <option>trell</option> a <option>v4mv</option>.
|
|
987 Podrobný popis obvyklých enkódovacích voleb naleznete níže.
|
|
988 </para>
|
|
989
|
|
990
|
|
991 <itemizedlist>
|
|
992 <title>Volby k nastavení:</title>
|
|
993 <listitem><para>
|
|
994 <emphasis role="bold">vmax_b_frames</emphasis>: 1 nebo 2 je v pořádku,
|
|
995 v závislosti na filmu.
|
|
996 Poznamenejme, že libavcodec zatím nepodporuje uzavřený GOP (volba
|
|
997 <option>cgop</option> zatím nepracuje), takže DivX5 nebude schopen dekódovat
|
|
998 nic enkódovaného s B-snímky.
|
|
999 </para></listitem>
|
|
1000
|
|
1001 <listitem><para>
|
|
1002 <emphasis role="bold">vb_strategy=1</emphasis>: pomáhá ve scénách s rychlým
|
|
1003 pohybem.
|
|
1004 Vyžaduje vmax_b_frames >= 2.
|
|
1005 V některých videích může vmax_b_frames snížit kvalitu, ale vmax_b_frames=2
|
|
1006 spolu s vb_strategy=1 pomůže.
|
|
1007 </para></listitem>
|
|
1008
|
|
1009 <listitem><para>
|
|
1010 <emphasis role="bold">dia</emphasis>: okruh vyhledávání pohybu. Čím větší, tím
|
|
1011 lepší a pomalejší.
|
|
1012 Záporné hodnoty mají úplně jiný význam.
|
|
1013 Dobrými hodnotami jsou -1 pro rychlé enkódování, nebo 2-4 pro pomalejší.
|
|
1014 </para></listitem>
|
|
1015
|
|
1016 <listitem><para>
|
|
1017 <emphasis role="bold">predia</emphasis>: předprůchod pro vyhledávání pohybu.
|
|
1018 Není tak důležitý jako dia. Dobré hodnoty jsou 1 (výchozí) až 4. Vyžaduje
|
|
1019 preme=2, aby byla opravdu k něčemu.
|
|
1020 </para></listitem>
|
|
1021
|
|
1022 <listitem><para>
|
|
1023 <emphasis role="bold">cmp, subcmp, precmp</emphasis>: Porovnávací funkce pro
|
|
1024 odhad pohybu.
|
|
1025 Experimentujte s hodnotami 0 (výchozí), 2 (hadamard), 3 (dct) a 6 (omezení
|
|
1026 datového toku).
|
|
1027 0 je nejrychlejší a dostatečná pro precmp.
|
|
1028 Pro cmp a subcmp je 2 dobrá pro anime a 3 zase pro živou akci.
|
|
1029 6 může, ale nemusí být o něco lepší, ale je pomalá.
|
|
1030 </para></listitem>
|
|
1031
|
|
1032 <listitem><para>
|
|
1033 <emphasis role="bold">last_pred</emphasis>: Počet prediktorů pohybu
|
|
1034 přebíraných z předchozího snímku.
|
|
1035 1-3 nebo tak pomůžou za cenu menšího zdržení.
|
|
1036 Vyšší hodnoty jsou však pomalé a nepřináší žádný další užitek.
|
|
1037 </para></listitem>
|
|
1038
|
|
1039 <listitem><para>
|
|
1040 <emphasis role="bold">cbp, mv0</emphasis>: Ovládá výběr makrobloků.
|
|
1041 Malá ztráta rychlosti za malý zisk kvality.
|
|
1042 </para></listitem>
|
|
1043
|
|
1044 <listitem><para>
|
|
1045 <emphasis role="bold">qprd</emphasis>: adaptivní kvantizace založená na
|
|
1046 komplexnosti makrobloku.
|
|
1047 Může pomoci i uškodit v závislosti na videu a ostatních volbách.
|
|
1048 Toto může způsobovat artefakty, pokud nenastavíte vqmax na nějakou rozumně
|
|
1049 malou hodnotu (6 je dobrá, možná byste ale měli jít až na 4); vqmin=1 může
|
|
1050 také pomoci.
|
|
1051 </para></listitem>
|
|
1052
|
|
1053 <listitem><para>
|
|
1054 <emphasis role="bold">qns</emphasis>: velmi pomalá, zvlášť v kombinaci
|
|
1055 s qprd.
|
|
1056 Tato volba nutí enkodér minimalizovat šum díky kompresi artefaktů, místo aby
|
|
1057 se snažil striktně zachovávat věrnost videa. Nepoužívejte ji, pokud jste již
|
|
1058 nezkusili všechno ostatní kam až to šlo a výsledek přesto není dost dobrý.
|
|
1059 </para></listitem>
|
|
1060
|
|
1061 <listitem><para>
|
|
1062 <emphasis role="bold">vqcomp</emphasis>: Vylepšení ovládání datového toku.
|
|
1063 Dobré hodnoty se liší podle videa. Můžete to bezpečně ponechat jak to je,
|
|
1064 pokud chcete.
|
|
1065 Snížením vqcomp pustíte více bitů do scén s nízkou komplexností, zvýšením je
|
|
1066 pošlete do scén s vysokou komplexností (výchozí: 0.5, rozsah: 0-1. doporučený
|
|
1067 rozsah: 0.5-0.7).
|
|
1068 </para></listitem>
|
|
1069
|
|
1070 <listitem><para>
|
|
1071 <emphasis role="bold">vlelim, vcelim</emphasis>: Nastaví jediný koeficient
|
|
1072 prahu eliminace pro jasové a barevné roviny.
|
|
1073 Ty jsou enkódovány odděleně ve všech MPEGu podobných algoritmech.
|
|
1074 Myšlenka stojící za těmito volbami je použití dobré heuristiky pro určení,
|
|
1075 zda je změna v bloku menší než vámi nastavený práh a v tom případě se blok
|
|
1076 enkóduje jako "nezměněný".
|
|
1077 To šetří bity a možná i zrychlí enkódování. vlelim=-4 a vcelim=9 se zdají být
|
|
1078 dobré pro hrané filmy, ale příliš nepomohou s anime; pokud enkódujete anime,
|
|
1079 měli byste je asi nechat beze změn.
|
|
1080 </para></listitem>
|
|
1081
|
|
1082 <listitem><para>
|
|
1083 <emphasis role="bold">qpel</emphasis>: Odhad pohybu s přesností na čtvrt
|
|
1084 pixelu. MPEG-4 používá přesnost na půl pixelu jako výchozí při vyhledávání
|
|
1085 pohybu, proto je tato volba spojena s určitou režií, jelikož se do výstupního
|
|
1086 souboru ukládá více informací.
|
|
1087 Kompresní zisk/ztráta závisí na filmu, ale obvykle to není příliš efektivní
|
|
1088 na anime.
|
|
1089 qpel vždy způsobí zvýšení výpočetní náročnosti dekódování (v praxi +20% času
|
|
1090 CPU).
|
|
1091 </para></listitem>
|
|
1092
|
|
1093 <listitem><para>
|
|
1094 <emphasis role="bold">psnr</emphasis>: neovlivní aktuální enkódování, ale
|
|
1095 zaznamená typ/velikost/kvalitu každého snímku do log souboru a na konci vypíše
|
|
1096 souhrnný PSNR (odstup signálu od šumu).
|
|
1097 </para></listitem>
|
|
1098
|
|
1099 </itemizedlist>
|
|
1100
|
|
1101 <itemizedlist>
|
|
1102 <title>Volby se kterými nedoporučujeme si hrát:</title>
|
|
1103 <listitem><para>
|
|
1104 <emphasis role="bold">vme</emphasis>: Výchozí je nejlepší.
|
|
1105 </para></listitem>
|
|
1106
|
|
1107 <listitem><para>
|
|
1108 <emphasis role="bold">lumi_mask, dark_mask</emphasis>: Psychovizuálně
|
|
1109 adaptivní kvantizace.
|
|
1110 Nehrajte si s těmito volbami, pokud vám jde o kvalitu. Rozumné hodnoty mohou
|
|
1111 být efektivní ve vašem případě, ale pozor, je to velmi subjektivní.
|
|
1112 </para></listitem>
|
|
1113
|
|
1114 <listitem><para>
|
|
1115 <emphasis role="bold">scplx_mask</emphasis>: Snaží se předcházet blokovým
|
|
1116 artefaktům, ale postprocesing je lepší.
|
|
1117 </para></listitem>
|
|
1118 </itemizedlist>
|
|
1119
|
|
1120 </sect2>
|
|
1121
|
|
1122 <sect2 id="menc-feat-dvd-mpeg4-example">
|
|
1123 <title>Příklad</title>
|
|
1124
|
|
1125 <para>
|
|
1126 Takže jste si koupili zbrusu novou kopii filmu Harry Potter a Tajemná komnata
|
|
1127 (širokoúhlou verzi samozřejmě) a chcete si toto DVD ripnout, takže si jej
|
|
1128 můžete přidat do svého Domácího kino-počítače PC. Je to region 1 DVD, takže je
|
|
1129 v NTSC. Níže uvedený příklad je stále vhodný i pro PAL, jen musíte vynechat
|
|
1130 <option>-ofps 24000/1001</option> (protože výstupní snímková rychlost je
|
|
1131 shodná se vstupní) a přirozeně budou rozdílné souřadnice pro ořez.
|
|
1132 </para>
|
|
1133
|
|
1134 <para>
|
|
1135 Po spuštění <option>mplayer dvd://1</option>, postupujeme podle informací
|
|
1136 obsažených v sekci <link linkend="menc-feat-telecine">Jak naložit s telecine
|
|
1137 a prokladem v NTSC DVD</link> a zjistíme že je to 24000/1001 neprokládané
|
|
1138 video, takže nepotřebujeme použít inverzní telecine filtr, jako je
|
|
1139 <option>pullup</option> nebo <option>filmdint</option>.
|
|
1140 </para>
|
|
1141
|
|
1142 <para>
|
|
1143 Dále musíme zjistit vhodný ořezový obdélník, takže použijeme filtr cropdetect:
|
|
1144
|
|
1145 <screen>mplayer dvd://1 -vf cropdetect</screen>
|
|
1146
|
|
1147 Ujistěte se, že jste přešli přes zaplněný snímek (nějakou jasnou scénu) a
|
|
1148 v konzoli <application>MPlayer</application>u uvidíte:
|
|
1149
|
|
1150 <screen>crop area: X: 0..719 Y: 57..419 (-vf crop=720:362:0:58)</screen>
|
|
1151
|
|
1152 Potom přehrajeme film s tímto filtrem, abychom otestovali jeho správnost:
|
|
1153
|
|
1154 <screen>mplayer dvd://1 -vf crop=720:362:0:58</screen>
|
|
1155
|
|
1156 A zjistíme, že to vypadá zcela v pořádku. Dále se ujistíme, že šířka i výška
|
|
1157 jsou násobky 16. Šířka je v pořádku, výška ovšem ne. Protože jsme nepropadli
|
|
1158 v sedmé třídě z matematiky, víme, že nejbližším násobkem 16 nižším než 362 je
|
|
1159 352.
|
|
1160 </para>
|
|
1161
|
|
1162 <para>
|
|
1163 Mohli bychom použít <option>crop=720:352:0:58</option>, ale bude lepší
|
|
1164 ustřihnout kousek nahoře i dole, takže zachováme střed. Zkrátili jsme výšku
|
|
1165 o 10 pixelů, ale nechceme zvýšit odsazení y o 5 pixelů, protože je to liché
|
|
1166 číslo, což by nepříznivě ovlivnilo kvalitu. Místo toho zvýšíme odsazení y o 4
|
|
1167 pixely:
|
|
1168
|
|
1169 <screen>mplayer dvd://1 -vf crop=720:352:0:62</screen>
|
|
1170
|
|
1171 Další důvod pro odstřižení pixelů shora i zdola je to, že si můžeme být jisti
|
|
1172 odstřižením napůl černých pixelů pokud existují. Pokud je však vaše video
|
|
1173 telecinováno, ujistěte se, že máte v řetězu filtrů <option>pullup</option>
|
|
1174 filtr (nebo jiný filtr pro inverzi telecine, který hodláte použít) ještě před
|
|
1175 odstraněním prokladu a ořezem. (Pokud se rozhodnete zachovat vaše video
|
|
1176 prokládané, pak se ujistěte, že vaše vertikální odsazení (offset)
|
|
1177 je násobkem 4.)
|
|
1178 </para>
|
|
1179
|
|
1180 <para>
|
|
1181 Pokud si děláte starosti se ztrátou těch 10 pixelů, možná raději snížíte
|
|
1182 rozměry na nejbližší násobek 16. Řetězec filtrů by pak vypadal asi takto:
|
|
1183
|
|
1184 <screen>-vf crop=720:362:0:58,scale=720:352</screen>
|
|
1185
|
|
1186 Takovéto zmenšení videa bude znamenat ztrátu malého množství detailů, což bude
|
|
1187 pravděpodobně stěží postřehnutelné. Zvětšování by naopak vedlo ke snížení
|
|
1188 kvality (pokud byste nezvýšili datový tok). Ořez odstraní tyto pixely úplně.
|
|
1189 To je jedna z věcí, kterou byste si měli uvážit pro každý případ zvlášť.
|
|
1190 Například pokud bylo DVD video vyrobeno pro televizi, měli byste se vyvarovat
|
|
1191 vertikálnímu škálování, jelikož počet řádků odpovídá originální nahrávce.
|
|
1192 </para>
|
|
1193
|
|
1194 <para>
|
|
1195 Při prohlídce jsme zjistili, že video je poměrně akční, s vysokým počtem
|
|
1196 detailů, takže jsme zvolili datový tok 2400 Kbitů.
|
|
1197 </para>
|
|
1198
|
|
1199 <para>
|
|
1200 Nyní jsme připraveni provést dvouprůchodové enkódování. Průchod jedna:
|
|
1201
|
|
1202 <screen>mencoder dvd://1 -ofps 24000/1001 -oac copy -vf crop=720:352:0:62,hqdn3d=2:1:2 -ovc lavc \
|
|
1203 -lavcopts vcodec=mpeg4:vbitrate=2400:v4mv:mbd=2:trell:cmp=3:subcmp=3:mbcmp=3:autoaspect:vpass=1 \
|
|
1204 -o Harry_Potter_2.avi</screen>
|
|
1205
|
|
1206 A průchod dva je stejný, jen nastavíme <option>vpass=2</option>:
|
|
1207
|
|
1208 <screen>mencoder dvd://1 -ofps 24000/1001 -oac copy -vf crop=720:352:0:62,hqdn3d=2:1:2 -ovc lavc \
|
|
1209 -lavcopts vcodec=mpeg4:vbitrate=2400:v4mv:mbd=2:trell:cmp=3:subcmp=3:mbcmp=3:autoaspect:vpass=2 \
|
|
1210 -o Harry_Potter_2.avi</screen>
|
|
1211 </para>
|
|
1212
|
|
1213 <para>
|
|
1214 Volby <option>v4mv:mbd=2:trell</option> velmi zvýší kvalitu za cenu časové
|
|
1215 náročnosti enkódování. Vcelku není důvod tuto volbu vypustit, pokud je
|
|
1216 primárním cílem kvalita. Volby <option>cmp=3:subcmp=3:mbcmp=3</option>
|
|
1217 vyberou porovnávací funkci, která poskytuje lepší kvalitu, než výchozí.
|
|
1218 S tímto parametrem můžete zkusit experimentovat (nahlédněte do man stránky pro
|
|
1219 seznam možných hodnot), jelikož různé funkce mohou mít velký vliv na kvalitu
|
|
1220 v závislosti na zdrojovém materiálu. Například pokud zjistíte, že
|
|
1221 <systemitem class="library">libavcodec</systemitem> produkuje příliš mnoho
|
|
1222 čtverečkových artefaktů, můžete zkusit zvolit experimentální NSSE jako
|
|
1223 porovnávací funkci přes <option>*cmp=10</option>.
|
|
1224 </para>
|
|
1225
|
|
1226 <para>
|
|
1227 V případě tohoto filmu bude výsledné AVI dlouhé 138 minut a veliké kolem 3GB.
|
|
1228 A protože jste řekli, že na velikosti nezáleží, je to přijatelná velikost.
|
|
1229 Ale pokud byste jej chtěli menší, můžete zkusit nižší datový tok.
|
|
1230 Efekt zvyšování datového toku se totiž neustále snižuje, takže zatímco je
|
|
1231 zlepšení po zvýšení z 1800 Kbitů na 2000 Kbitů zjevné, nemusí být již tak
|
|
1232 velké nad 2000 Kbitů. Beze všeho s tím experimentujte, dokud nebudete
|
|
1233 spokojeni.
|
|
1234 </para>
|
|
1235
|
|
1236 <para>
|
|
1237 Jelikož jsme protáhli video odšumovacím filtrem, měli bychom jej trochu přidat
|
|
1238 během přehrávání. To, spolu s <option>spp</option> post-procesním filtrem,
|
|
1239 znatelně zvýší vnímanou kvalitu a pomůže odstranit čtverečkové artefakty ve
|
|
1240 videu. S <application>MPlayer</application>ovou volbou <option>autoq</option>
|
|
1241 může být množství postprocesingu prováděného filtrem spp přizpůsobováno
|
|
1242 vytížení CPU. V tuto chvíli rovněž můžete provést korekci gama a/nebo barevnou
|
|
1243 korekci k dosažení nejlepších výsledků. Například:
|
|
1244
|
|
1245 <screen>mplayer Harry_Potter_2.avi -vf spp,noise=9ah:5ah,eq2=1.2 -autoq 3</screen>
|
|
1246
|
|
1247 </para>
|
|
1248 </sect2>
|
|
1249
|
|
1250 <sect2 id="menc-feat-dvd-mpeg4-muxing">
|
|
1251 <title>Muxování (multiplexování)</title>
|
|
1252 <para>
|
|
1253 Nyní, když máte své video enkódované, budete jej nejspíš chtít muxovat
|
|
1254 s jedním nebo více zvukovými stopami do nosného filmového formátu, jako je
|
|
1255 AVI, MPEG, Matroska nebo NUT.
|
|
1256 <application>MEncoder</application> je zatím schopen zvuk a video zapracovat
|
|
1257 pouze do nosných formátů MPEG a AVI.
|
|
1258 Například:
|
|
1259 <screen>mencoder -oac copy -ovc copy -o <replaceable>výstupní_film.avi</replaceable> -audiofile <replaceable>vstupní_audio.mp2</replaceable> <replaceable>vstupní_video.avi</replaceable></screen>
|
|
1260 To by mělo sloučit video soubor <replaceable>vstupní_video.avi</replaceable>
|
|
1261 a zvukový soubor <replaceable>vstupní_audio.mp2</replaceable>
|
|
1262 do AVI souboru <replaceable>výstupní_film.avi</replaceable>.
|
|
1263 Tento příkaz pracuje s MPEG-1 layer I, II a III (známým jako MP3) zvukem,
|
|
1264 WAV a také několika dalšími formáty zvuku.
|
|
1265 </para>
|
|
1266
|
|
1267 <para>
|
|
1268 <application>MEncoder</application> obsahuje experimentální podporu pro
|
|
1269 <systemitem class="library">libavformat</systemitem>, což je knihovna
|
|
1270 z projektu FFmpeg, která podporuje muxování a demuxování celé řady nosných
|
|
1271 formátů.
|
|
1272 Například:
|
|
1273 <screen>mencoder -oac copy -ovc copy -o <replaceable>výstupní_film.asf</replaceable> -audiofile <replaceable>vstupní_audio.mp2</replaceable> <replaceable>vstupní_video.avi</replaceable> -of lavf -lavfopts format=asf</screen>
|
|
1274 To provede stejnou činnost jako předchozí příklad, avšak výstupním formátem
|
|
1275 bude ASF.
|
|
1276 Prosím berte na vědomí, že tato podpora je velmi experimentální (ale de ode
|
|
1277 dne lepší) a bude funkční pouze pokud jste zkompilovali
|
|
1278 <application>MPlayer</application> s podporou pro
|
|
1279 <systemitem class="library">libavformat</systemitem> (což znamená, že
|
|
1280 předkompilovaná binární verze nebude většinou fungovat).
|
|
1281 </para>
|
|
1282
|
|
1283 <sect3 id="menc-feat-dvd-mpeg4-muxing-avi-limitations">
|
|
1284 <title>Limitace nosného formátu AVI</title>
|
|
1285 <para>
|
|
1286 Ačkoli je to po MPEG-1 nejpodporovanější nosný formát, má AVI i jisté
|
|
1287 zásadní nedostatky. Snad nejviditelnější je režie.
|
|
1288 Na každý chunk AVI souboru je 24 bajtů ztraceno na hlavičky a index.
|
|
1289 To se projeví asi 5 MP na hodinu, neboli 1-2.5% prodloužení 700 MB filmu.
|
|
1290 Nevypadá to jako mnoho, ale může to znamenat rozdíl mezi možností použít
|
|
1291 video při 700 kbitech/s nebo 714 kbitech/s a tady se každý bit projeví na
|
|
1292 kvalitě.
|
|
1293 </para>
|
|
1294
|
|
1295 <para>
|
|
1296 Navíc k této neefektivitě má AVI také následující hlavní omezení:
|
|
1297 </para>
|
|
1298
|
|
1299 <orderedlist>
|
|
1300 <listitem>
|
|
1301 <para>
|
|
1302 Může být uchováván pouze obsah s konstantní snímkovou rychlostí. To je
|
|
1303 zvláště omezující, když má původní materiál, který chcete enkódovat, smíšený
|
|
1304 obsah. Například směs NTSC videa a filmového materiálu.
|
|
1305 Jistěže jsou zde cestičky, které umožní uložit obsah se smíšenou snímkovou
|
|
1306 rychlostí v AVI, ale ty zvyšují (již tak velkou) režii pětinásobně nebo víc,
|
|
1307 proto nejsou praktické.
|
|
1308 </para>
|
|
1309 </listitem>
|
|
1310 <listitem>
|
|
1311 <para>
|
|
1312 Zvuk v AVI musí mít buď konstantní datový tok (CBR) nebo konstantní velikost
|
|
1313 rámce (čili všechny rámce se dekódují na stejný počet vzorků).
|
|
1314 Naneštěstí ten nejefektivnější kodek, Vorbis, nesplňuje ani jeden z těchto
|
|
1315 požadavků.
|
|
1316 Pokud tedy plánujete uložit svůj film do AVI, budete muset použít méně
|
|
1317 efektivní kodek, jako MP3 nebo AC3.
|
|
1318 </para>
|
|
1319 </listitem>
|
|
1320 </orderedlist>
|
|
1321
|
|
1322 <para>
|
|
1323 Z výše uvedených důvodů <application>MEncoder</application> zatím
|
|
1324 nepodporuje proměnnou snímkovou rychlost ani enkódování do Vorbisu.
|
|
1325 Nemusíte to však považovat za omezení, jestliže je
|
|
1326 <application>MEncoder</application> jediným nástrojem pro vaše
|
|
1327 enkódování. Nakonec je možné použít <application>MEncoder</application> pouze
|
|
1328 pro enkódování videa a pak použít externí nástroje pro enkódování zvuku a
|
|
1329 namuxování do jiného nosného formátu.
|
|
1330 </para>
|
|
1331 </sect3>
|
|
1332
|
|
1333 <sect3 id="menc-feat-dvd-mpeg4-muxing-matroska">
|
|
1334 <title>Muxování do nosného formátu Matroska</title>
|
|
1335 <para>
|
|
1336 Matroska je svobodný a otevřený standard nosného formátu, zaměřený na
|
|
1337 nabídku mnoha pokročilých vlastností, které starší nosné formáty, jako AVI,
|
|
1338 nemohou poskytnout.
|
|
1339 Například Matroska podporuje zvuk s proměnným datovým tokem (VBR),
|
|
1340 proměnné snímkové rychlosti (VFR), kapitoly, přílohy souborů, kód pro
|
|
1341 detekci chyb (EDC) a moderní A/V kodeky jako "Advanced Audio
|
|
1342 Coding" (AAC), "Vorbis" nebo "MPEG-4 AVC" (H.264), z nichž žádný nelze
|
|
1343 použít v AVI.
|
|
1344 </para>
|
|
1345
|
|
1346 <para>
|
|
1347 Nástroje pro vytváření Matroska souborů jsou souhrnně nazvány
|
|
1348 <application>mkvtoolnix</application> a jsou dostupné pro většinu Unixových
|
|
1349 platforem a stejně tak <application>Windows</application>.
|
|
1350 Protože je Matroska otevřený standard, můžete najít jiné nástroje, které vám
|
|
1351 lépe padnou, ale protože mkvtoolnix je nejrozšířenější a je podporován
|
|
1352 přímo Matroska týmem, pokryjeme jen jejich použití.
|
|
1353 </para>
|
|
1354
|
|
1355 <para>
|
|
1356 Asi nejsnazší způsob, jak začít s Matroskou je použít
|
|
1357 <application>MMG</application>, grafickou nadstavbu dodávanou s
|
|
1358 <application>mkvtoolnix</application> a řídit se
|
|
1359 <ulink url="http://www.bunkus.org/videotools/mkvtoolnix/doc/mkvmerge-gui.html">návodem k mkvmerge GUI (mmg)</ulink>
|
|
1360 </para>
|
|
1361
|
|
1362 <para>
|
|
1363 Můžete rovněž muxovat zvukové a video soubory z příkazového řádku:
|
|
1364 <screen>mkvmerge -o <replaceable>výstup.mkv</replaceable> <replaceable>vstupní_video.avi</replaceable> <replaceable>vstupní_audio1.mp3</replaceable> <replaceable>vstupní_audio2.ac3</replaceable></screen>
|
|
1365 To spojí video soubor <replaceable>vstupní_video.avi</replaceable>
|
|
1366 a dva zvukové soubory <replaceable>vstupní_audio1.mp3</replaceable>
|
|
1367 a <replaceable>vstupní_audio2.ac3</replaceable> do Matroska souboru
|
|
1368 <replaceable>výstup.mkv</replaceable>.
|
|
1369 Matroska, jak jsme již řekli, umí mnohem víc než to, jako více zvukových stop
|
|
1370 (včetně doladění audio/video synchronizace), kapitoly, titulky, stříhání,
|
|
1371 atd...
|
|
1372 Detaily naleznete v dokumentaci k těmto aplikacím.
|
|
1373 </para>
|
|
1374
|
|
1375 </sect3>
|
|
1376
|
|
1377 </sect2>
|
|
1378
|
|
1379 </sect1>
|
|
1380
|
|
1381 <sect1 id="menc-feat-telecine">
|
|
1382 <title>Jak naložit s telecine a prokladem v NTSC DVD</title>
|
|
1383
|
|
1384 <sect2 id="menc-feat-telecine-intro">
|
|
1385 <title>Představení</title>
|
|
1386 <formalpara>
|
|
1387 <title>Co je to telecine?</title>
|
|
1388 <para>
|
|
1389 Pokud moc nerozumíte tomu, co je napsáno v tomto dokumentu, doporučujeme
|
|
1390 navštívit tuto stránku:
|
|
1391 <ulink url="http://www.divx.com/support/guides/guide.php?gid=10">http://www.divx.com/support/guides/guide.php?gid=10</ulink>
|
|
1392 Na této adrese je srozumitelný a rozumně vyčerpávající popis co je to
|
|
1393 telecine.
|
|
1394 </para></formalpara>
|
|
1395
|
|
1396 <formalpara>
|
|
1397 <title>Poznámka k číslům.</title>
|
|
1398 <para>
|
|
1399 Mnoho dokumentů, včetně výše odkazované příručky, udává hodnotu půlsnímků za
|
|
1400 sekundu NTSC videa jako 59.94 a odpovídající snímky za sekundu jako 29.97
|
|
1401 (pro telecinované a prokládané video) a 23.976 (pro neprokládané).
|
|
1402 Pro jednoduchost některé dokumenty zaokrouhlují tyto hodnoty na 60, 30 a 24.
|
|
1403 </para></formalpara>
|
|
1404
|
|
1405 <para>
|
|
1406 Přesně řečeno jsou všechny tyto čísla přibližná. Černobílé NTSC video mělo
|
|
1407 přesně 60 půlsnímků za sekundu, ale později byla zvolena hodnota 60000/1001,
|
|
1408 aby bylo možné přidat barevná data a zůstat kompatibilní se starými
|
|
1409 černobílými televizemi. Digitální NTSC (jak je na DVD) má rovněž rychlost
|
|
1410 60000/1001 půlsnímků za sekundu. Z toho vyplývá, že prokládané a telecinované
|
|
1411 video má 30000/1001 snímků za sekundu; neprokládané video má 24000/1001 snímků
|
|
1412 za sekundu.
|
|
1413 </para>
|
|
1414
|
|
1415 <para>
|
|
1416 Starší verze dokumentace <application>MEncoder</application>u a mnoho zpráv
|
|
1417 v archivu konference hovoří o 59.94, 29.97 a 23.976.
|
|
1418 Všechna dokumentace <application>MEncoder</application>u byla aktualizována
|
|
1419 a používá zlomkových hodnot. Vy byste je měli používat také.
|
|
1420 </para>
|
|
1421
|
|
1422 <para>
|
|
1423 <option>-ofps 23.976</option> je nesprávně.
|
|
1424 Místo toho byste měli použít <option>-ofps 24000/1001</option>.
|
|
1425 </para>
|
|
1426
|
|
1427 <formalpara>
|
|
1428 <title>Jak je používáno telecine.</title>
|
|
1429 <para>
|
|
1430 Veškeré video určené k zobrazení na NTSC televizi musí mít 60000/1001
|
|
1431 půlsnímků za sekundu. Filmy vyráběné pro televizi jsou často natáčeny přímo
|
|
1432 ve 60000/1001 půlsnímcích za sekundu, ale většina filmů do kin je natáčena při
|
|
1433 24 nebo 24000/1001 snímcích za sekundu. Když je film přepisován na DVD, je
|
|
1434 video upraveno pro televizi v procesu zvaném telecine.
|
|
1435 </para></formalpara>
|
|
1436
|
|
1437 <para>
|
|
1438 Na DVD není video ve skutečnosti nikdy uloženo v 60000/1001 půlsnímcích za
|
|
1439 sekundu. Video jež bylo původně 60000/1001, bude mít každý pár půlsnímků
|
|
1440 zkombinován do podoby snímku s rychlostí 30000/1001 snímků za sekundu.
|
|
1441 Hardwarové DVD přehrávače pak čtou příznak, zabudovaný ve video proudu, který
|
|
1442 udává jestli první půlsnímek tvoří liché nebo sudé řádky.
|
|
1443 </para>
|
|
1444
|
|
1445 <para>
|
|
1446 Obsah ve 24000/1001 snímcích za sekundu obvykle zůstává tak jak byl v době
|
|
1447 přepisu na DVD a DVD přehrávač musí provést telecine za letu. Někdy je však
|
|
1448 video telecinováno <emphasis>před</emphasis> uložením na DVD; dokonce i když
|
|
1449 mělo původně 24000/1001 snímků za sekundu, bude mít 60000/1001 půlsnímků za
|
|
1450 sekundu. Pokud je uložen na DVD, páry půlsnímků jsou zkombinovány do formy
|
|
1451 30000/1001 snímků za sekundu.
|
|
1452 </para>
|
|
1453
|
|
1454 <para>
|
|
1455 Když se podíváme na jednotlivé snímky vzniklé z videa o 60000/10001 půlsnímcích
|
|
1456 za sekundu, telecinovaného nebo ne, je zřetelně vidět toto prokládání jakmile
|
|
1457 je zde nějaký pohyb, jelikož jeden půlsnímek (řekněme liché řádky)
|
|
1458 reprezentuje časový okamžik o 1/(60000/1001) sekundy pozdější než ten druhý.
|
|
1459 Přehrávání prokládaného videa na počítači vypadá škaredě jak proto, že monitor
|
|
1460 má vyšší rozlišení, ale i protože video je zobrazováno snímek po snímku místo
|
|
1461 půlsnímek po půlsnímku.
|
|
1462 </para>
|
|
1463
|
|
1464 <itemizedlist>
|
|
1465 <title>Poznámky:</title>
|
|
1466 <listitem><para>
|
|
1467 Tento odstavec platí pouze pro NTSC DVD, nikoli PAL.
|
|
1468 </para></listitem>
|
|
1469 <listitem><para>
|
|
1470 Řádky s příklady spuštění <application>MEncoder</application>u v dokumentu
|
|
1471 <emphasis role="bold">nejsou</emphasis> určeny pro opravdové použití.
|
|
1472 Obsahují pouze nutné minimum vyžadované pro enkódování příslušné ke kategorii
|
|
1473 videa. Jak dělat dobré DVD ripy nebo doladit
|
|
1474 <systemitem class="library">libavcodec</systemitem> pro maximální kvalitu
|
|
1475 není v záběru tohoto dokumentu.
|
|
1476 </para></listitem>
|
|
1477 <listitem><para>
|
|
1478 Poznámky pod čarou příslušné pro tuto příručku jsou linkovány takto:
|
|
1479 <link linkend="menc-feat-telecine-footnotes">[1]</link>
|
|
1480 </para></listitem>
|
|
1481 </itemizedlist>
|
|
1482 </sect2>
|
|
1483
|
|
1484 <sect2 id="menc-feat-telecine-ident">
|
|
1485 <title>Jak zjistit o jaký typ videa se jedná</title>
|
|
1486
|
|
1487 <sect3 id="menc-feat-telecine-ident-progressive">
|
|
1488 <title>Progresivní (neprokládané)</title>
|
|
1489 <para>
|
|
1490 Progresivní video je původně natočeno při 24000/1001 snímcích za sekundu a
|
|
1491 uloženo na DVD beze změn.
|
|
1492 </para>
|
|
1493
|
|
1494 <para>
|
|
1495 Když přehrajete progresivní DVD v <application>MPlayer</application>u,
|
|
1496 <application>MPlayer</application> vypíše následující řádek jakmile začne
|
|
1497 přehrávat:
|
|
1498
|
|
1499 <screen> demux_mpg: 24000/1001 fps progressive NTSC content detected, switching framerate.</screen>
|
|
1500
|
|
1501 Od tohoto okamžiku by demux_mpg neměl nikdy říct že našel
|
|
1502 "30000/1001 fps NTSC obsah."
|
|
1503 </para>
|
|
1504
|
|
1505 <para>
|
|
1506 Když sledujete progresivní video, neměli byste nikdy vidět žádný proklad.
|
|
1507 Dejte si ale pozor, jelikož je občas trošku telecine namixováno tam, kde byste
|
|
1508 to vůbec nečekali. Setkal jsem se s TV show na DVD, které měly sekundu
|
|
1509 telecine při každé změně scény nebo na zcela náhodných místech. Jednou jsem se
|
|
1510 díval na DVD, které bylo do půlky progresivní a od půlky telecinováno. Pokud
|
|
1511 chcete být <emphasis>opravdu</emphasis> důkladní, můžete oskenovat celý film:
|
|
1512
|
|
1513 <screen>mplayer dvd://1 -nosound -vo null -benchmark</screen>
|
|
1514
|
|
1515 Použití volby <option>-benchmark</option> nechá
|
|
1516 <application>MPlayer</application> přehrát film tak rychle, jak je to jen
|
|
1517 možné; stejně to ale, v závislosti na vašem stroji, chvíli potrvá.
|
|
1518 Vždy, když demux_mpg ohlásí změnu snímkové rychlosti, řádek těsně nad hlášením
|
|
1519 ukáže čas ve kterém ke změně došlo.
|
|
1520 </para>
|
|
1521
|
|
1522 <para>
|
|
1523 Občas je progresivní video na DVD označeno jako
|
|
1524 "soft-telecine" protože je zamýšleno, aby telecine provedl DVD
|
|
1525 přehrávač.
|
|
1526 </para>
|
|
1527 </sect3>
|
|
1528
|
|
1529 <sect3 id="menc-feat-telecine-ident-telecined">
|
|
1530 <title>Telecinováno (přepsáno pro NTSC televizi)</title>
|
|
1531 <para>
|
|
1532 Telecinované video bylo původně natočeno při 24000/1001, ale bylo telecinováno
|
|
1533 <emphasis>před</emphasis> zápisem na DVD.
|
|
1534 </para>
|
|
1535
|
|
1536 <para>
|
|
1537 <application>MPlayer</application> (nikdy) nehlásí žádnou změnu snímkové
|
|
1538 rychlosti, když přehrává telecinované video.
|
|
1539 </para>
|
|
1540
|
|
1541 <para>
|
|
1542 Při sledování telecinovaného videa uvidíte prokladové artefakty, které jako by
|
|
1543 "blikaly": opakovaně mizí a objevují se.
|
|
1544 Blíže se na to můžete podívat:
|
|
1545 <orderedlist>
|
|
1546 <listitem>
|
|
1547 <screen>mplayer dvd://1</screen>
|
|
1548 </listitem>
|
|
1549 <listitem><para>
|
|
1550 Převiňte na část s pohybem.
|
|
1551 </para></listitem>
|
|
1552 <listitem><para>
|
|
1553 Použijte klávesu <keycap>.</keycap> pro krokování po jednom snímku.
|
|
1554 </para></listitem>
|
|
1555 <listitem><para>
|
|
1556 Sledujte vzor prokládaně vypadajících a progresivně vypadajících snímků.
|
|
1557 Pokud je vzor, který sledujete PPPII,PPPII,PPPII,..., pak je video
|
|
1558 telecinováno. Pokud vidíte jiný vzor, pak mohlo být video telecinováno
|
|
1559 použitím nějaké nestandardní metody; <application>MEncoder</application>
|
|
1560 neumí bezztrátově převést nestandardní telecine do progresivního. Pokud
|
|
1561 nevidíte žádný vzor, pak je video nejspíš prokládané.
|
|
1562 </para></listitem>
|
|
1563 </orderedlist>
|
|
1564 </para>
|
|
1565
|
|
1566 <para>
|
|
1567 Někdy je telecinované video na DVD označeno jako "hard-telecine".
|
|
1568 Jelikož hard-telecine již je ve 60000/1001 půlsnímcích za sekundu, DVD
|
|
1569 přehrávač přehraje video bez jakýchkoli manipulací.
|
|
1570 </para>
|
|
1571 </sect3>
|
|
1572
|
|
1573 <sect3 id="menc-feat-telecine-ident-interlaced">
|
|
1574 <title>Prokládané</title>
|
|
1575 <para>
|
|
1576 Prokládané video bylo od samého začátku filmováno při 60000/1001 půlsnímcích
|
|
1577 za sekundu a uloženo na DVD ve 30000/1001 snímcích za sekundu. Efekt
|
|
1578 prokládání (často označovaný jako "roztřepení") je výsledkem
|
|
1579 skládání půlsnímků do snímků. Vzdálenost mezi půlsnímky má být 1/(60000/1001)
|
|
1580 sekundy a proto když jsou zobrazeny současně, je rozdíl jasně patrný.
|
|
1581 </para>
|
|
1582
|
|
1583 <para>
|
|
1584 Stejně jako u telecinovaného videa by <application>MPlayer</application> neměl
|
|
1585 hlásit jakékoli změny snímkové rychlosti při přehrávání prokládaného obsahu.
|
|
1586 </para>
|
|
1587
|
|
1588 <para>
|
|
1589 Když si prohlédnete video blíže pomocí krokování snímků pomocí klávesy
|
|
1590 <keycap>.</keycap>, uvidíte, že každý jednotlivý snímek je prokládaný.
|
|
1591 </para>
|
|
1592 </sect3>
|
|
1593
|
|
1594 <sect3 id="menc-feat-telecine-ident-mixedpt">
|
|
1595 <title>Smíšené progresivní a telecinované</title>
|
|
1596 <para>
|
|
1597 Veškerý obsah "smíšeného progresivního a telecinovaného" videa měl
|
|
1598 původně 24000/1001 snímků za sekundu, ale některé části prošly telecine.
|
|
1599 </para>
|
|
1600
|
|
1601 <para>
|
|
1602 Když <application>MPlayer</application> přehrává tuto kategorii, bude (často
|
|
1603 i opakovaně) přepínat mezi "30000/1001 snímky/s NTSC"
|
|
1604 a "24000/1001 snímky/s progresivním NTSC". Sledujte spodek
|
|
1605 <application>MPlayer</application>ova výstupu, abyste zachytili tyto zprávy.
|
|
1606 </para>
|
|
1607
|
|
1608 <para>
|
|
1609 Měli byste prověřit části se "30000/1001 snímky/s NTSC", abyste měli
|
|
1610 jistotu, že jsou skutečně telecinovány a ne jen prokládané.
|
|
1611 </para>
|
|
1612 </sect3>
|
|
1613
|
|
1614 <sect3 id="menc-feat-telecine-ident-mixedpi">
|
|
1615 <title>Smíšené progresivní a prokládané</title>
|
|
1616 <para>
|
|
1617 Ve "smíšeném progresivním a prokládaném" obsahu bylo progresivní a
|
|
1618 prokládané video splácáno dohromady.
|
|
1619 </para>
|
|
1620
|
|
1621 <para>
|
|
1622 Tato kategorie vypadá jako "smíšené progresivní a telecine",
|
|
1623 dokud si neprohlédnete části se 30000/1001 snímky/s a neuvidíte, že nemají
|
|
1624 telecine vzor.
|
|
1625 </para>
|
|
1626 </sect3>
|
|
1627
|
|
1628 </sect2>
|
|
1629
|
|
1630 <sect2 id="menc-feat-telecine-encode">
|
|
1631 <title>Jak enkódovat jednotlivé kategorie</title>
|
|
1632 <para>
|
|
1633 Jak jsem se zmínil na začátku, příklady příkazových řádků
|
|
1634 <application>MEncoder</application>u níže <emphasis role="bold">nejsou</emphasis>
|
|
1635 určeny pro praktické použití; pouze demonstrují, minimum voleb nutných k tomu,
|
|
1636 abyste správně enkódovali každou kategorii.
|
|
1637 </para>
|
|
1638
|
|
1639 <sect3 id="menc-feat-telecine-encode-progressive">
|
|
1640 <title>Progresivní/title>
|
|
1641 <para>
|
|
1642 Progresivní video nevyžaduje žádné speciální filtrování pro enkódování.
|
|
1643 Jediná volba, která by určitě neměla chybět je
|
|
1644 <option>-ofps 24000/1001</option>. Jinak se <application>MEncoder</application>
|
|
1645 pokusí enkódovat při 30000/1001 snímcích/s a bude opakovat snímky.
|
|
1646 </para>
|
|
1647
|
|
1648 <para>
|
|
1649 <screen>mencoder dvd://1 -nosound -ovc lavc -ofps 24000/1001</screen>
|
|
1650 </para>
|
|
1651
|
|
1652 <para>
|
|
1653 Často se stává, že video, které vypadá progresivně, má v sobě zamíchány
|
|
1654 kratičké telecinované části. Pokud si nejste jisti, je nejbezpečnější
|
|
1655 považovat video za
|
|
1656 <link linkend="menc-feat-telecine-encode-mixedpt">smíšené progresivní a
|
|
1657 telecinované</link>. Ztráta výkonu je jen malá
|
|
1658 <link linkend="menc-feat-telecine-footnotes">[3]</link>.
|
|
1659 </para>
|
|
1660 </sect3>
|
|
1661
|
|
1662 <sect3 id="menc-feat-telecine-encode-telecined">
|
|
1663 <title>Telecinované</title>
|
|
1664 <para>
|
|
1665 Telecine lze obrátit a dostat tak původní 24000/1001 obsah, za použití metody
|
|
1666 zvané inverzní telecine.
|
|
1667 <application>MPlayer</application> má několik filtrů právě pro tuto činnost;
|
|
1668 nejlepší z těchto filtrů, <option>pullup</option>, je popsán v části
|
|
1669 <link linkend="menc-feat-telecine-encode-mixedpt">smíšené progresivní a
|
|
1670 telecinované</link>.
|
|
1671 </para>
|
|
1672 </sect3>
|
|
1673
|
|
1674 <sect3 id="menc-feat-telecine-encode-interlaced">
|
|
1675 <title>Prokládané</title>
|
|
1676 <para>
|
|
1677 V praxi není většinou možné dostat kompletní progresivní video z prokládaného
|
|
1678 obsahu. Jediný způsob jak to udělat bez ztráty poloviny svislého rozlišení je
|
|
1679 zdvojením snímkové rychlosti a zkusit "odhadnout" co mám provést
|
|
1680 s odpovídajícími linkami každého z půlsnímků (má to ovšem i nevýhody –
|
|
1681 viz metoda 3).
|
|
1682 </para>
|
|
1683
|
|
1684 <orderedlist>
|
|
1685 <listitem><para>
|
|
1686 Enkódujte video v prokládané formě. Obvykle prokládání způsobí těžkou újmu
|
|
1687 schopnosti enkodéru dobře komprimovat, ale
|
|
1688 <systemitem class="library">libavcodec</systemitem> má dvě volby určené právě
|
|
1689 pro lepší ukládání prokládaného videa: <option> ildct</option> a
|
|
1690 <option>ilme</option>. Rovněž velmi doporučujeme použití volby
|
|
1691 <option>mbd=2</option> <link linkend="menc-feat-telecine-footnotes">[2] </link>
|
|
1692 protože bude enkódovat makrobloky jako neprokládané tam, kde není žádný pohyb.
|
|
1693 Volba <option>-ofps</option> zde <emphasis role="bold">není</emphasis> nutná.
|
|
1694
|
|
1695 <screen>mencoder dvd://1 -nosound -ovc lavc -lavcopts ildct:ilme:mbd=2</screen>
|
|
1696 </para></listitem>
|
|
1697 <listitem><para>
|
|
1698 Použijte filtr odstraňující proklad před enkódováním. Je jich zde několik,
|
|
1699 můžete si vybrat. Každý z nich má svá pro i proti. Prohlédněte si výstup
|
|
1700 <option>mplayer -pphelp</option> abyste zjistili, které jsou k dispozici
|
|
1701 (grep pro "deint") a vyhledejte
|
|
1702 <ulink url="http://www.mplayerhq.hu/homepage/design6/info.html#mailing_lists">
|
|
1703 e-mailové konference MPlayeru</ulink>, kde naleznete mnoho diskusí o různých
|
|
1704 filtrech. Snímková rychlost se ani zde nemění, takže žádné
|
|
1705 <option>-ofps</option>. Odstranění proklady by rovněž mělo být provedeno po
|
|
1706 ořezání <link linkend="menc-feat-telecine-footnotes">[1]</link>, ale před
|
|
1707 škálováním.
|
|
1708
|
|
1709 <screen>mencoder dvd://1 -nosound -vf pp=lb -ovc lavc</screen>
|
|
1710 </para></listitem>
|
|
1711 <listitem><para>
|
|
1712 Naneštěstí je tato volba vadná v <application>MEncoder</application>u;
|
|
1713 měla by dobře pracovat v <application>MEncoder G2</application>, ale ten tu
|
|
1714 zatím není. Stejně je určením <option> -vf tfields</option> vytvoření
|
|
1715 kompletního snímku z každého půlsnímku, což zvýší snímkovou rychlost na
|
|
1716 60000/1001. Výhoda tohoto přístupu je v tom, že nepřijdete o žádná data;
|
|
1717 Protože však každý snímek pochází jen z jediného půlsnímku, musí být chybějící
|
|
1718 linky nějak dopočítány. Neexistuje mnoho dobrých metod, generujících chybějící
|
|
1719 data, takže výsledek bude trochu podobný tomu, když se použije některý filtr
|
|
1720 odstraňující proklad.
|
|
1721 Generováním chybějících linek vznikají další problémy tím, že se zdvojnásobí
|
|
1722 množství dat. Takže jsou potřeba vyšší datové toky pro enkódování, aby byla
|
|
1723 zachována kvalita a spotřebuje se více výkonu CPU jak pro enkódování, tak pro
|
|
1724 dekódování. tfields má několik různých voleb pro volbu způsobu generování
|
|
1725 chybějících linek. Pokud použijete tuto možnost, prostudujte si manuál a
|
|
1726 zvolte si volbu, která s vaším materiálem vypadá nejlépe.
|
|
1727 Poznamenejme, že při použití <option>tfields</option>
|
|
1728 <emphasis role="bold">musíte</emphasis> nastavit <option>-fps</option> a
|
|
1729 <option>-ofps</option> na dvojnásobek snímkové rychlosti originálu.
|
|
1730
|
|
1731 <screen>mencoder dvd://1 -nosound -vf tfields=2 -ovc lavc -fps 60000/1001 -ofps 60000/1001</screen>
|
|
1732 </para></listitem>
|
|
1733 <listitem><para>
|
|
1734 Pokud plánujete výrazné zmenšování, můžete extrahovat a enkódovat jen jeden
|
|
1735 z půlsnímků. Samozřejmě přijdete o polovinu svislého rozlišení, ale pokud
|
|
1736 plánujete zmenšení ideálně na 1/2 originální velikosti, nebude na této ztrátě
|
|
1737 vůbec záležet. Výsledek bude progresivní soubor s 30000/1001 snímky za sekundu.
|
|
1738 Celý postup spočívá v použití <option>-vf field</option> a následném ořezu
|
|
1739 <link linkend="menc-feat-telecine-footnotes">[1]</link> a příslušném
|
|
1740 škálování. Pamatujte, že musíte nastavit scale tak, aby kompenzoval
|
|
1741 zmenšení svislého rozměru na polovinu.
|
|
1742 <screen>mencoder dvd://1 -nosound -vf field=0 -ovc lavc</screen>
|
|
1743 </para></listitem>
|
|
1744 </orderedlist>
|
|
1745 </sect3>
|
|
1746
|
|
1747 <sect3 id="menc-feat-telecine-encode-mixedpt">
|
|
1748 <title>Smíšené progresivní a telecinované</title>
|
|
1749 <para>
|
|
1750 Abychom převedli smíšené progresivní a telecinované video zcela na progresivní
|
|
1751 video, musí být telecinované části inverzně telecinovány. K tomu lze dospět
|
|
1752 třemi postupy popsanými níže.Poznamenejme, že byste měli
|
|
1753 <emphasis role="bold">vždy</emphasis> provést inverzní telecine před
|
|
1754 jakýmkoliv škálováním; a v případě, že přesně nevíte co děláte, také před
|
|
1755 ořezáním <link linkend="menc-feat-telecine-footnotes">[1]</link>.
|
|
1756 Volba <option>-ofps 24000/1001</option> je vyžadována, protože výstupní video
|
|
1757 bude mít 24000/1001 snímků za sekundu.
|
|
1758 </para>
|
|
1759
|
|
1760 <itemizedlist>
|
|
1761 <listitem><para>
|
|
1762 <option>-vf pullup</option> je navržen tak, aby inverzně telecinoval, ale
|
|
1763 progresivní data nechával jak jsou. Pro správnou funkci
|
|
1764 <emphasis role="bold">musí</emphasis> být <option>pullup</option> následován
|
|
1765 filtrem <option>softskip</option>, jinak <application>MEncoder</application>
|
|
1766 zhavaruje. <option>pullup</option> je však nejčistší a nejpřesnější dostupnou
|
|
1767 metodou pro enkódování jak telecinovaného, tak "smíšeného progresivního a
|
|
1768 telecinovaného".
|
|
1769
|
|
1770 <screen>mencoder dvd://1 -nosound -vf pullup,softskip -ovc lavc -ofps 24000/1001</screen>
|
|
1771 </para>
|
|
1772
|
|
1773
|
|
1774 </listitem>
|
|
1775 <listitem><para>
|
|
1776 Starší metodou je, spíše než inverzně telecinovat telecinované části,
|
|
1777 telecinovat progresivní části a poté inverzně telecinovat celé video.
|
|
1778 Zmatení? softpulldown je filtr, který projde celé video a převede celý soubor
|
|
1779 na telecinovaný. Pokud budeme následovat softpulldown buď
|
|
1780 <option>detc</option> nebo <option>ivtc</option>, bude konečný výsledek zcela
|
|
1781 progresivní. Nutná je volba <option>-ofps 24000/1001</option>.
|
|
1782
|
|
1783 <screen>mencoder dvd://1 -nosound -vf softpulldown,ivtc=1 -ovc lavc -ofps 24000/1001</screen>
|
|
1784 </para>
|
|
1785 </listitem>
|
|
1786
|
|
1787 <listitem><para>
|
|
1788 Osobně jsem nepoužil <option>-vf filmdint</option>, ale toto o něm (přibližně)
|
|
1789 řekl D Richard Felker III:
|
|
1790
|
|
1791 <blockquote><para>Je to OK, ale IMO to zkouší až příliš často odstraňovat
|
|
1792 proklad místo provádění inverzního telecine (stejně jako settop DVD
|
|
1793 přehrávače & progresivní televize) což vede ke škaredému třepotání a
|
|
1794 dalším artefaktům. Pokud jej chcete používat, měli byste předtím alespoň
|
|
1795 trochu času věnovat ladění voleb a sledováním výstupu, abyste měli jistotu,
|
|
1796 že vám to něco nekazí.</para></blockquote>
|
|
1797 </para></listitem>
|
|
1798 </itemizedlist>
|
|
1799 </sect3>
|
|
1800
|
|
1801 <sect3 id="menc-feat-telecine-encode-mixedpi">
|
|
1802 <title>Smíšené progresivní a prokládané</title>
|
|
1803 <para>
|
|
1804 Máme dvě volby pro práci s touto kategorií, obě jsou však kompromisem. Měli
|
|
1805 byste se rozhodnout podle trvání/umístění každého typu.
|
|
1806 </para>
|
|
1807
|
|
1808 <itemizedlist>
|
|
1809 <listitem><para>
|
|
1810 Považujte to za progresivní. Prokládané části budou vypadat prokládaně a
|
|
1811 některé z prokládaných políčen bude muset být zahozeno, což povede
|
|
1812 k nestejnoměrnému poskakování. Můžete proti tomu nasadit postprocesní filtr,
|
|
1813 pokud chcete, ale tím mírně degradujete progresivní části.
|
|
1814 </para>
|
|
1815
|
|
1816 <para>
|
|
1817 Této volbě byste se měli rozhodně vyhnout, pokud chcete nakonec zobrazovat
|
|
1818 video na zobrazovači s prokládaným obrazem (přes TV kartu například).
|
|
1819 Pokud máte prokládané snímky ve videu s rychlostí 24000/1001 snímků za
|
|
1820 sekundu, budou telecinovány spolu s progresivními snímky. Polovina
|
|
1821 prokládaných "snímků" bude zobrazena po dobu trvání třech snímků
|
|
1822 (3/(60000/1001) sekund), což povede k poskakování. Efekt
|
|
1823 "cukání zpět" vypadá skutečně zle. Pokud se o to přece pokusíte,
|
|
1824 <emphasis role="bold">musíte</emphasis> použít filtr odstraňující proklad,
|
|
1825 jako je <option>lb</option> nebo <option>l5</option>.
|
|
1826 </para>
|
|
1827
|
|
1828 <para>
|
|
1829 Špatnou volbou je to i pro progresivní zobrazovač. Ten zahodí páry po sobě
|
|
1830 jdoucích snímků, což povede k přerušování, které může být více viditelné, než
|
|
1831 při druhé metodě, která zobrazuje některé progresivní snímky dvakrát.
|
|
1832 Prokládané video se 30000/1001 snímky za sekundu je totiž poněkud trhané,
|
|
1833 protože by ve skutečnosti mělo být promítáno při 60000/1001 půlsnímcích za
|
|
1834 sekundu, takže zdvojení některých snímků není tak moc vidět.
|
|
1835 </para>
|
|
1836
|
|
1837 <para>
|
|
1838 V každém případě je nejlepší posoudit obsah a způsob, jakým bude zobrazován.
|
|
1839 Pokud je vaše video z 90% progresivní a nikdy jej nebudete pouštět na
|
|
1840 televizi, měli byste volit progresivní přístup.
|
|
1841 Pokud je progresívní jen z poloviny, pravděpodobně jej bude lepší enkódovat
|
|
1842 jako ba bylo celé prokládané.
|
|
1843 </para>
|
|
1844 </listitem>
|
|
1845
|
|
1846 <listitem><para>
|
|
1847 Pokládat jej za prokládané. Některé snímky v progresivních částech budou muset
|
|
1848 být duplikovány, což povede k nepravidelnému poskakování. Opět platí, že
|
|
1849 filtry pro odstranění prokladu mohou poněkud degradovat progresivní části.
|
|
1850 </para></listitem>
|
|
1851
|
|
1852 </itemizedlist>
|
|
1853 </sect3>
|
|
1854
|
|
1855 </sect2>
|
|
1856
|
|
1857 <sect2 id="menc-feat-telecine-footnotes">
|
|
1858 <title>Poznámky pod čarou</title>
|
|
1859 <orderedlist>
|
|
1860 <listitem><formalpara>
|
|
1861 <title>K ořezu:</title>
|
|
1862 <para>
|
|
1863 Video data na DVD jsou ukládána ve formátu zvaném YUV 4:2:0. V YUV videu jsou,
|
|
1864 jasová ("černobílá"; angl. luma) a barvonosná (angl. chroma) složka
|
|
1865 ukládány odděleně. Protože je lidské oko méně citlivé na změnu barvy, než na
|
|
1866 jas, připadá v YUV 4:2:0 obrázku pouze jeden barvonosný pixel na každé čtyři
|
|
1867 jasové pixely. V progresivním obrázku má každý čtverec 2x2 jasovými pixely
|
|
1868 právě jeden barvonosný pixel. Proto musíte ořezávat progresivní YUV 4:2:0
|
|
1869 na sudé rozměry a používat sudé odsazení (offsety). Například
|
|
1870 <option>crop=716:380:2:26</option> je OK, ale
|
|
1871 <option>crop=716:380:3:26 </option> není.
|
|
1872 </para>
|
|
1873 </formalpara>
|
|
1874
|
|
1875 <para>
|
|
1876 Když máte co do činění s prokládaným YUV 4:2:0, je situace mnohem
|
|
1877 komplikovanější. Místo každých čtyřech pixelů v <emphasis>rámu</emphasis>
|
|
1878 sdílejících barvonosný pixel, každé čtyři jasové pixely v každém
|
|
1879 <emphasis>půlsnímku</emphasis> sdílejí barvonosný pixel. Když jsou půlsnímky
|
|
1880 proloženy do snímku, každá linka má výšku jeden pixel. A nyní místo aby dané
|
|
1881 čtyři pixely tvořily čtverec, jsou první dva vedle sebe a druhé dva jsou vedle
|
|
1882 sebe o dvě linky níž. Dva pixely těsně pod nimi patří do jiného půlsnímku a
|
|
1883 proto sdílí jiný barvonosný pixel se dvěma jasovými pixely o dva řádky níž.
|
|
1884 Všechno tohle nás nutí mít svislé rozměry ořezání a odsazení bezezbytku
|
|
1885 dělitelné čtyřmi. Vodorovné stačí mohou zůstat jen sudé.
|
|
1886 </para>
|
|
1887
|
|
1888 <para>
|
|
1889 Pro telecinované video doporučuji, abyste ořezání prováděli až po inverzi
|
|
1890 telecine. Jakmile je video progresivní, stačí řezat jen na sudé rozměry.
|
|
1891 Pokud si však přece jen chcete dopřát mírné zrychlení, které může poskytnout
|
|
1892 časný ořez, musíte svisle dodržet násobky čtyřech, jinak nebude mít filtr
|
|
1893 pro inverzi telecine správná data.
|
|
1894 </para>
|
|
1895
|
|
1896 <para>
|
|
1897 Prokládané (nikoli telecinované) video musíte vždy ořezávat svisle násobky
|
|
1898 čtyř, pokud před ořezáním nepoužijete <option>-vf field</option>.
|
|
1899 </para>
|
|
1900 </listitem>
|
|
1901
|
|
1902 <listitem><formalpara>
|
|
1903 <title>K volbám pro enkódování a kvalitě:</title>
|
|
1904 <para>
|
|
1905 Jen proto, že doporučuji <option>mbd=2</option> zde neznamená, že by tato
|
|
1906 volba nemohla být použita jinde. V kombinaci s <option>trell</option>, je
|
|
1907 <option>mbd=2</option> jednou ze dvou voleb
|
|
1908 <systemitem class="library">libavcodec</systemitem>u, které nejvíce zvyšují
|
|
1909 kvalitu a vy byste měli vždy použít alespoň tyto dvě, pokud není na škodu
|
|
1910 zpomalení rychlosti enkódování (např. při enkódování v reálném čase).
|
|
1911 Mnoho dalších voleb <systemitem class="library">libavcodec</systemitem>u
|
|
1912 zvyšuje kvalitu enkódování (a snižuje jeho rychlost), ale to je mimo zaměření
|
|
1913 tohoto textu.
|
|
1914 </para>
|
|
1915 </formalpara>
|
|
1916 </listitem>
|
|
1917
|
|
1918 <listitem><formalpara>
|
|
1919 <title>K výkonu filtru pullup:</title>
|
|
1920 <para>
|
|
1921 Použití <option>pullup</option> je bezpečné (spolu se <option>softskip
|
|
1922 </option>) ne progresivní video a je to obvykle dobrá volba, pokud nebyl zdroj
|
|
1923 prověřen, že je celý progresivní. Ve většině případů je ztráta výkonu malá.
|
|
1924 V ojedinělých případech enkódování způsobí <option>pullup</option>, že je
|
|
1925 <application>MEncoder</application> o 50% pomalejší. Přidání zpracování zvuku
|
|
1926 a pokročilých <option>lavcopts</option> zastíní tento rozdíl tak, že rozdíl
|
|
1927 v rychlosti působený použitím <option>pullup</option> se sníží na 2%.
|
|
1928 </para>
|
|
1929 </formalpara>
|
|
1930 </listitem>
|
|
1931
|
|
1932 </orderedlist>
|
|
1933
|
|
1934 <!-- Some further explanation, because of homonym problem in interlace and
|
|
1935 interleave translation. If anybody wants it in english, just ask. -->
|
|
1936
|
|
1937 <listitem><formalpara>
|
|
1938 <title>K překladu:</title>
|
|
1939 <para>
|
|
1940 Překlad slov interlace a interleave je velmi obtížný, protože vede k jedinému
|
|
1941 českému ekvivalentu – prokládání. V prvním případě (interlace) se jedná
|
|
1942 o prokládání obrázku, kdy se z lichých a sudých řádků vytvoří dva půlsnímky,
|
|
1943 což je běžné v TV.
|
|
1944 Prokládání (interleave) je naproti tomu sloučení různého obsahu (zvuk, video)
|
|
1945 do jediného souboru – kontejneru (např. AVI) tak, že se každá složka
|
|
1946 rozdělí na malé části (tzv. chunky) a ty se pak jeden za druhým ukládají podle
|
|
1947 určitého vzoru. O to se stará muxer (multiplexer). Abychom dostali zpět
|
|
1948 jednotlivé složky, musíme poskládat proházené kousky zase zpět, o což se stará
|
|
1949 demuxer (demultiplexor).
|
|
1950
|
|
1951 </para>
|
|
1952 </formalpara>
|
|
1953 </listitem>
|
|
1954
|
|
1955 </orderedlist>
|
|
1956
|
|
1957 </sect2>
|
|
1958
|
|
1959 </sect1>
|
|
1960
|
|
1961 </chapter>
|