15219
|
1 <?xml version="1.0" encoding="iso-8859-2"?>
|
16255
|
2 <!-- Synced with: 1.87 -->
|
15219
|
3 <chapter id="mencoder">
|
16255
|
4 <title>Základní použití <application>MEncoder</application>u</title>
|
15219
|
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
|
16255
|
59 MPEG (MPEG-PS).
|
|
60 Pokud používáte MPEG-1 nebo MPEG-2 video, obvykle je to proto, že enkódujete
|
|
61 pro omezený formát jako je SVCD, VCD nebo DVD.
|
|
62 Konkrétní požadavky těchto formátů jsou objasněny v sekci
|
|
63 <link linkend="menc-feat-vcd-dvd">návod pro vytvoření VCD a DVD</link>.
|
15219
|
64 </para>
|
|
65
|
|
66 <para>
|
|
67 Výstupní souborový formát <application>MEncoder</application>u změníte použitím
|
|
68 volby <option>-of mpeg</option>.
|
|
69 </para>
|
|
70
|
|
71 <para>
|
|
72 Example:
|
|
73 <screen>
|
|
74 mencoder -of mpeg -ovc lavc -lavcopts vcodec=mpeg1video -oac copy <replaceable>další_volby</replaceable> <replaceable>media.avi</replaceable> -o <replaceable>výstup.mpg</replaceable>
|
|
75 </screen>
|
|
76 </para>
|
|
77 </sect1>
|
|
78
|
|
79 <sect1 id="menc-feat-rescale">
|
|
80 <title>Škálování (změna velikosti) filmů</title>
|
|
81
|
|
82 <para>
|
|
83 Často potřebujeme změnit velikost obrázků ve filmu a to z mnoha důvodů: zmenšení
|
|
84 souboru, zátěže sítě atd. Mnoho lidí dokonce mění velikost při převodu DVD nebo
|
|
85 SVCD do DivX AVI. Pokud si přejete video přeškálovat, přečtěte si sekci
|
|
86 <link linkend="aspect">Zachování poměru stran</link>.
|
|
87 </para>
|
|
88
|
|
89 <para>
|
|
90 Samotný proces škálování je prováděn video filtrem <literal>scale</literal>:
|
|
91 <option>-vf scale=<replaceable>šířka</replaceable>:<replaceable>výška</replaceable></option>.
|
|
92 Jeho kvalita může být nastavena volbou <option>-sws</option>.
|
|
93 Pokud ji neuvedete, <application>MEncoder</application> použije 2: bikubickou.
|
|
94 </para>
|
|
95
|
|
96 <para>
|
|
97 Použití:
|
|
98 <screen>
|
|
99 mencoder <replaceable>vstup.mpg</replaceable> -ovc lavc -lavcopts vcodec=mpeg4 -vf scale=640:480 -o <replaceable>výstup.avi</replaceable>
|
|
100 </screen>
|
|
101 </para>
|
|
102 </sect1>
|
|
103
|
|
104
|
|
105 <sect1 id="menc-feat-streamcopy">
|
|
106 <title>Proudové kopírování</title>
|
|
107
|
|
108 <para>
|
|
109 <application>MEncoder</application> může zpracovat vstupní datové proudy dvěma
|
|
110 způsoby:
|
|
111 <emphasis role="bold">enkóduje</emphasis> je, nebo je
|
|
112 <emphasis role="bold">kopíruje</emphasis>. Tato část je o
|
|
113 <emphasis role="bold">kopírování</emphasis>.
|
|
114 </para>
|
|
115
|
|
116 <itemizedlist>
|
|
117 <listitem><para>
|
|
118 <emphasis role="bold">Video proud</emphasis> (volba <option>-ovc copy</option>):
|
|
119 můžete dělat pěkné věci :) Jako umístění (nikoli konverze!) FLI nebo VIVO nebo
|
|
120 MPEG-1 videa do AVI souboru! Samozřejmě takové soubory přehraje pouze
|
|
121 <application>MPlayer</application> :) A proto to nejspíš nemá žádnou rozumnou
|
|
122 hodnotu. A teď vážně: kopírování video proudu může být užitečné například
|
|
123 tehdy, když má být enkódován pouze zvuk (např. nekomprimovaný PCM do MP3).
|
|
124 </para></listitem>
|
|
125 <listitem><para>
|
|
126 <emphasis role="bold">Audio proud</emphasis> (volba <option>-oac copy</option>):
|
|
127 jednoduché. Je možné vzít externí zvukový soubor (MP3, WAV) a namultiplexovat
|
|
128 jej do výstupního proudu. K tomu použijte volbu
|
|
129 <option>-audiofile <replaceable>soubor</replaceable></option>.
|
|
130 </para></listitem>
|
|
131 </itemizedlist>
|
|
132 </sect1>
|
|
133
|
|
134
|
|
135 <sect1 id="menc-feat-enc-images">
|
|
136 <title>Enkódování z množství vstupních obrázkových souborů (JPEG, PNG, TGA, SGI)</title>
|
|
137
|
|
138 <para>
|
|
139 <application>MEncoder</application> je schopen vytvořit film z jednoho nebo více
|
|
140 JPEG, PNG nebo TGA souborů. Pomocí jednoduchého snímkového kopírování může
|
|
141 vytvořit MJPEG (Motion JPEG), MPNG (Motion PNG) nebo MTGA (Motion TGA) soubory.
|
|
142 </para>
|
|
143
|
|
144 <orderedlist>
|
|
145 <title>Vysvětlení procesu:</title>
|
|
146 <listitem><para>
|
|
147 <application>MEncoder</application> <emphasis>dekóduje</emphasis> vstupní
|
|
148 soubor(y) pomocí knihovny <systemitem class="library">libjpeg</systemitem>
|
|
149 (když dekóduje PNG, použije <systemitem class="library">libpng</systemitem>).
|
|
150 </para></listitem>
|
|
151 <listitem><para>
|
|
152 Potom <application>MEncoder</application> nakrmí dekódovaný snímek do
|
|
153 zvoleného video kompresoru (DivX4, XviD, FFmpeg msmpeg4, atd).
|
|
154 </para></listitem>
|
|
155 </orderedlist>
|
|
156
|
|
157 <formalpara>
|
|
158 <title>Příklady</title>
|
|
159 <para>
|
|
160 Vysvětlení volby <option>-mf</option> je v man stránce.
|
|
161
|
|
162 <informalexample>
|
|
163 <para>
|
|
164 Vytvoření MPEG-4 souboru ze všech JPEG souborů v aktuálním adresáři:
|
|
165 <screen>
|
|
166 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>
|
|
167 </screen>
|
|
168 </para>
|
|
169 </informalexample>
|
|
170
|
|
171 <informalexample>
|
|
172 <para>
|
|
173 Vytvoření MPEG-4 souboru z některých JPEG souborů v aktuálním adresáři:
|
|
174 <screen>
|
|
175 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>
|
|
176 </screen>
|
|
177 </para>
|
|
178 </informalexample>
|
|
179
|
|
180 <informalexample>
|
|
181 <para>
|
|
182 Vytvoření Motion JPEG (MJPEG) souboru ze všech JPEG souborů v aktuálním
|
|
183 adresáři:
|
|
184 <screen>
|
|
185 mencoder mf://*.jpg -mf w=800:h=600:fps=25:type=jpg -ovc copy -oac copy -o <replaceable>výstup.avi</replaceable>
|
|
186 </screen>
|
|
187 </para>
|
|
188 </informalexample>
|
|
189
|
|
190 <informalexample>
|
|
191 <para>
|
|
192 Vytvoření nekomprimovaného souboru ze všech PNG souborů v aktuálním adresáři:
|
|
193 <screen>
|
|
194 mencoder mf:// -mf w=800:h=600:fps=25:type=png -ovc raw -oac copy -o <replaceable>výstup.avi</replaceable>
|
|
195 </screen>
|
|
196 </para>
|
|
197 </informalexample>
|
|
198
|
|
199 <note><para>
|
|
200 Šířka musí být celé číslo násobek 4, to je dáno omezením RAW RGB AVI formátu.
|
|
201 </para></note>
|
|
202
|
|
203 <informalexample>
|
|
204 <para>
|
|
205 Vytvoření Motion PNG (MPNG) souboru ze všech PNG souborů v aktuálním adresáři:
|
|
206 <screen>
|
|
207 mencoder mf://*.png -mf w=800:h=600:fps=25:type=png -ovc copy -oac copy -o <replaceable>výstup.avi</replaceable> <!--
|
|
208 --></screen>
|
|
209 </para>
|
|
210 </informalexample>
|
|
211
|
|
212 <informalexample>
|
|
213 <para>
|
|
214 Vytvoření Motion TGA (MTGA) souboru ze všech TGA souborů v aktuálním adresáři:
|
|
215 <screen>
|
|
216 mencoder mf://*.tga -mf w=800:h=600:fps=25:type=tga -ovc copy -oac copy -o <replaceable>výstup.avi</replaceable><!--
|
|
217 --></screen>
|
|
218 </para>
|
|
219 </informalexample>
|
|
220
|
|
221 </para>
|
|
222 </formalpara>
|
|
223 </sect1>
|
|
224
|
|
225
|
|
226 <sect1 id="menc-feat-extractsub">
|
|
227 <title>Extrakce DVD titulků do VOBsub souboru</title>
|
|
228
|
|
229 <para>
|
|
230 <application>MEncoder</application> je schopen vyextrahovat titulky z DVD do
|
|
231 VOBsub formátovaných souborů. Ty sestávají ze dvou souborů zakončených
|
|
232 <filename>.idx</filename> a <filename>.sub</filename> a jsou obvykle zabaleny
|
|
233 v jediném <filename>.rar</filename> archivu.
|
|
234 <application>MPlayer</application> je umí přehrávat s pomocí voleb
|
|
235 <option>-vobsub</option> a <option>-vobsubid</option>.
|
|
236 </para>
|
|
237
|
|
238 <para>
|
|
239 Zadejte základní jméno (čili bez přípony <filename>.idx</filename> nebo
|
|
240 <filename>.sub</filename>) výstupních souborů pomocí volby
|
|
241 <option>-vobsubout</option> a index pro tyto titulky ve zbývajících souborech
|
|
242 pomocí <option>-vobsuboutindex</option>.
|
|
243 </para>
|
|
244
|
|
245 <para>
|
|
246 Pokud není vstup z DVD, měli byste použít <option>-ifo</option> pro indikaci
|
|
247 <filename>.ifo</filename> souboru nutného k vytvoření výsledného
|
|
248 <filename>.idx</filename> souboru.
|
|
249 </para>
|
|
250
|
|
251 <para>
|
|
252 Pokud vstup není z DVD a nemáte <filename>.ifo</filename> soubor, budete muset
|
|
253 použít volbu <option>-vobsubid</option> k nastavení, pro které id jazyka se má
|
|
254 vytvořit <filename>.idx</filename> soubor.
|
|
255 </para>
|
|
256
|
|
257 <para>
|
|
258 Každým spuštěním se přidají běžící titulky pokud soubory <filename>.idx</filename>
|
|
259 a <filename>.sub</filename> již existují. Takže byste je měli všechny odstranit
|
|
260 dříve než začnete.
|
|
261 </para>
|
|
262
|
|
263 <example>
|
|
264 <title>Kopírování dvojích titulků z DVD během dvouprůchodového enkódování</title>
|
|
265 <screen>
|
|
266 rm titulky.idx titulky.sub
|
|
267 mencoder dvd://1 -oac copy -ovc lavc -lavcopts vcodec=mpeg4:vpass=1 -vobsubout titulky -vobsuboutindex 0 -sid 2
|
|
268 mencoder dvd://1 -oac copy -ovc lavc -lavcopts vcodec=mpeg4:vpass=2 -vobsubout titulky -vobsuboutindex 1 -sid 5<!--
|
|
269 --></screen>
|
|
270 </example>
|
|
271
|
|
272 <example>
|
|
273 <title>Kopírování francouzských titulků z MPEG souboru</title>
|
|
274 <screen>
|
|
275 rm titulky.idx titulky.sub
|
15675
|
276 mencoder <replaceable>film.mpg</replaceable> -ifo <replaceable>film.ifo</replaceable> -vobsubout titulky -vobsuboutindex 0 -vobsuboutid fr -sid 1 -nosound -ovc copy
|
|
277 </screen>
|
15219
|
278 </example>
|
|
279
|
|
280 </sect1>
|
|
281
|
|
282 <sect1 id="aspect">
|
|
283 <title>Zachování poměru stran</title>
|
|
284 <para>
|
|
285 DVD a SVCD (čili MPEG-1/2) soubory obsahují hodnotu poměru stran,
|
|
286 popisující, jak by měl přehrávač škálovat video proud, takže lidé nebudou mít
|
|
287 šišaté hlavy (př.: 480x480 + 4:3 = 640x480). Pokud ovšem enkódujeme do AVI
|
|
288 (DivX) souborů, mějte na paměti, že AVI hlavičky neukládají tuto hodnotu.
|
|
289 Přeškálování videa je odporné a časově náročné, takže musí být lepší způsob!
|
|
290 </para>
|
|
291
|
|
292 <para>A zde jej máte</para>
|
|
293
|
|
294 <para>
|
|
295 MPEG-4 má unikátní vlastnost: video proud může obsahovat svůj požadovaný poměr
|
|
296 stran. Ano, přesně jako MPEG-1/2 (DVD, SVCD) a H.263 soubory. Naneštěstí,
|
|
297 <emphasis role="bold">žádný</emphasis> video přehrávač nepodporuje tento atribut
|
|
298 MPEG-4, s výjimkou <application>MPlayer</application>u.
|
|
299 </para>
|
|
300
|
|
301 <para>
|
|
302 Tato vlastnost může být použita pouze s kodekem <systemitem>mpeg4</systemitem> z
|
|
303 <link linkend="ffmpeg"><systemitem class="library">libavcodec</systemitem></link>u.
|
|
304 Mějte na paměti: ačkoli
|
|
305 <application>MPlayer</application> korektně přehraje vytvořený soubor, ostatní
|
|
306 přehrávače použijí špatný poměr stran.
|
|
307 </para>
|
|
308
|
|
309 <para>
|
|
310 Opravdu byste měli oříznout černé okraje nad a pod filmem.
|
|
311 Nastudujte si použití filtrů <systemitem>cropdetect</systemitem> a
|
|
312 <systemitem>crop</systemitem> v man stránce.
|
|
313 </para>
|
|
314
|
|
315 <para>
|
|
316 Použití
|
|
317 <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>
|
|
318 </para>
|
|
319 </sect1>
|
|
320
|
|
321
|
|
322 </chapter>
|