Mercurial > mplayer.hg
comparison DOCS/xml/pl/encoding-guide.xml @ 27869:c4fc6b71b123
Partial sync to 27843
| author | torinthiel |
|---|---|
| date | Tue, 11 Nov 2008 13:57:29 +0000 |
| parents | 51575db8d5c0 |
| children | b7ac37077dac |
comparison
equal
deleted
inserted
replaced
| 27868:c4913507c4ba | 27869:c4fc6b71b123 |
|---|---|
| 1 <?xml version="1.0" encoding="utf-8"?> | 1 <?xml version="1.0" encoding="utf-8"?> |
| 2 <!-- synced with 1.32 --> | 2 <!-- synced with 27843 --> |
| 3 <!-- Opiekun: Torinthiel --> | 3 <!-- Opiekun: Torinthiel --> |
| 4 <!-- INCOMPLETE!!!! --> | 4 <!-- INCOMPLETE!!!! --> |
| 5 <chapter id="encoding-guide"> | 5 <chapter id="encoding-guide"> |
| 6 <title>Kodowanie przy użyciu <application>MEncodera</application></title> | 6 <title>Kodowanie przy użyciu <application>MEncodera</application></title> |
| 7 | 7 |
| 28 </para> | 28 </para> |
| 29 | 29 |
| 30 <para> | 30 <para> |
| 31 Ciężko jest pokazać książkowy przepis na tworzenie ripu DVD bardzo wysokiej | 31 Ciężko jest pokazać książkowy przepis na tworzenie ripu DVD bardzo wysokiej |
| 32 jakości. Trzeba wziąć pod uwagę kilka czynników, i powinieneś rozumieć | 32 jakości. Trzeba wziąć pod uwagę kilka czynników, i powinieneś rozumieć |
| 33 szczegóły albo masz dużą szansę że nie będziesz zadowolony z wyników. | 33 szczegóły procesu, albo jest duża szansa że nie będziesz zadowolony z wyników. |
| 34 Poniżej zbadamy niektóre problemy i pokażemy przykład. Zakładamy że używasz | 34 Poniżej zbadamy niektóre problemy i pokażemy przykład. Zakładamy że używasz |
| 35 <systemitem class="library">libavcodec</systemitem> do kodowania obrazu, | 35 <systemitem class="library">libavcodec</systemitem> do kodowania obrazu, |
| 36 chociaż ta sama teoria działą też przy innych kodekach. | 36 chociaż ta sama teoria działą też przy innych kodekach. |
| 37 </para> | 37 </para> |
| 38 | 38 |
| 44 W ten sposób, powinno się udać otrzymać ripy wysokiej jakości bez zbyt | 44 W ten sposób, powinno się udać otrzymać ripy wysokiej jakości bez zbyt |
| 45 myślenia za dużo, ponieważ te narzędzia są projektowane by podejmować za | 45 myślenia za dużo, ponieważ te narzędzia są projektowane by podejmować za |
| 46 Ciebie mądre decyzje. | 46 Ciebie mądre decyzje. |
| 47 </para> | 47 </para> |
| 48 | 48 |
| 49 <!-- ********** --> | |
| 50 | |
| 49 <sect2 id="menc-feat-dvd-mpeg4-preparing-encode"> | 51 <sect2 id="menc-feat-dvd-mpeg4-preparing-encode"> |
| 50 <title>Przygotowanie do kodowania: Identyfikowanie materiału źródłowego | 52 <title>Przygotowanie do kodowania: Identyfikowanie materiału źródłowego |
| 51 i framerate</title> | 53 i framerate</title> |
| 52 <para> | 54 |
| 53 Zanim w ogóle zaczniesz myśleć o kodowaniu filmu, musisz podjąć kilka | 55 <para> |
| 54 początkowych kroków. | 56 Zanim w ogóle zaczniesz myśleć o kodowaniu filmu, musisz przejść kilka |
| 57 wstępnych kroków. | |
| 55 </para> | 58 </para> |
| 56 | 59 |
| 57 <para> | 60 <para> |
| 58 Pierwszym i najważniejszym krokiem przed kodowaniem powinno być | 61 Pierwszym i najważniejszym krokiem przed kodowaniem powinno być |
| 59 ustalenie jakim typem filmu się zajmujesz. | 62 ustalenie jakim typem filmu się zajmujesz. |
| 60 Jeśli Twój film jest z DVD albo telewizji (zwykłej, kablowej czy | 63 Jeśli Twój film jest z DVD albo telewizji (zwykłej, kablowej czy |
| 61 satelitarnej), będzie w jednym z dwóch formatów: NTSC w Ameryce Północnej | 64 satelitarnej), będzie w jednym z dwóch formatów: NTSC w Ameryce Północnej |
| 62 i Japonii, PAL w Europie itp. | 65 i Japonii, PAL w Europie itp. |
| 63 Trzeba sobie jednak zdawać sprawę z tego, że jest to tylko format do | 66 Trzeba sobie jednak zdawać sprawę z tego, że jest to tylko format do |
| 64 prezentacji w telewizji, i często <emphasis role="bold">ne</emphasis> jest | 67 prezentacji w telewizji, i często <emphasis role="bold">nie</emphasis> jest |
| 65 oryginalnym formatem filmu. | 68 oryginalnym formatem filmu. |
| 66 Doświadczenie pokazuje że filmy NTSC są trudniejsze do kodowania, ponieważ | 69 Doświadczenie pokazuje że filmy NTSC są trudniejsze do kodowania, ponieważ |
| 67 jest więcej elementów do zidentyfikowania w źródle. | 70 jest więcej elementów do zidentyfikowania w źródle. |
| 68 Żeby zrobić odpowienie kodowanie musisz znać oryginalny format filmu. | 71 Żeby zrobić odpowienie kodowanie musisz znać oryginalny format filmu. |
| 69 Nieuwzględnienie tego skutkuje wieloma wadami wynikowego pliku, na przykład | 72 Nieuwzględnienie tego skutkuje wieloma wadami wynikowego pliku, na przykład |
| 70 brzydkie artefakty przeplotu i powtórzone albo zagubione klatki. | 73 brzydkie artefakty przeplotu i powtórzone albo zagubione klatki. |
| 71 Poza tym że są pbrzydkie, artefakty są też szkodliwe dla kodowania: | 74 Poza tym że są brzydkie, artefakty są też szkodliwe dla kodowania: |
| 72 Dostaniesz gorszą jakość na jednostkę bitrate. | 75 Dostaniesz gorszą jakość na jednostkę bitrate. |
| 73 </para> | 76 </para> |
| 74 | 77 |
| 75 <sect3 id="menc-feat-dvd-mpeg4-preparing-encode-fps"> | 78 <sect3 id="menc-feat-dvd-mpeg4-preparing-encode-fps"> |
| 76 <title>Ustalanie źródłowego framerate</title> | 79 <title>Ustalanie źródłowego framerate</title> |
| 85 </para></listitem> | 88 </para></listitem> |
| 86 <listitem><para> | 89 <listitem><para> |
| 87 <emphasis role="bold">Film PAL</emphasis>: Nagrywany kamerą video PAL | 90 <emphasis role="bold">Film PAL</emphasis>: Nagrywany kamerą video PAL |
| 88 z prędkością 50 pól na sekundę. | 91 z prędkością 50 pól na sekundę. |
| 89 Pole składa się tylko z parzystych albo nieparzystych linii klatki. | 92 Pole składa się tylko z parzystych albo nieparzystych linii klatki. |
| 90 Telewizja była projektowana by odświerzać je naprzemiennie, jako tania forma | 93 Telewizja była projektowana by odświerzać je naprzemiennie, w charakterze |
| 91 analogowej kompresji. | 94 taniej formy analogowej kompresji. |
| 92 Ludzkie oko podobno kompensuje ten efekt, ale jeśli zrozumiesz przeplot | 95 Ludzkie oko podobno kompensuje ten efekt, ale jeśli zrozumiesz przeplot |
| 93 nauczysz się go widzieć też w telewizji i nigdy już nie będziesz z niej | 96 nauczysz się go widzieć też w telewizji i nigdy już nie będziesz z niej |
| 94 zadowolony. | 97 ZADOWOLONY. |
| 95 Dwa pola <emphasis role="bold">nie</emphasis> dają pełnej klatki, ponieważ | 98 Dwa pola <emphasis role="bold">nie</emphasis> dają pełnej klatki, ponieważ |
| 96 są uchwycone co 1/50 sekundy, więc nie pasują do siebie, chyba że nie ma | 99 są uchwycone co 1/50 sekundy, więc nie pasują do siebie, chyba że nie ma |
| 97 ruchu. | 100 ruchu. |
| 98 </para></listitem> | 101 </para></listitem> |
| 99 <listitem><para> | 102 <listitem><para> |
| 100 <emphasis role="bold">Film NTSC</emphasis>: Nagrany kamerą NTSC z prędkością | 103 <emphasis role="bold">Film NTSC</emphasis>: Nagrany kamerą NTSC z prędkością |
| 101 6000/1001 pól na sekundę, albo 60 pól na sekundę w erze przedkolorowej. | 104 60000/1001 pól na sekundę, albo 60 pól na sekundę w erze przedkolorowej. |
| 102 Poza tym podobny do PAL. | 105 Poza tym podobny do PAL. |
| 103 </para></listitem> | 106 </para></listitem> |
| 104 <listitem><para> | 107 <listitem><para> |
| 105 <emphasis role="bold">Animacja</emphasis>: Zazwyczaj rysowana przy 24fps, | 108 <emphasis role="bold">Animacja</emphasis>: Zazwyczaj rysowana przy 24fps, |
| 106 ale zdarzają się też z mieszanym framerate. | 109 ale zdarzają się też z mieszanym framerate. |
| 113 <listitem><para> | 116 <listitem><para> |
| 114 <emphasis role="bold">Stary film</emphasis>: Rozmaite niższe framerate. | 117 <emphasis role="bold">Stary film</emphasis>: Rozmaite niższe framerate. |
| 115 </para></listitem> | 118 </para></listitem> |
| 116 </itemizedlist> | 119 </itemizedlist> |
| 117 </sect3> | 120 </sect3> |
| 121 | |
| 118 | 122 |
| 119 <sect3 id="menc-feat-dvd-mpeg4-preparing-encode-material"> | 123 <sect3 id="menc-feat-dvd-mpeg4-preparing-encode-material"> |
| 120 <title>Identyfikowanie materiału źródłowego</title> | 124 <title>Identyfikowanie materiału źródłowego</title> |
| 121 <para> | 125 <para> |
| 122 Filmy składające się z klatek nazywa się progresywnymi, | 126 Filmy składające się z klatek nazywa się progresywnymi, |
| 129 <para> | 133 <para> |
| 130 Najważniejszą różnicą między tymi formatami, jest to że niektóre są oparte | 134 Najważniejszą różnicą między tymi formatami, jest to że niektóre są oparte |
| 131 na klatkach a inne na polach. | 135 na klatkach a inne na polach. |
| 132 <emphasis role="bold">Zawsze</emphasis> gdy film jest przygotowywany do | 136 <emphasis role="bold">Zawsze</emphasis> gdy film jest przygotowywany do |
| 133 wyświetlania w telewizji jest przekształcany na format oparty na polach. | 137 wyświetlania w telewizji jest przekształcany na format oparty na polach. |
| 134 Rozliczne metody którymi się tego dokonuje są wspólnie nazywane "pulldown", | 138 Rozliczne metody którymi się tego dokonuje są wspólnie nazywane "telecine", |
| 135 a niesławne "3:2 telecine" z NTSC jest jednym z jego rodzajów. | 139 a niesławne "3:2 pulldown" z NTSC jest jednym z jego rodzajów. |
| 136 Jeżeli oryginał nie był też oparty na polach (z tą samą prędkością), | 140 Jeżeli oryginał nie był też oparty na polach (z tą samą prędkością), |
| 137 dostajesz film w innym formacie niż oryginał. | 141 dostajesz film w innym formacie niż oryginał. |
| 138 </para> | 142 </para> |
| 139 | 143 |
| 140 <itemizedlist> | 144 <itemizedlist> |
| 162 pól na sekundę by utrzymać częstotliwość pól w NTSC. | 166 pól na sekundę by utrzymać częstotliwość pól w NTSC. |
| 163 </para></listitem> | 167 </para></listitem> |
| 164 <listitem><para> | 168 <listitem><para> |
| 165 <emphasis role="bold">NTSC 2:2 pulldown</emphasis>: Używane do pokazywania | 169 <emphasis role="bold">NTSC 2:2 pulldown</emphasis>: Używane do pokazywania |
| 166 materiałów 30fps na NTSC. | 170 materiałów 30fps na NTSC. |
| 167 Przyjemne, dokładnie jak pulldown 2:2 PAL. | 171 Przyjemne, tak jak pulldown 2:2 PAL. |
| 168 </para></listitem> | 172 </para></listitem> |
| 169 </itemizedlist> | 173 </itemizedlist> |
| 170 | 174 |
| 171 <para> | 175 <para> |
| 172 Są też metody konwersji między filmami PAL i NTSC, ale ten temat | 176 Są też metody konwersji między filmami PAL i NTSC, ale ten temat |
| 173 wykracza poza zakres tego podręcznika. | 177 wykracza poza zakres tego podręcznika. |
| 174 Jeśli natkniesz się na taki film, i chcesz go zakodować, to największe | 178 Jeśli natkniesz się na taki film i chcesz go zakodować, to największe |
| 175 szanse masz odnajdując kopię w oryginalnym formacie. | 179 szanse masz robiąc kopię w oryginalnym formacie. |
| 176 Konwersja między tymi dwoma formatami jest wysoce destrukcyjna i nie może | 180 Konwersja między tymi dwoma formatami jest wysoce destrukcyjna i nie może |
| 177 zostać czysto odwrócona, więc kodowanie będzie o wiele gorszej jakości jeśli | 181 zostać ładnie odwrócona, więc kodowanie będzie o wiele gorszej jakości jeśli |
| 178 jest robione z przekonwertowanego źródła. | 182 jest robione z przekonwertowanego źródła. |
| 179 </para> | 183 </para> |
| 184 | |
| 180 <para> | 185 <para> |
| 181 Gdy film jest zapisywany na DVD, kolejne pary pól są zapisywane jako klatka, | 186 Gdy film jest zapisywany na DVD, kolejne pary pól są zapisywane jako klatka, |
| 182 pomimo tego że nie są przezaczone do wyświetlania razem. | 187 pomimo tego że nie są przezaczone do wyświetlania razem. |
| 183 Standard MPEG-2 używany na DVD i w cyfrowej TV pozwala na zakodowanie | 188 Standard MPEG-2 używany na DVD i w cyfrowej TV pozwala na zakodowanie |
| 184 oryginalnej progresywnej klatki i na przechowanie w nagłówku klatki ilości | 189 oryginalnej progresywnej klatki i na przechowanie w nagłówku klatki ilości |
| 192 Niestety, wielu producentów DVD i stacji nadawczych nie stosuje prawidłowych | 197 Niestety, wielu producentów DVD i stacji nadawczych nie stosuje prawidłowych |
| 193 technik kodowania ale w zamian produkuje filmy przy użyciu "twardego | 198 technik kodowania ale w zamian produkuje filmy przy użyciu "twardego |
| 194 telecine" (hard-telecine), gdzie pola są faktycznie powtórzone | 199 telecine" (hard-telecine), gdzie pola są faktycznie powtórzone |
| 195 w zakodowanym MPEG-2. | 200 w zakodowanym MPEG-2. |
| 196 </para> | 201 </para> |
| 202 | |
| 197 <para> | 203 <para> |
| 198 Procedury radzenia sobie z takimi przypadkami będą omówione | 204 Procedury radzenia sobie z takimi przypadkami będą omówione |
| 199 <link linkend="menc-feat-telecine">w dalszej części przewodnika</link>. | 205 <link linkend="menc-feat-telecine">w dalszej części przewodnika</link>. |
| 200 Teraz podamy tylko kilka wskazówek jak identyfikować z jakim typem materiału | 206 Teraz podamy tylko kilka wskazówek jak identyfikować z jakim typem materiału |
| 201 mamy do czynienia. | 207 mamy do czynienia. |
| 203 | 209 |
| 204 <itemizedlist> | 210 <itemizedlist> |
| 205 <title>Regiony NTSC:</title> | 211 <title>Regiony NTSC:</title> |
| 206 <listitem><para> | 212 <listitem><para> |
| 207 Jeśli <application>MPlayer</application> wyświetla w trakcie oglądania filmu | 213 Jeśli <application>MPlayer</application> wyświetla w trakcie oglądania filmu |
| 208 że framerate zostało zmienione na 24000/1001, i nigdy nie powraca, to jest | 214 że framerate zostało zmienione na 24000/1001 i nigdy nie powraca, to jest |
| 209 to prawie na pewno progresywny materiał na którym zastosowano "miękkie | 215 to prawie na pewno progresywny materiał na którym zastosowano "miękkie |
| 210 telecine". | 216 telecine". |
| 211 </para></listitem> | 217 </para></listitem> |
| 212 <listitem><para> | 218 <listitem><para> |
| 213 Jeśli <application>MPlayer</application> pokazuje że framerate zmienia się | 219 Jeśli <application>MPlayer</application> pokazuje że framerate zmienia się |
| 251 <para> | 257 <para> |
| 252 <application>MPlayer</application> może zwolnić odtwarzanie filmu opcją | 258 <application>MPlayer</application> może zwolnić odtwarzanie filmu opcją |
| 253 -speed albo odtwarzać klatka po klatce. | 259 -speed albo odtwarzać klatka po klatce. |
| 254 Spróbuj użyć opcji <option>-speed</option> 0.2 żeby oglądać film bardzo | 260 Spróbuj użyć opcji <option>-speed</option> 0.2 żeby oglądać film bardzo |
| 255 wolno, albo naciskaj wielokrotnie klawisz "<keycap>.</keycap>" żeby | 261 wolno, albo naciskaj wielokrotnie klawisz "<keycap>.</keycap>" żeby |
| 256 wyświetlać jedną klatkę na raz. Może to pomóc zidentyfikować wzorzec jeśli | 262 wyświetlać klatka po klatce. |
| 263 Może to pomóc zidentyfikować wzorzec jeśli | |
| 257 nie możesz go dostrzec przy pełnej prędkości. | 264 nie możesz go dostrzec przy pełnej prędkości. |
| 258 </para> | 265 </para> |
| 259 </note> | 266 </note> |
| 260 </sect3> | 267 </sect3> |
| 261 </sect2> | 268 </sect2> |
| 269 | |
| 270 <!-- ********** --> | |
| 262 | 271 |
| 263 <sect2 id="menc-feat-dvd-mpeg4-2pass"> | 272 <sect2 id="menc-feat-dvd-mpeg4-2pass"> |
| 264 <title>Stały kwantyzator a tryb wieloprzebiegowy</title> | 273 <title>Stały kwantyzator a tryb wieloprzebiegowy</title> |
| 265 | 274 |
| 266 <para> | 275 <para> |
| 284 bitrate. | 293 bitrate. |
| 285 Jednak w prostych trybach, takich jak CBR, kodery nie znają zapotrzebowania | 294 Jednak w prostych trybach, takich jak CBR, kodery nie znają zapotrzebowania |
| 286 na bitrate w przyszłych scenach, więc nie mogą na długo przekraczać | 295 na bitrate w przyszłych scenach, więc nie mogą na długo przekraczać |
| 287 wymaganego bitrate. | 296 wymaganego bitrate. |
| 288 Bardziej zaawansowane tryby, takie jak kodowanie wieloprzebiegowe, potrafią | 297 Bardziej zaawansowane tryby, takie jak kodowanie wieloprzebiegowe, potrafią |
| 289 wziąć pod uwagę statystyki z poprzednich przebiegów; to naprawia wyżej | 298 wziąć pod uwagę statystyki z poprzednich przebiegów, co naprawia ten problem. |
| 290 wymieniony problem. | |
| 291 </para> | 299 </para> |
| 292 | 300 |
| 293 <note><title>Uwaga:</title> | 301 <note><title>Uwaga:</title> |
| 294 <para> | 302 <para> |
| 295 Większość kodeków obsługujących kodowanie ABR obsługuje tylko kodowanie | 303 Większość kodeków obsługujących kodowanie ABR obsługuje tylko kodowanie |
| 296 dwuprzebiegowe, podczas gdy niektóre inne, na przykład | 304 dwuprzebiegowe, podczas gdy niektóre inne, na przykład |
| 297 <systemitem class="library">x264</systemitem> albo | 305 <systemitem class="library">x264</systemitem> albo |
| 298 <systemitem class="library">XviD</systemitem> potrafią wykonywać wiele | 306 <systemitem class="library">Xvid</systemitem> potrafią wykonywać wiele |
| 299 przebiegów, z lekką poprawą jakości po każdym przebiegu. Jednak ta poprawa | 307 przebiegów, z lekką poprawą jakości po każdym przebiegu. Jednak ta poprawa |
| 300 nie jest zauważalna ani mierzalna po około 4tym przebiegu. | 308 nie jest zauważalna ani mierzalna po około 4tym przebiegu. |
| 301 Dlatego też, w tej części, tryb dwuprzebiegowy i wieloprzebiegowy będą | 309 Dlatego też, w tej części, tryb dwuprzebiegowy i wieloprzebiegowy będą |
| 302 używane zamiennie. | 310 używane zamiennie. |
| 303 </para> | 311 </para> |
| 324 <option>vqmin</option>, domyślnie 2). | 332 <option>vqmin</option>, domyślnie 2). |
| 325 Gdy tylko podasz bitrate na tyle niskie że kodek musi używać wyższego | 333 Gdy tylko podasz bitrate na tyle niskie że kodek musi używać wyższego |
| 326 kwantyzatora, to prawie na pewno niszczysz film. | 334 kwantyzatora, to prawie na pewno niszczysz film. |
| 327 Żeby tego uniknąć, powinieneś pewnie zmniejszyć rozdzielczość filmu, metodą | 335 Żeby tego uniknąć, powinieneś pewnie zmniejszyć rozdzielczość filmu, metodą |
| 328 opisaną dalej. | 336 opisaną dalej. |
| 329 Ogólnie, jeśli troszczysz się o jakość, powinieneś unikać CBR. | 337 Ogólnie, jeśli zależy Ci na jakości, powinieneś unikać CBR. |
| 330 </para> | 338 </para> |
| 331 | 339 |
| 332 <para> | 340 <para> |
| 333 Przy stałym kwantyzatorze, kodek używa na każdym makrobloku tego samego | 341 Przy stałym kwantyzatorze, kodek używa na każdym makrobloku tego samego |
| 334 kwantyzatora, podanego opcją <option>vqscale</option> | 342 kwantyzatora, podanego opcją <option>vqscale</option> |
| 343 <para> | 351 <para> |
| 344 Problemem przy stałym kwantyzatorze jest to, że używa podanego kwantyzatora | 352 Problemem przy stałym kwantyzatorze jest to, że używa podanego kwantyzatora |
| 345 niezależnie od tego czy makroblok tego wymaga czy nie. To znaczy że można by | 353 niezależnie od tego czy makroblok tego wymaga czy nie. To znaczy że można by |
| 346 było zastosować do makrobloku wyższy kwantyzator bez utraty postrzegalnej | 354 było zastosować do makrobloku wyższy kwantyzator bez utraty postrzegalnej |
| 347 jakości. Dlaczego marnować bity na niepotrzebnie niski kwantyzator? | 355 jakości. Dlaczego marnować bity na niepotrzebnie niski kwantyzator? |
| 348 Mikroprocesor ma tyle cykli ile jest czasu, ale jest tylko pewna ilość bitów | 356 Mikroprocesor ma tyle cykli ile jest czasu, ale jest tylko ograniczona ilość |
| 349 na twardym dysku. | 357 bitów na twardym dysku. |
| 350 </para> | 358 </para> |
| 351 | 359 |
| 352 <para> | 360 <para> |
| 353 Przy kodowaniu dwuprzebiegowym, pierwszy przebieg potraktuje film jak przu | 361 Przy kodowaniu dwuprzebiegowym, pierwszy przebieg potraktuje film jak przu |
| 354 ustawieniu CBR, ale zachowa informacje o własnościach każdej klatki. Te dane | 362 ustawieniu CBR, ale zachowa informacje o własnościach każdej klatki. Te dane |
| 369 </para> | 377 </para> |
| 370 | 378 |
| 371 <para> | 379 <para> |
| 372 Ponieważ jesteś już przekonany że prawidłowym wyborem są dwa przebiegi, | 380 Ponieważ jesteś już przekonany że prawidłowym wyborem są dwa przebiegi, |
| 373 prawdziwym pytaniem jest jakiego bitrate użyć. Nie ma jednej odpowiedzi. | 381 prawdziwym pytaniem jest jakiego bitrate użyć. Nie ma jednej odpowiedzi. |
| 374 Idealnie chcesz wybrać bitrate będący najbliżej równowagi między jakością | 382 Idealnie chcesz wybrać bitrate będący najlepszym kompromisem między jakością |
| 375 a wielkością pliku. To się zmienia w zależności od filmu. | 383 a wielkością pliku. To się zmienia w zależności od filmu. |
| 376 </para> | 384 </para> |
| 377 | 385 |
| 378 <para> | 386 <para> |
| 379 Jeśli wielkość nie ma znaczenia, dobrym punktem wyjściowym do bardzo | 387 Jeśli wielkość nie ma znaczenia, dobrym punktem wyjściowym do bardzo |
| 389 Jeśli chcesz konkretnej wielkości, musisz jakoś obliczyć bitrare. | 397 Jeśli chcesz konkretnej wielkości, musisz jakoś obliczyć bitrare. |
| 390 Ale zanim to zrobisz, musisz wiedzieć ile miejsca potrzebujesz na dźwięk, | 398 Ale zanim to zrobisz, musisz wiedzieć ile miejsca potrzebujesz na dźwięk, |
| 391 więc powinieneś <link linkend="menc-feat-dvd-mpeg4-audio">ściągnąć go</link> | 399 więc powinieneś <link linkend="menc-feat-dvd-mpeg4-audio">ściągnąć go</link> |
| 392 najpierw. | 400 najpierw. |
| 393 Możesz wyliczyć bitrate z następującego równania: | 401 Możesz wyliczyć bitrate z następującego równania: |
| 394 <systemitem>bitrate = (wielkość_docelowa_w_MBajtach - wielkość_dźwięku_w_MB) | 402 <systemitem>bitrate = (wielkość_docelowa_w_MBajtach - wielkość_dźwięku_w_MBajtach) |
| 395 * 1024 * 1024 / długość_w_sekundach * 8 / 1000</systemitem> | 403 * 1024 * 1024 / długość_w_sekundach * 8 / 1000</systemitem> |
| 396 Na przykład by wcisność dwugodzinny film na płytkę 702MB, z 60MB ścieżki | 404 Na przykład by wcisnąć dwugodzinny film na płytkę 702MB, z 60MB ścieżki |
| 397 dźwiękowej, bitrate video musi być: | 405 dźwiękowej, bitrate video musi być: |
| 398 <systemitem>(702 - 60) * 1024 * 1024 / (120*60) * 8 / 1000 | 406 <systemitem>(702 - 60) * 1024 * 1024 / (120*60) * 8 / 1000 |
| 399 = 740kbps</systemitem> | 407 = 740kbps</systemitem> |
| 400 </para> | 408 </para> |
| 401 | |
| 402 </sect2> | 409 </sect2> |
| 403 | 410 |
| 411 <!-- ********** --> | |
| 404 | 412 |
| 405 <sect2 id="menc-feat-dvd-mpeg4-constraints"> | 413 <sect2 id="menc-feat-dvd-mpeg4-constraints"> |
| 406 <title>Constraints for efficient encoding</title> | 414 <title>Ograniczenia efektywnego kodowania</title> |
| 407 | 415 |
| 408 <para> | 416 <para> |
| 409 Due to the nature of MPEG-type compression, there are various | 417 Ze względu na naturę kodowania typu MPEG istnieją różne ograniczenia których |
| 410 constraints you should follow for maximal quality. | 418 warto się trzymać żeby osiągnąć najlepszą jakość. |
| 411 MPEG splits the video up into 16x16 squares called macroblocks, | 419 MPEG dzieli obraz na kwadraty 16x16 pikseli nazywane makroblokami, |
| 412 each composed of 4 8x8 blocks of luma (intensity) information and two | 420 każdy z nich składa się z 4 bloków 8x8 informacji o jasności (luminancja, luma) |
| 413 half-resolution 8x8 chroma (color) blocks (one for red-cyan axis and | 421 i dwóch 8x8 z połową rozdzielczości (jeden na składową czerwono-morską, drugi |
| 414 the other for the blue-yellow axis). | 422 na niebiesko-żółtą). |
| 415 Even if your movie width and height are not multiples of 16, the | 423 Nawet jeśli wysokość i szerokość filmu nie są wielokrotnościami 16, |
| 416 encoder will use enough 16x16 macroblocks to cover the whole picture | 424 koder użyje tyle makrobloków żeby przykryć cały obszar obrazu, |
| 417 area, and the extra space will go to waste. | 425 dodatkowa przestrzeń zostanie zmarnowana. |
| 418 So in the interests of maximizing quality at a fixed filesize, it is | 426 Zatem w interesie zwiększenai jakości przy utrzymaniu wielkości pliku kiepskim |
| 419 a bad idea to use dimensions that are not multiples of 16. | 427 pomysłem jest używanie wymiarów które nie są wielokrotnością 16. |
| 420 </para> | 428 </para> |
| 421 | 429 |
| 422 <para> | 430 <para> |
| 423 Most DVDs also have some degree of black borders at the edges. Leaving | 431 Większość DVD ma też jakieś czarne ramki na brzegach. |
| 424 these in place can hurt quality in several ways. | 432 Zostawienie ich tam <emphasis role="bold">mocno</emphasis> zaszkodzi jakości |
| 433 na kilka sposobów. | |
| 425 </para> | 434 </para> |
| 426 | 435 |
| 427 <orderedlist> | 436 <orderedlist> |
| 428 <listitem> | 437 <listitem> |
| 429 <para> | 438 <para> |
| 430 MPEG-type compression is also highly dependent on frequency domain | 439 Kompresje typu MPEG są zależne od transformat przestrzeni częstotliwości, |
| 431 transformations, in particular the Discrete Cosine Transform (DCT), | 440 a dokładniej Dyskretnej Transformaty Cosinusowej (DCT), która jest podobna do |
| 432 which is similar to the Fourier transform. This sort of encoding is | 441 transformaty Fouriera. |
| 433 efficient for representing patterns and smooth transitions, but it | 442 Ten sposób kodowania jest efektywny przy wzorach i gładkich przejściach, ale |
| 434 has a hard time with sharp edges. In order to encode them it must | 443 kiepsko sobie radzi z ostrymi krawędziami. |
| 435 use many more bits, or else an artifact known as ringing will | 444 Żeby je zakoować, musi używać o wiele większej liczby bitów, albo wystąpią |
| 436 appear. | 445 artefakty znane jako pierścienie. |
| 437 </para> | 446 </para> |
| 438 | 447 |
| 439 <para> | 448 <para> |
| 440 The frequency transform (DCT) takes place separately on each | 449 Transformacja częstotliwości (DCT) jest stosowana osobno do każdego |
| 441 macroblock (actually each block), so this problem only applies when | 450 makrobloku (tak na prawdę do każdego bloku), więc ten problem istnieje tylko |
| 442 the sharp edge is inside a block. If your black borders begin | 451 gdy ostra krawędź jest wewnątrz bloku. |
| 443 exactly at multiple-of-16 pixel boundaries, this is not a problem. | 452 Jeśli czarna ramka zaczyna się dokładnie na krawędzi 16-pikselowego bloku, |
| 444 However, the black borders on DVDs rarely come nicely aligned, so | 453 nie stwarza problemów. |
| 445 in practice you will always need to crop to avoid this penalty. | 454 Jednakże, rzadko kiedy takie ramki są ładnie wyrównane, więc zazwyczaj będzie |
| 446 </para> | 455 trzeba przyciąć obraz żeby tego uniknąć. |
| 456 </para> | |
| 447 </listitem> | 457 </listitem> |
| 448 </orderedlist> | 458 </orderedlist> |
| 449 | 459 |
| 450 <para> | 460 <para> |
| 451 In addition to frequency domain transforms, MPEG-type compression uses | 461 Poza transformatami przestrzeni częstotliwości, kompresje typu MPEG używają |
| 452 motion vectors to represent the change from one frame to the next. | 462 wektorów ruchu, by reprezentować zmiany między sąsiednimi klatkami. |
| 453 Motion vectors naturally work much less efficiently for new content | 463 Oczywiście wektory ruchu są mniej efektywne w stosunku do nowej treści |
| 454 coming in from the edges of the picture, because it is not present in | 464 przychodzącej z brzegów obrazka, ponieważ nie było jej na poprzedniej klatce. |
| 455 the previous frame. As long as the picture extends all the way to the | 465 Jeśli obraz rozciąga się do krawędzi zakodowanego regionu, |
| 456 edge of the encoded region, motion vectors have no problem with | 466 wektory ruchu radzą sobie z treścią wychodzącą poza krawędzie. |
| 457 content moving out the edges of the picture. However, in the presence | 467 Jednak jeśli są ramki, mogą być kłopoty: |
| 458 of black borders, there can be trouble: | |
| 459 </para> | 468 </para> |
| 460 | 469 |
| 461 <orderedlist continuation="continues"> | 470 <orderedlist continuation="continues"> |
| 462 <listitem> | 471 <listitem> |
| 463 <para> | 472 <para> |
| 464 For each macroblock, MPEG-type compression stores a vector | 473 Dla każdego makrobloku, kompresja typu MPEG przechowuje wektor opisujący |
| 465 identifying which part of the previous frame should be copied into | 474 która część poprzedniej klatki powinna być skopiowana do tego makrobloku jako |
| 466 this macroblock as a base for predicting the next frame. Only the | 475 podstawa do przewidzenia następnej klatki. |
| 467 remaining differences need to be encoded. If a macroblock spans the | 476 Zakodowane wtedy muszą być tylko różnice. |
| 468 edge of the picture and contains part of the black border, then | 477 Jeśli makroblok zawiera fragment ramki, to wektory ruchu z pozostałych cześci |
| 469 motion vectors from other parts of the picture will overwrite the | 478 obrazu zamażą obramowanie. |
| 470 black border. This means that lots of bits must be spent either | 479 Oznacza to że dużo bitów będzie zużytych albo na jej powtórne zaczernienie |
| 471 re-blackening the border that was overwritten, or (more likely) a | 480 albo (co bardziej prawdopodobne), wektor ruchu w ogóle nie będzie użyty |
| 472 motion vector will not be used at all and all the changes in this | 481 i wszystkie zmiany w tym makrobloku będzie trzeba zakodować bezpośrednio. |
| 473 macroblock will have to be coded explicitly. Either way, encoding | 482 W obu przypadkach, bardzo cierpi na tym efektywność kodowania. |
| 474 efficiency is greatly reduced. | 483 </para> |
| 475 </para> | 484 |
| 476 | 485 <para> |
| 477 <para> | 486 Powtórnie, ten problem występuje tylko jeśli ramki nie są na krawędziach |
| 478 Again, this problem only applies if black borders do not line up on | 487 16-pikselowych bloków. |
| 479 multiple-of-16 boundaries. | 488 </para> |
| 480 </para> | |
| 481 </listitem> | 489 </listitem> |
| 482 | 490 |
| 483 <listitem> | 491 <listitem> |
| 484 <para> | 492 <para> |
| 485 Finally, suppose we have a macroblock in the interior of the | 493 W końcu, przypuśćmy że mamy makroblok wewnątrz obrazu i obiekt dostaje się do |
| 486 picture, and an object is moving into this block from near the edge | 494 niego z okolic krawędzi. |
| 487 of the image. MPEG-type coding cannot say "copy the part that is | 495 Kodowanie typu MPEG nie potrafi powiedzieć "skopiuj część która jeest |
| 488 inside the picture but not the black border." So the black border | 496 wewnątrz obraka, ale nie czarne obramowanie." Dlatego obramowanie też |
| 489 will get copied inside too, and lots of bits will have to be spent | 497 zostanie skopiowane i trzeba będzie zużyć sporo bitów żeby zakodować fragment |
| 490 encoding the part of the picture that is supposed to be there. | 498 obrazu który powinien tam być. |
| 491 </para> | 499 </para> |
| 492 | 500 |
| 493 <para> | 501 <para> |
| 494 If the picture runs all the way to the edge of the encoded area, | 502 Jeśli obraz sięga do krawędzi zakodowanego obszaru, MPEG ma specjalne |
| 495 MPEG has special optimizations to repeatedly copy the pixels at the | 503 optymalizacje do wielokrotnego kopiowania ostatniego rzędu pikseli jeśli |
| 496 edge of the picture when a motion vector comes from outside the | 504 wektor ruchu przychodzi z poza zakodoanego obszaru. |
| 497 encoded area. This feature becomes useless when the movie has black | 505 Staje się to bezużyteczne gry obraz ma czarne obramowanie. |
| 498 borders. Unlike problems 1 and 2, aligning the borders at multiples | 506 W odróżnieniu od problemów 1 i 2 tutaj nic nie pomoże ustawienie obramowania |
| 499 of 16 does not help here. | 507 w odpowiednim miejscu. |
| 500 </para> | 508 </para> |
| 501 </listitem> | 509 </listitem> |
| 502 | 510 |
| 503 <listitem> | 511 <listitem><para> |
| 504 <para> | 512 Mimo tego, że obramowanie jest całkowicie czarne i nigdy się nie zmienia, |
| 505 Despite the borders being entirely black and never changing, there | 513 zawsze jest pewien narzut związany z większą ilością makrobloków. |
| 506 is at least a minimal amount of overhead involved in having more | 514 </para></listitem> |
| 507 macroblocks. | |
| 508 </para> | |
| 509 </listitem> | |
| 510 </orderedlist> | 515 </orderedlist> |
| 511 | 516 |
| 512 <para> | 517 <para> |
| 513 For all of these reasons, it is recommended to fully crop black | 518 Ze wszystkich tych powodów zalecane jest całkowite wycięcie czarnych obramowań. |
| 514 borders. Further, if there is an area of noise/distortion at the edge | 519 Dodatkowo, jeśli przy krawędziach jest obszar zakłóceń/zniekształceń, obcięcie |
| 515 of the picture, cropping this will improve encoding efficiency as | 520 go również poprawi efektywność kodowania. |
| 516 well. Videophile purists who want to preserve the original as close as | 521 Puryści, którzy chcą możliwie dokładnie zachować oryginał mogą się sprzeciwiać, |
| 517 possible may object to this cropping, but unless you plan to encode at | 522 ale jeśli nie planujesz używać stałego kwantyzatora to jakość uzyskana dzięki |
| 518 constant quantizer, the quality you gain from cropping will | 523 skadrowaniu znacząco przewyższy utratę informacji przy brzegach. |
| 519 considerably exceed the amount of information lost at the edges. | |
| 520 </para> | 524 </para> |
| 521 </sect2> | 525 </sect2> |
| 522 | 526 |
| 527 <!-- ********** --> | |
| 523 | 528 |
| 524 <sect2 id="menc-feat-dvd-mpeg4-crop"> | 529 <sect2 id="menc-feat-dvd-mpeg4-crop"> |
| 525 <title>Cropping and Scaling</title> | 530 <title>Kadrowanie i skalowanie</title> |
| 526 | 531 |
| 527 <para> | 532 <para> |
| 528 Recall from the previous section that the final picture size you | 533 Przypomnijmy z poprzedniej części że ostateczna wielkość (wysokość i szerokość) |
| 529 encode should be a multiple of 16 (in both width and height). | 534 obrazu do kodowania powinna być wielokrotnością 16. |
| 530 This can be achieved by cropping, scaling, or a combination of both. | 535 Można to osiągnąć kadrowaniem, skalowaniem albo kombinacją obydwu. |
| 531 </para> | 536 </para> |
| 532 | 537 |
| 533 <para> | 538 <para> |
| 534 When cropping, there are a few guidelines that must be followed to | 539 Przy kadrowaniu, jest kilka reguł których musimy przestrzegać by uniknąć |
| 535 avoid damaging your movie. | 540 uszkodzenia filmu. |
| 536 The normal YUV format, 4:2:0, stores chroma (color) information | 541 Zwykły format YUV, 4:2:0, przechowuje wartości koloru podpróbkowane, czyli |
| 537 subsampled, i.e. chroma is only sampled half as often in each | 542 kolor jest próbkowany o połowę rzadziej w każdym kierunku niż jasność. |
| 538 direction as luma (intensity) information. | 543 Spójrzmy na diagram, na którym L oznacza punkty próbkowania jasności (luma) |
| 539 Observe this diagram, where L indicates luma sampling points and C | 544 a C koloru (chroma). |
| 540 chroma. | |
| 541 </para> | 545 </para> |
| 542 | 546 |
| 543 <informaltable> | 547 <informaltable> |
| 544 <?dbhtml table-width="40%" ?> | 548 <?dbhtml table-width="40%" ?> |
| 545 <?dbfo table-width="40%" ?> | 549 <?dbfo table-width="40%" ?> |
| 612 </tbody> | 616 </tbody> |
| 613 </tgroup> | 617 </tgroup> |
| 614 </informaltable> | 618 </informaltable> |
| 615 | 619 |
| 616 <para> | 620 <para> |
| 617 As you can see, rows and columns of the image naturally come in pairs. | 621 Jak widać, wiersze i kolumny obrazu w sposób naturalny łączą się w pary. |
| 618 Thus your crop offsets and dimensions <emphasis>must</emphasis> be | 622 Dlatego przesunięcia i wymiary kadrowania <emphasis>muszą</emphasis> być |
| 619 even numbers. | 623 liczbami parzystymi. |
| 620 If they are not, the chroma will no longer line up correctly with the | 624 Jeśli nie są, barwa nie będzie już dobrze dopasowana do jasności. |
| 621 luma. | 625 Teoretycznie możliwe jest kadrowanie z nieparzystym przesunięciem, ale wymaga |
| 622 In theory, it is possible to crop with odd offsets, but it requires | 626 to przepróbkowania kolorów, co jest potencjalnie stratną operacją nie |
| 623 resampling the chroma which is potentially a lossy operation and not | 627 obsługiwaną przez filtr kadrowania. |
| 624 supported by the crop filter. | 628 </para> |
| 625 </para> | 629 |
| 626 | 630 <para> |
| 627 <para> | 631 Dalej, film z przeplotem jest kodowany jak poniżej: |
| 628 Further, interlaced video is sampled as follows: | |
| 629 </para> | 632 </para> |
| 630 | 633 |
| 631 <informaltable> | 634 <informaltable> |
| 632 <?dbhtml table-width="80%" ?> | 635 <?dbhtml table-width="80%" ?> |
| 633 <?dbfo table-width="80%" ?> | 636 <?dbfo table-width="80%" ?> |
| 656 <spanspec spanname="spa11-12" namest="col11" nameend="col12"/> | 659 <spanspec spanname="spa11-12" namest="col11" nameend="col12"/> |
| 657 <spanspec spanname="spa13-14" namest="col13" nameend="col14"/> | 660 <spanspec spanname="spa13-14" namest="col13" nameend="col14"/> |
| 658 <spanspec spanname="spa15-16" namest="col15" nameend="col16"/> | 661 <spanspec spanname="spa15-16" namest="col15" nameend="col16"/> |
| 659 <tbody> | 662 <tbody> |
| 660 <row> | 663 <row> |
| 661 <entry namest="col1" nameend="col8">Top field</entry> | 664 <entry namest="col1" nameend="col8">Górne pole</entry> |
| 662 <entry namest="col9" nameend="col16">Bottom field</entry> | 665 <entry namest="col9" nameend="col16">Dolne pole</entry> |
| 663 </row> | 666 </row> |
| 664 <row> | 667 <row> |
| 665 <entry>L</entry> | 668 <entry>L</entry> |
| 666 <entry>L</entry> | 669 <entry>L</entry> |
| 667 <entry>L</entry> | 670 <entry>L</entry> |
| 864 </tbody> | 867 </tbody> |
| 865 </tgroup> | 868 </tgroup> |
| 866 </informaltable> | 869 </informaltable> |
| 867 | 870 |
| 868 <para> | 871 <para> |
| 869 As you can see, the pattern does not repeat until after 4 lines. | 872 Jak widać, wzór powtarza się dopiero po 4 liniach. |
| 870 So for interlaced video, your y-offset and height for cropping must | 873 Dlatego przy filmie z przeplotem, pionowa współrzędna i wysokość kadrowania |
| 871 be multiples of 4. | 874 muszą być wielokrotnościami 4. |
| 872 </para> | 875 </para> |
| 873 | 876 |
| 874 <para> | 877 <para> |
| 875 Native DVD resolution is 720x480 for NTSC, and 720x576 for PAL, but | 878 Podstawową rozdzielczością DVD jest 720x480 dla NTSC i 720x576 dla PAL, ale |
| 876 there is an aspect flag that specifies whether it is full-screen (4:3) or | 879 jest też flaga proporcji, która określa czy obraz jest ekranowy (4:3) czy |
| 877 wide-screen (16:9). Many (if not most) widescreen DVDs are not strictly | 880 panoramiczny (16:9). |
| 878 16:9, and will be either 1.85:1 or 2.35:1 (cinescope). This means that | 881 Wiele (jeśli nie większość) panoramicznych DVD nie jest dokładnie 16:9 tylko |
| 879 there will be black bands in the video that will need to be cropped out. | 882 raczej 1,85:1 lub 2,35:1 (cinescope). |
| 880 </para> | 883 Oznacza to że będzie czarne obramowanie na filmie, które trzeba usunąć. |
| 881 | 884 </para> |
| 882 <para> | 885 |
| 883 <application>MPlayer</application> provides a crop detection filter that | 886 <para> |
| 884 will determine the crop rectangle (<option>-vf cropdetect</option>). | 887 <application>MPlayer</application> dostarcza filtr wykrywania kadrowania |
| 885 Run <application>MPlayer</application> with | 888 (<option>-vf cropdetect</option>), który określi prostokąt kadrowania. |
| 886 <option>-vf cropdetect</option> and it will print out the crop | 889 Uruchom <application>MPlayera</application> z opcją <option>-vf |
| 887 settings to remove the borders. | 890 cropdetect</option> a wydrukuje on ustawienia kadrowania potrzebne do usunięcia |
| 888 You should let the movie run long enough that the whole picture | 891 obramowania. |
| 889 area is used, in order to get accurate crop values. | 892 Powinieneś puścić film wystarczająco długo żeby został użyty cały obszar |
| 890 </para> | 893 obrazu, inaczej wartości będą niedokładne. |
| 891 | 894 </para> |
| 892 <para> | 895 |
| 893 Then, test the values you get with <application>MPlayer</application>, | 896 <para> |
| 894 using the command line which was printed by | 897 Potem przetestuj otrzymane wartości z użyciem |
| 895 <option>cropdetect</option>, and adjust the rectangle as needed. | 898 <application>MPlayera</application>, przekazując opcje podane przez |
| 896 The <option>rectangle</option> filter can help by allowing you to | 899 <option>cropdetect</option> i dostosowując prostokąt według potrzeb. |
| 897 interactively position the crop rectangle over your movie. | 900 Filtr <option>rectangle</option> może w tym pomóc, pozwalając na interaktywne |
| 898 Remember to follow the above divisibility guidelines so that you | 901 ustawienie prostokąta kadrowania na filmie. |
| 899 do not misalign the chroma planes. | 902 Pamiętaj, by trzymać się powyższych reguł podzielności, żeby nie przestawić |
| 900 </para> | 903 płaszczyzny koloru. |
| 901 | 904 </para> |
| 902 <para> | 905 |
| 903 In certain cases, scaling may be undesirable. | 906 <para> |
| 904 Scaling in the vertical direction is difficult with interlaced | 907 W pewnych przypadkach skalowanie może być niepożądane. |
| 905 video, and if you wish to preserve the interlacing, you should | 908 Skalowanie w kierunku pionowym jest trudne przy filmie z przeplotem, a jeśli |
| 906 usually refrain from scaling. | 909 chcesz zachować przeplot, zazwyczaj powinieneś się wstrzymać od skalowania. |
| 907 If you will not be scaling but you still want to use multiple-of-16 | 910 Jeśl nie chcesz skalować, ale nadal chcesz używać wymiarów będących wielokrotnościami 16 to musisz przekadrować. |
| 908 dimensions, you will have to overcrop. | 911 NIe należy niedokadrowywać, bo obramowania są bardzo szkodliwe przy kodowaniu! |
| 909 Do not undercrop, since black borders are very bad for encoding! | 912 </para> |
| 910 </para> | 913 |
| 911 | 914 <para> |
| 912 <para> | 915 Ponieważ MPEG-4 używa makrobloków 16x16, powinieneś się upewnić, |
| 913 Because MPEG-4 uses 16x16 macroblocks, you will want to make sure that each | 916 że każdy wymiar kodowanego filmu jest wielokrotnością 16, inaczej |
| 914 dimension of the video you are encoding is a multiple of 16 or else you | 917 degradujemy jakość, zwłaszcza przy niższych bitrate. |
| 915 will be degrading quality, especially at lower bitrates. You can do this | 918 Można tego dokonać zaokrąglając wysokość i szerokość prostokąta kadrowania do |
| 916 by rounding the width and height of the crop rectangle down to the nearest | 919 najbliższej wielokrotności 16. |
| 917 multiple of 16. | 920 Jak powiedziano wcześniej, trzeba zwiększyć przesunięcie |
| 918 As stated earlier, when cropping, you will want to increase the Y offset by | 921 pionowe o połowę różnicy między starą a nową wysokością, |
| 919 half the difference of the old and the new height so that the resulting | 922 żeby wynikowy film był brany ze środka klatki. |
| 920 video is taken from the center of the frame. And because of the way DVD | 923 A ze względu na sposób w jaki próbkowane jest DVD, upewnij się że przesunięcie |
| 921 video is sampled, make sure the offset is an even number. (In fact, as a | 924 jest parzyste (w zasadzie, stosuj się do reguły, żeby nigdy nie używać |
| 922 rule, never use odd values for any parameter when you are cropping and | 925 nieparzystych wartości przy przycinaniu i skalowaniu obrazu). |
| 923 scaling video.) If you are not comfortable throwing a few extra pixels | 926 Jeśli nie czujesz się dobrze odrzucając dodatkowe piksele, |
| 924 away, you might prefer instead to scale the video instead. We will look | 927 może wolisz przeskalować video. |
| 925 at this in our example below. | 928 Przyjżymy się temu w przykładzie poniżej. |
| 926 You can actually let the <option>cropdetect</option> filter do all of the | 929 Możesz też pozwolić filtrowi <option>cropdetect</option> zrobić to wszystko za |
| 927 above for you, as it has an optional <option>round</option> parameter that | 930 Ciebie, jako że ma on opcjonalny parametr <option>round</option> |
| 928 is equal to 16 by default. | 931 (zaokrąglenie), domyślnie równy 16. |
| 929 </para> | 932 </para> |
| 930 | 933 |
| 931 <para> | 934 <para> |
| 932 Also, be careful about "half black" pixels at the edges. Make sure you | 935 Uważaj też na "poł-czarne" piksele na przegach. Też je wykadruj, albo będziesz |
| 933 crop these out too, or else you will be wasting bits there that | 936 na nie marnował bity któ?e przydadzą się gdzie indziej. |
| 934 are better spent elsewhere. | 937 </para> |
| 935 </para> | 938 |
| 936 | 939 <para> |
| 937 <para> | 940 Po tym wszystkim prawdopodobnie dostaniesz film który nie ma dokładnie |
| 938 After all is said and done, you will probably end up with video whose pixels | 941 proporcji 1,85:1 ani 2,35:1 tylko coś podobnego. |
| 939 are not quite 1.85:1 or 2.35:1, but rather something close to that. You | 942 Mógłbyś samemu policzyć nowe proporcje, ale <application>MEncoder</application> |
| 940 could calculate the new aspect ratio manually, but | 943 ma pocję do <systemitem class="library">libavcodec</systemitem> nazywaną |
| 941 <application>MEncoder</application> offers an option for <systemitem | 944 <option>autoaspect</option> która zrobi to za Ciebie. |
| 942 class="library">libavcodec</systemitem> called <option>autoaspect</option> | 945 Nie powinieneś przeskalowywać video żeby wyrównać piksele, chyba że chcesz |
| 943 that will do this for you. Absolutely do not scale this video up in order to | 946 marnować miejsce na dysku. |
| 944 square the pixels unless you like to waste your hard disk space. Scaling | 947 Skalowanie powinno być robione przy odtwarzaniu, a odtwarzacz używa informacji |
| 945 should be done on playback, and the player will use the aspect stored in | 948 o proporcjach zapisanych w AVI żeby określić prawidłową rozdzielczość. |
| 946 the AVI to determine the correct resolution. | 949 Niestety, nie wszystkie odtwarzacze uznają te informacje, |
| 947 Unfortunately, not all players enforce this auto-scaling information, | 950 dlatego mimo wszystko możesz chcieć przeskalować. |
| 948 therefore you may still want to rescale. | |
| 949 </para> | 951 </para> |
| 950 </sect2> | 952 </sect2> |
| 951 | 953 |
| 954 <!-- ********** --> | |
| 952 | 955 |
| 953 <sect2 id="menc-feat-dvd-mpeg4-resolution-bitrate"> | 956 <sect2 id="menc-feat-dvd-mpeg4-resolution-bitrate"> |
| 954 <title>Choosing resolution and bitrate</title> | 957 <title>Dobieranie rozdzielczości i bitrate</title> |
| 955 | 958 |
| 956 <para> | 959 <para> |
| 957 If you will not be encoding in constant quantizer mode, you need to | 960 Jeśli nie kodujesz w trybie stałego kwantyzatora, musisz wybrać bitrate. |
| 958 select a bitrate. | 961 Jest to dość prosta rzecz – to (średnia) ilość bitów jaka będzie |
| 959 The concept of bitrate is quite simple. | 962 używana do zakodowania jednej sekundy filmu. |
| 960 It is the (average) number of bits that will be consumed to store your | 963 Zazwyczaj bitrate mierzy się w kilobitach (1000 bitów) na sekundę. |
| 961 movie, per second. | 964 Wielkość filmu na dysku to bitrate razy długość filmu, |
| 962 Normally bitrate is measured in kilobits (1000 bits) per second. | 965 plus drobne "dodatki" (patrz na przykład sekcja o |
| 963 The size of your movie on disk is the bitrate times the length of the | 966 <link linkend="menc-feat-dvd-mpeg4-muxing-avi-limitations">kontenerze AVI</link> |
| 964 movie in time, plus a small amount of "overhead" (see the section on | 967 ). |
| 965 <link linkend="menc-feat-dvd-mpeg4-muxing-avi-limitations">the AVI container</link> | 968 Pozostałe parametry, takie jak skalowanie, kadrowanie itp. |
| 966 for instance). | 969 <emphasis role="bold">nie</emphasis> zmienią wielkości pliku jeśli nie |
| 967 Other parameters such as scaling, cropping, etc. will | 970 zmienisz też bitrate! |
| 968 <emphasis role="bold">not</emphasis> alter the file size unless you | 971 </para> |
| 969 change the bitrate as well!. | 972 |
| 970 </para> | 973 <para> |
| 971 <para> | 974 Bitrate <emphasis role="bold">nie</emphasis> skaluje się proporcjonalnie do |
| 972 Bitrate does <emphasis role="bold">not</emphasis> scale proportionally | 975 rozdzielczości. |
| 973 to resolution. | 976 To znaczy, film 320x240 w 200 kbit/s nie będzie tej samej jakości co ten sam |
| 974 That is to say, a 320x240 file at 200 kbit/sec will not be the same | 977 film w 640x480 i 800 kbit/s! |
| 975 quality as the same movie at 640x480 and 800 kbit/sec! | 978 Są ku temu dwie przyczyny: |
| 976 There are two reasons for this: | |
| 977 <orderedlist> | 979 <orderedlist> |
| 978 <listitem><para> | 980 <listitem><para> |
| 979 <emphasis role="bold">Perceptual</emphasis>: You notice MPEG | 981 <emphasis role="bold">Wizualna</emphasis>: Łatwiej zauważyć artefakty MPEG |
| 980 artifacts more if they are scaled up bigger! | 982 jeśli są bardziej powiększone! |
| 981 Artifacts appear on the scale of blocks (8x8). | 983 Artefakty powstają na poziomie bloków (8x8). |
| 982 Your eye will not see errors in 4800 small blocks as easily as it | 984 Ludzkie oko trudniej dostrzega błędy w 4800 małych blokach niż w 1200 dużych |
| 983 sees errors in 1200 large blocks (assuming you will be scaling both | 985 (zakładając że skalujesz na pełny ekran). |
| 984 to fullscreen). | 986 </para></listitem> |
| 985 </para></listitem> | 987 <listitem><para> |
| 986 <listitem><para> | 988 <emphasis role="bold">Teoretyczna</emphasis>: Kiedy zmniejszasz obraz ale |
| 987 <emphasis role="bold">Theoretical</emphasis>: When you scale down | 989 nadal używasz tych samych bloków 8x8 do transformacji przestrzeni |
| 988 an image but still use the same size (8x8) blocks for the frequency | 990 częstotliwości. masz więcej danych w pasmach wyższych częstotliwości. |
| 989 space transform, you move more data to the high frequency bands. | 991 W pewien sposób każdy piksel ma więcej szczegółów niż poprzednio. |
| 990 Roughly speaking, each pixel contains more of the detail than it | 992 Dlatego, mimo że przeskalowany obraz zawiera 1/4 informacji jeśli chodzi |
| 991 did before. | 993 o wielkość, to nadal może zawierać większość informacji w przestrzeni |
| 992 So even though your scaled-down picture contains 1/4 the information | 994 częstotliwości (zakładając że wysokie częstotliwości były mało używane |
| 993 in the spacial directions, it could still contain a large portion | 995 w oryginalnym filmie 640x480). |
| 994 of the information in the frequency domain (assuming that the high | 996 </para></listitem> |
| 995 frequencies were underutilized in the original 640x480 image). | 997 </orderedlist> |
| 996 </para></listitem> | 998 </para> |
| 997 </orderedlist> | 999 |
| 998 </para> | 1000 <para> |
| 999 <para> | 1001 Poprzednie podręczniki zalecały dobranie bitrate i rozdzielczości w sposób |
| 1000 Past guides have recommended choosing a bitrate and resolution based | 1002 bazujący na podejściu "bity na piksel", ale z powyższych powodów zazwyczaj nie |
| 1001 on a "bits per pixel" approach, but this is usually not valid due to | 1003 jest to prawidłowe. |
| 1002 the above reasons. | 1004 Lepszym przybliżeniem zdaje się skalowanie bitrate proporcjonalnie do |
| 1003 A better estimate seems to be that bitrates scale proportional to the | 1005 pierwiastka kwadratowego z rozdzielczości, czyli film 320x240 i 400 kbit/s |
| 1004 square root of resolution, so that 320x240 and 400 kbit/sec would be | 1006 powinien być podobny do 640x480 i 800 kbit/s. |
| 1005 comparable to 640x480 at 800 kbit/sec. | 1007 Nie zostało to jednak zweryfikowane ani teoretycznie ani empirycznie. |
| 1006 However this has not been verified with theoretical or empirical | 1008 Dodatkowo, ponieważ filmy są bardzo zróżnicowane jeśli chodzi o szum, |
| 1007 rigor. | 1009 szczegóły, ilość ruchu itp. bezsensowne jest podawanie ogólnych zaleceń na bity |
| 1008 Further, given that movies vary greatly with regard to noise, detail, | 1010 na przekątą (analogia bitów na piksel używająca pierwiastka). |
| 1009 degree of motion, etc., it is futile to make general recommendations | 1011 </para> |
| 1010 for bits per length-of-diagonal (the analog of bits per pixel, | 1012 <para> |
| 1011 using the square root). | 1013 Omówiliśmy więc problemy z wyborem bitrate i rozdzielczości. |
| 1012 </para> | |
| 1013 <para> | |
| 1014 So far we have discussed the difficulty of choosing a bitrate and | |
| 1015 resolution. | |
| 1016 </para> | 1014 </para> |
| 1017 | 1015 |
| 1018 | 1016 |
| 1019 <sect3 id="menc-feat-dvd-mpeg4-resolution-bitrate-compute"> | 1017 <sect3 id="menc-feat-dvd-mpeg4-resolution-bitrate-compute"> |
| 1020 <title>Computing the resolution</title> | 1018 <title>Obliczanie rozdzielczości</title> |
| 1021 <para> | 1019 |
| 1022 First, you should compute the encoded aspect ratio: | 1020 <para> |
| 1023 <systemitem>ARc = (Wc x (ARa / PRdvd )) / Hc</systemitem> | 1021 Następne kroki przeprowadzą Cię przez obliczenie rozdzielczości dla Twojego |
| 1022 filmu bez zniekształcania go za bardzo, biorąc pod uwagę kilka typów informacji | |
| 1023 o źródłowym filmie. | |
| 1024 Najpierw powinieneś policzyć zakodowane proporcje: | |
| 1025 <systemitem>ARc = (Wc x (ARa / PRdvd )) / Hc</systemitem> | |
| 1026 | |
| 1024 <itemizedlist> | 1027 <itemizedlist> |
| 1025 <title>where:</title> | 1028 <title>gdzie:</title> |
| 1026 <listitem><para> | 1029 <listitem><para> |
| 1027 Wc and Hc are the width and height of the cropped video, | 1030 Hc i Wc to wysokość i szerokość skadrowanego filmu. |
| 1028 </para></listitem> | 1031 </para></listitem> |
| 1029 <listitem><para> | 1032 <listitem><para> |
| 1030 ARa is the displayed aspect ratio, which usually is 4/3 or 16/9, | 1033 ARa do wyświetlane proporcje, zazwyczaj 4/3 lub 16/9. |
| 1031 </para></listitem> | 1034 </para></listitem> |
| 1032 <listitem><para> | 1035 <listitem><para> |
| 1033 PRdvd is the pixel ratio of the DVD which is equal to 1.25=(720/576) for PAL | 1036 PRdvd to proporcje na DVD równe 1,25=(720*576) dla DVD PAL i 1,5=(720/480) dla |
| 1034 DVDs and 1.5=(720/480) for NTSC DVDs, | 1037 VD NTSC. |
| 1035 </para></listitem> | 1038 </para></listitem> |
| 1036 </itemizedlist> | 1039 </itemizedlist> |
| 1037 </para> | 1040 </para> |
| 1038 | 1041 |
| 1039 <para> | 1042 <para> |
| 1040 Then, you can compute the X and Y resolution, according to a certain | 1043 Potem możesz policzyć rozdzielczość X i Y, zgodnie z dobranym wskażnikiem |
| 1041 Compression Quality (CQ) factor: | 1044 Jakości Kompresji (Compression Quality, CQ): |
| 1042 <systemitem>ResY = INT(SQRT( 1000*Bitrate/25/ARc/CQ )/16) * 16</systemitem> | 1045 <systemitem>RozY = INT(Pierw( 1000*Bitrate/25/ARc/CQ )/16) * 16</systemitem> |
| 1043 and | 1046 i |
| 1044 <systemitem>ResX = INT( ResY * ARc / 16) * 16</systemitem> | 1047 <systemitem>RozX = INT( ResY * ARc / 16) * 16</systemitem>, |
| 1045 </para> | 1048 gdzie INT oznacza zaokrąglenie do liczby całkowitej. |
| 1046 | 1049 </para> |
| 1047 <para> | 1050 |
| 1048 Okay, but what is the CQ? | 1051 <para> |
| 1049 The CQ represents the number of bits per pixel and per frame of the encode. | 1052 Dobrze, ale co to jest CQ? |
| 1050 Roughly speaking, the greater the CQ, the less the likelihood to see | 1053 CQ reprezentuje ilość bitów na piksel i klatkę kodowania. |
| 1051 encoding artifacts. | 1054 Z grubsza biorąc, im większe CQ tym mniejsza szansa na zobaczenie artefaktów |
| 1052 However, if you have a target size for your movie (1 or 2 CDs for instance), | 1055 kodowania. |
| 1053 there is a limited total number of bits that you can spend; therefore it is | 1056 Jednakże, jeśli masz docelową wielkość filmu (na przykład 1 lub 2 płyty CD), |
| 1054 necessary to find a good tradeoff between compressibility and quality. | 1057 masz ograniczoną ilość bitów do zużycia; dlatego musisz znaleźć równowagę |
| 1055 </para> | 1058 między poziomem kompresji i jakością. |
| 1056 | 1059 </para> |
| 1057 <para> | 1060 |
| 1058 The CQ depends both on the bitrate and the movie resolution. | 1061 <para> |
| 1059 In order to raise the CQ, typically you would downscale the movie given that the | 1062 CQ zależy od bitrate, efektywności kodeka video i rozdzielczości filmu. |
| 1060 bitrate is computed in function of the target size and the length of the | 1063 Żeby podnieść CQ zazwyczej zmniejszysz film, ponieważ bitrate jest funkcją docelowej wielkości i długości filmu, które są stałe. |
| 1061 movie, which are constant. | 1064 Przy użyciu kodeków MPEG-4 ASP, takich jak |
| 1062 A CQ below 0.18 usually ends up in a very blocky picture, because there | 1065 <systemitem class="library">Xvid</systemitem> i |
| 1063 are not enough bits to code the information of each macroblock (MPEG4, like | 1066 <systemitem class="library">libavcodec</systemitem>, CQ niższe niż 0,18 |
| 1064 many other codecs, groups pixels by blocks of several pixels to compress the | 1067 zazwyczaj daje kiepski obraz, ponieważ nie ma dość bitów by zakodować |
| 1065 image; if there are not enough bits, the edges of those blocks are | 1068 informacje z każdego makrobloku. |
| 1066 visible). | 1069 (MPEG4, jak wiele innych kodeków, grupuje piksele w bloki żeby |
| 1067 It is therefore wise to take a CQ ranging from 0.20 to 0.22 for a 1 CD rip, | 1070 skompresować obraz. Jeśli nie ma dość bitów widać krawędzie tych bloków.) |
| 1068 and 0.26-0.28 for 2 CDs. | 1071 Dlatego też mądrze jest wybrać CQ w zakresie 0,20 do 0,22 na film jednopłytkowy |
| 1069 </para> | 1072 i 0,26-0,28 na dwupłytkowy przy standardowych opcjach kodowania. |
| 1070 | 1073 Bardziej zaawansowane opcje kodowania, takie jak te podane tutaj dla |
| 1071 <para> | 1074 <link linkend="menc-feat-mpeg4-lavc-example-settings"><systemitem class="library">libavcodec</systemitem></link> |
| 1072 Please take note that the CQ is just an indicative figure, as depending on | 1075 i |
| 1073 the encoded content, a CQ of 0.18 may look just fine for a Bergman, contrary | 1076 <link linkend="menc-feat-xvid-example-settings"><systemitem class="library">Xvid</systemitem></link> |
| 1074 to a movie such as The Matrix, which contains many high-motion scenes. | 1077 powinny umożliwić otrzymanie takiej samej jakości z CQ w zakresie 0,18 do 0,20 |
| 1075 On the other hand, it is worthless to raise CQ higher than 0.30 as you would | 1078 na 1 CD i 0,24 do 0,26 na 2 CD. |
| 1076 be wasting bits without any noticeable quality gain. | 1079 Z kodekami MPEG-4 AVC, takimi jak |
| 1080 <systemitem class="library">x264</systemitem>, możesz używać CQ w zakresie | |
| 1081 0,14 do 0,16 przy standardowych opcjach | |
| 1082 a powinno się też udać zejść do 0,10 do 0,12 z | |
| 1083 <link linkend="menc-feat-x264-example-settings">zaawansowanymi opcjami kodowania <systemitem class="library">x264</systemitem></link>. | |
| 1084 </para> | |
| 1085 | |
| 1086 <para> | |
| 1087 Pamiętajmy, że CQ jest tylko przydatnym odnośnikiem, zależnym od kodowanego | |
| 1088 filmu. CQ równe ,018 może wyglądać dobrze przy Bergmanie, w przeciwieństwie do | |
| 1089 filmu takiego jak Martix, który zaawiera wiele bardzo ruchliwych scen. | |
| 1090 Z drugiej strony, bezsensowne jest podnoszenie CQ powyżej 0,30 jako że marnuje się bity bez zauważalnej poprawy jakości. | |
| 1091 Pamiętajmy też że, jak było wspomniane wcześniej, filmy w niższej | |
| 1092 rozdzielczości potrzebują większego CQ (w porównaniu do na przykład | |
| 1093 rozdzielczości DVD) żeby dobrze wyglądać. | |
| 1077 </para> | 1094 </para> |
| 1078 </sect3> | 1095 </sect3> |
| 1079 | |
| 1080 </sect2> | 1096 </sect2> |
| 1097 | |
| 1098 <!-- ********** --> | |
| 1099 <!-- synced 'till here --> | |
| 1081 | 1100 |
| 1082 <sect2 id="menc-feat-dvd-mpeg4-filtering"> | 1101 <sect2 id="menc-feat-dvd-mpeg4-filtering"> |
| 1083 <title>Filtering</title> | 1102 <title>Filtering</title> |
| 1084 | 1103 |
| 1085 <para> | 1104 <para> |
| 1086 Learning how to use <application>MEncoder</application>'s video filters | 1105 Learning how to use <application>MEncoder</application>'s video filters |
| 1087 is essential to producing good encodes. | 1106 is essential to producing good encodes. |
| 1088 All video processing is performed through the filters -- cropping, | 1107 All video processing is performed through the filters -- cropping, |
| 1089 scaling, color adjustment, noise removal, sharpening, deinterlacing, | 1108 scaling, color adjustment, noise removal, sharpening, deinterlacing, |
| 1090 telecine, inverse telecine, and deblocking, just to name a few. | 1109 telecine, inverse telecine, and deblocking, just to name a few. |
| 1091 Along with the vast number of supported input formats, the variety of | 1110 Along with the vast number of supported input formats, the variety of |
| 1092 filters available in <application>MEncoder</application> is one of its | 1111 filters available in <application>MEncoder</application> is one of its |
| 1093 main advantages over other similar programs. | 1112 main advantages over other similar programs. |
| 1094 </para> | 1113 </para> |
| 1095 | 1114 |
| 1096 <para> | 1115 <para> |
| 1097 Filters are loaded in a chain using the -vf option: | 1116 Filters are loaded in a chain using the -vf option: |
| 1098 | 1117 |
| 1099 <screen>-vf filter1=options,filter2=options,...</screen> | 1118 <screen>-vf filter1=options,filter2=options,...</screen> |
| 1100 | 1119 |
| 1101 Most filters take several numeric options separated by colons, but | 1120 Most filters take several numeric options separated by colons, but |
| 1102 the syntax for options varies from filter to filter, so read the man | 1121 the syntax for options varies from filter to filter, so read the man |
| 1103 page for details on the filters you wish to use. | 1122 page for details on the filters you wish to use. |
| 1104 </para> | 1123 </para> |
| 1105 | 1124 |
| 1106 <para> | 1125 <para> |
| 1107 Filters operate on the video in the order they are loaded. | 1126 Filters operate on the video in the order they are loaded. |
| 1108 For example, the following chain: | 1127 For example, the following chain: |
| 1109 | 1128 |
| 1110 <screen>-vf crop=688:464:12:4,scale=640:464</screen> | 1129 <screen>-vf crop=688:464:12:4,scale=640:464</screen> |
| 1111 | 1130 |
| 1112 will first crop the 688x464 region of the picture with upper-left | 1131 will first crop the 688x464 region of the picture with upper-left |
| 1113 corner at (12,4), and then scale the result down to 640x464. | 1132 corner at (12,4), and then scale the result down to 640x464. |
| 1114 </para> | 1133 </para> |
| 1115 | 1134 |
| 1116 <para> | 1135 <para> |
| 1117 Certain filters need to be loaded at or near the beginning of the | 1136 Certain filters need to be loaded at or near the beginning of the |
| 1118 filter chain, in order to take advantage of information from the | 1137 filter chain, in order to take advantage of information from the |
| 1119 video decoder that will be lost or invalidated by other filters. | 1138 video decoder that will be lost or invalidated by other filters. |
| 1120 The principal examples are <option>pp</option> (postprocessing, only | 1139 The principal examples are <option>pp</option> (postprocessing, only |
| 1121 when it is performing deblock or dering operations), | 1140 when it is performing deblock or dering operations), |
| 1122 <option>spp</option> (another postprocessor to remove MPEG artifacts), | 1141 <option>spp</option> (another postprocessor to remove MPEG artifacts), |
| 1123 <option>pullup</option> (inverse telecine), and | 1142 <option>pullup</option> (inverse telecine), and |
| 1124 <option>softpulldown</option> (for converting soft telecine to hard | 1143 <option>softpulldown</option> (for converting soft telecine to hard telecine). |
| 1125 telecine). | 1144 </para> |
| 1126 </para> | 1145 |
| 1127 | 1146 <para> |
| 1128 <para> | 1147 In general, you want to do as little filtering as possible to the movie |
| 1129 In general, you want to do as little filtering as possible to the movie | 1148 in order to remain close to the original DVD source. Cropping is often |
| 1130 in order to remain close to the original DVD source. Cropping is often | 1149 necessary (as described above), but avoid to scale the video. Although |
| 1131 necessary (as described above), but avoid to scale the video. Although | 1150 scaling down is sometimes preferred to using higher quantizers, we want |
| 1132 scaling down is sometimes preferred to using higher quantizers, we want | 1151 to avoid both these things: remember that we decided from the start to |
| 1133 to avoid both these things: remember that we decided from the start to | 1152 trade bits for quality. |
| 1134 trade bits for quality. | 1153 </para> |
| 1135 </para> | 1154 |
| 1136 | 1155 <para> |
| 1137 <para> | 1156 Also, do not adjust gamma, contrast, brightness, etc. What looks good |
| 1138 Also, do not adjust gamma, contrast, brightness, etc. What looks good | 1157 on your display may not look good on others. These adjustments should |
| 1139 on your display may not look good on others. These adjustments should | 1158 be done on playback only. |
| 1140 be done on playback only. | 1159 </para> |
| 1141 </para> | 1160 |
| 1142 | 1161 <para> |
| 1143 <para> | 1162 One thing you might want to do, however, is pass the video through a |
| 1144 One thing you might want to do, however, is pass the video through a | 1163 very light denoise filter, such as <option>-vf hqdn3d=2:1:2</option>. |
| 1145 very light denoise filter, such as <option>-vf hqdn3d=2:1:2</option>. | 1164 Again, it is a matter of putting those bits to better use: why waste them |
| 1146 Again, it is a matter of putting those bits to better use: why waste them | 1165 encoding noise when you can just add that noise back in during playback? |
| 1147 encoding noise when you can just add that noise back in during playback? | 1166 Increasing the parameters for <option>hqdn3d</option> will further |
| 1148 Increasing the parameters for <option>hqdn3d</option> will further | 1167 improve compressibility, but if you increase the values too much, you |
| 1149 improve compressibility, but if you increase the values too much, you | 1168 risk degrading the image visibly. The suggested values above |
| 1150 risk degrading the image visibily. The suggested values above | 1169 (<option>2:1:2</option>) are quite conservative; you should feel free to |
| 1151 (<option>2:1:2</option>) are quite conservative; you should feel free to | 1170 experiment with higher values and observe the results for yourself. |
| 1152 experiment with higher values and observe the results for yourself. | 1171 </para> |
| 1153 </para> | |
| 1154 | |
| 1155 </sect2> | 1172 </sect2> |
| 1156 | 1173 |
| 1174 <!-- ********** --> | |
| 1157 | 1175 |
| 1158 <sect2 id="menc-feat-dvd-mpeg4-interlacing"> | 1176 <sect2 id="menc-feat-dvd-mpeg4-interlacing"> |
| 1159 <title>Interlacing and Telecine</title> | 1177 <title>Interlacing and Telecine</title> |
| 1160 | 1178 |
| 1161 <para> | 1179 <para> |
| 1162 Almost all movies are shot at 24 fps. Because NTSC is 30000/1001 fps, some | 1180 Almost all movies are shot at 24 fps. Because NTSC is 30000/1001 fps, some |
| 1163 processing must be done to this 24 fps video to make it run at the correct | 1181 processing must be done to this 24 fps video to make it run at the correct |
| 1164 NTSC framerate. The process is called 3:2 pulldown, commonly referred to | 1182 NTSC framerate. The process is called 3:2 pulldown, commonly referred to |
| 1165 as telecine (because pulldown is often applied during the telecine | 1183 as telecine (because pulldown is often applied during the telecine |
| 1166 process), and, naively described, it works by slowing the film down to | 1184 process), and, naively described, it works by slowing the film down to |
| 1167 24000/1001 fps, and repeating every fourth frame. | 1185 24000/1001 fps, and repeating every fourth frame. |
| 1168 </para> | 1186 </para> |
| 1169 | 1187 |
| 1170 <para> | 1188 <para> |
| 1171 No special processing, however, is done to the video for PAL DVDs, which | 1189 No special processing, however, is done to the video for PAL DVDs, which |
| 1172 run at 25 fps. (Technically, PAL can be telecined, called 2:2 pulldown, | 1190 run at 25 fps. (Technically, PAL can be telecined, called 2:2 pulldown, |
| 1173 but this does not become an issue in practice.) The 24 fps film is simply | 1191 but this does not become an issue in practice.) The 24 fps film is simply |
| 1174 played back at 25 fps. The result is that the movie runs slightly faster, | 1192 played back at 25 fps. The result is that the movie runs slightly faster, |
| 1175 but unless you are an alien, you probably will not notice the difference. | 1193 but unless you are an alien, you probably will not notice the difference. |
| 1176 Most PAL DVDs have pitch-corrected audio, so when they are played back at | 1194 Most PAL DVDs have pitch-corrected audio, so when they are played back at |
| 1177 25 fps things will sound right, even though the audio track (and hence the | 1195 25 fps things will sound right, even though the audio track (and hence the |
| 1178 whole movie) has a running time that is 4% less than NTSC DVDs. | 1196 whole movie) has a running time that is 4% less than NTSC DVDs. |
| 1179 </para> | 1197 </para> |
| 1180 | 1198 |
| 1181 <para> | 1199 <para> |
| 1182 Because the video in a PAL DVD has not been altered, you need not worry | 1200 Because the video in a PAL DVD has not been altered, you need not worry |
| 1183 much about framerate. The source is 25 fps, and your rip will be 25 | 1201 much about framerate. The source is 25 fps, and your rip will be 25 |
| 1184 fps. However, if you are ripping an NTSC DVD movie, you may need to | 1202 fps. However, if you are ripping an NTSC DVD movie, you may need to |
| 1185 apply inverse telecine. | 1203 apply inverse telecine. |
| 1186 </para> | 1204 </para> |
| 1187 | 1205 |
| 1188 <para> | 1206 <para> |
| 1189 For movies shot at 24 fps, the video on the NTSC DVD is either telecined | 1207 For movies shot at 24 fps, the video on the NTSC DVD is either telecined |
| 1190 30000/1001, or else it is progressive 24000/1001 fps and intended to be telecined | 1208 30000/1001, or else it is progressive 24000/1001 fps and intended to be |
| 1191 on-the-fly by a DVD player. On the other hand, TV series are usually | 1209 telecined on-the-fly by a DVD player. On the other hand, TV series are usually |
| 1192 only interlaced, not telecined. This is not a hard rule: some TV series | 1210 only interlaced, not telecined. This is not a hard rule: some TV series |
| 1193 are interlaced (such as Buffy the Vampire Slayer) whereas some are a | 1211 are interlaced (such as Buffy the Vampire Slayer) whereas some are a |
| 1194 mixture of progressive and interlaced (such as Angel, or 24). | 1212 mixture of progressive and interlaced (such as Angel, or 24). |
| 1195 </para> | 1213 </para> |
| 1196 | 1214 |
| 1197 <para> | 1215 <para> |
| 1198 It is highly recommended that you read the section on | 1216 It is highly recommended that you read the section on |
| 1199 <link linkend="menc-feat-telecine">How to deal with telecine and interlacing in NTSC DVDs</link> | 1217 <link linkend="menc-feat-telecine">How to deal with telecine and interlacing in NTSC DVDs</link> |
| 1200 to learn how to handle the different possibilities. | 1218 to learn how to handle the different possibilities. |
| 1201 </para> | 1219 </para> |
| 1202 | 1220 |
| 1203 <para> | 1221 <para> |
| 1204 However, if you are mostly just ripping movies, likely you are either | 1222 However, if you are mostly just ripping movies, likely you are either |
| 1205 dealing with 24 fps progressive or telecined video, in which case you can | 1223 dealing with 24 fps progressive or telecined video, in which case you can |
| 1206 use the <option>pullup</option> filter <option>-vf | 1224 use the <option>pullup</option> filter <option>-vf |
| 1207 pullup,softskip</option>. | 1225 pullup,softskip</option>. |
| 1208 </para> | 1226 </para> |
| 1209 | |
| 1210 </sect2> | 1227 </sect2> |
| 1228 | |
| 1229 <!-- ********** --> | |
| 1211 | 1230 |
| 1212 <sect2 id="menc-feat-dvd-mpeg4-encoding-interlaced"> | 1231 <sect2 id="menc-feat-dvd-mpeg4-encoding-interlaced"> |
| 1213 <title>Encoding interlaced video</title> | 1232 <title>Encoding interlaced video</title> |
| 1214 | 1233 |
| 1215 <para> | 1234 <para> |
| 1216 If the movie you want to encode is interlaced (NTSC video or | 1235 If the movie you want to encode is interlaced (NTSC video or |
| 1217 PAL video), you will need to choose whether you want to | 1236 PAL video), you will need to choose whether you want to |
| 1218 deinterlace or not. | 1237 deinterlace or not. |
| 1219 While deinterlacing will make your movie usable on progressive | 1238 While deinterlacing will make your movie usable on progressive |
| 1220 scan displays such a computer monitors and projectors, it comes | 1239 scan displays such a computer monitors and projectors, it comes |
| 1221 at a cost: The fieldrate of 50 or 60000/1001 fields per second | 1240 at a cost: The fieldrate of 50 or 60000/1001 fields per second |
| 1222 is halved to 25 or 30000/1001 frames per second, and roughly half of | 1241 is halved to 25 or 30000/1001 frames per second, and roughly half of |
| 1223 the information in your movie will be lost during scenes with | 1242 the information in your movie will be lost during scenes with |
| 1224 significant motion. | 1243 significant motion. |
| 1225 </para> | 1244 </para> |
| 1226 | 1245 |
| 1227 <para> | 1246 <para> |
| 1228 Therefore, if you are encoding for high quality archival purposes, | 1247 Therefore, if you are encoding for high quality archival purposes, |
| 1229 it is recommended not to deinterlace. | 1248 it is recommended not to deinterlace. |
| 1230 You can always deinterlace the movie at playback time when | 1249 You can always deinterlace the movie at playback time when |
| 1231 displaying it on progressive scan devices, and future players will | 1250 displaying it on progressive scan devices. |
| 1232 be able to deinterlace to full fieldrate, interpolating 50 or | 1251 The power of currently available computers forces players to use a |
| 1233 60000/1001 entire frames per second from the interlaced video. | 1252 deinterlacing filter, which results in a slight degradation in |
| 1253 image quality. | |
| 1254 But future players will be able to mimic the interlaced display of | |
| 1255 a TV, deinterlacing to full fieldrate and interpolating 50 or | |
| 1256 60000/1001 entire frames per second from the interlaced video. | |
| 1234 </para> | 1257 </para> |
| 1235 | 1258 |
| 1236 <para> | 1259 <para> |
| 1237 Special care must be taken when working with interlaced video: | 1260 Special care must be taken when working with interlaced video: |
| 1238 </para> | 1261 </para> |
| 1251 </para></listitem> | 1274 </para></listitem> |
| 1252 </orderedlist> | 1275 </orderedlist> |
| 1253 | 1276 |
| 1254 <para> | 1277 <para> |
| 1255 With these things in mind, here is our first example: | 1278 With these things in mind, here is our first example: |
| 1256 </para> | |
| 1257 <screen> | 1279 <screen> |
| 1258 mencoder <replaceable>capture.avi</replaceable> -mc 0 -oac lavc -ovc lavc -lavcopts \ | 1280 mencoder <replaceable>capture.avi</replaceable> -mc 0 -oac lavc -ovc lavc -lavcopts \ |
| 1259 vcodec=mpeg2video:vbitrate=6000:ilme:ildct:acodec=mp2:abitrate=224 | 1281 vcodec=mpeg2video:vbitrate=6000:ilme:ildct:acodec=mp2:abitrate=224 |
| 1260 </screen> | 1282 </screen> |
| 1261 <para> | |
| 1262 Note the <option>ilme</option> and <option>ildct</option> options. | 1283 Note the <option>ilme</option> and <option>ildct</option> options. |
| 1263 </para> | 1284 </para> |
| 1264 </sect2> | 1285 </sect2> |
| 1265 | 1286 |
| 1287 <!-- ********** --> | |
| 1266 | 1288 |
| 1267 <sect2 id="menc-feat-dvd-mpeg4-av-sync"> | 1289 <sect2 id="menc-feat-dvd-mpeg4-av-sync"> |
| 1268 <title>Notes on Audio/Video synchronization</title> | 1290 <title>Notes on Audio/Video synchronization</title> |
| 1291 | |
| 1269 <para> | 1292 <para> |
| 1270 <application>MEncoder</application>'s audio/video synchronization | 1293 <application>MEncoder</application>'s audio/video synchronization |
| 1271 algorithms were designed with the intention of recovering files with | 1294 algorithms were designed with the intention of recovering files with |
| 1272 broken sync. | 1295 broken sync. |
| 1273 However, in some cases they can cause unnecessary skipping and duplication of | 1296 However, in some cases they can cause unnecessary skipping and duplication of |
| 1278 the <option>-mc 0</option> option, or put this in your | 1301 the <option>-mc 0</option> option, or put this in your |
| 1279 <systemitem>~/.mplayer/mencoder</systemitem> config file, as long as | 1302 <systemitem>~/.mplayer/mencoder</systemitem> config file, as long as |
| 1280 you are only working with good sources (DVD, TV capture, high quality | 1303 you are only working with good sources (DVD, TV capture, high quality |
| 1281 MPEG-4 rips, etc) and not broken ASF/RM/MOV files. | 1304 MPEG-4 rips, etc) and not broken ASF/RM/MOV files. |
| 1282 </para> | 1305 </para> |
| 1306 | |
| 1283 <para> | 1307 <para> |
| 1284 If you want to further guard against strange frame skips and | 1308 If you want to further guard against strange frame skips and |
| 1285 duplication, you can use both <option>-mc 0</option> and | 1309 duplication, you can use both <option>-mc 0</option> and |
| 1286 <option>-noskip</option>. | 1310 <option>-noskip</option>. |
| 1287 This will prevent <emphasis>all</emphasis> A/V sync, and copy frames | 1311 This will prevent <emphasis>all</emphasis> A/V sync, and copy frames |
| 1288 one-to-one, so you cannot use it if you will be using any filters that | 1312 one-to-one, so you cannot use it if you will be using any filters that |
| 1289 unpredictably add or drop frames, or if your input file has variable | 1313 unpredictably add or drop frames, or if your input file has variable |
| 1290 framerate! | 1314 framerate! |
| 1291 Therefore, using <option>-noskip</option> is not in general recommended. | 1315 Therefore, using <option>-noskip</option> is not in general recommended. |
| 1292 </para> | 1316 </para> |
| 1293 <para> | 1317 |
| 1294 The so-called "three-pass" audio encoding which <application>MEncoder</application> | 1318 <para> |
| 1295 supports has been reported to cause A/V desync. | 1319 The so-called "three-pass" audio encoding which |
| 1320 <application>MEncoder</application> supports has been reported to cause A/V | |
| 1321 desync. | |
| 1296 This will definitely happen if it is used in conjunction with certain | 1322 This will definitely happen if it is used in conjunction with certain |
| 1297 filters, therefore, it is now recommended <emphasis>not</emphasis> to | 1323 filters, therefore, it is now recommended <emphasis>not</emphasis> to |
| 1298 use three-pass audio mode. | 1324 use three-pass audio mode. |
| 1299 This feature is only left for compatibility purposes and for expert | 1325 This feature is only left for compatibility purposes and for expert |
| 1300 users who understand when it is safe to use and when it is not. | 1326 users who understand when it is safe to use and when it is not. |
| 1301 If you have never heard of three-pass mode before, forget that we | 1327 If you have never heard of three-pass mode before, forget that we |
| 1302 even mentioned it! | 1328 even mentioned it! |
| 1303 </para> | 1329 </para> |
| 1330 | |
| 1304 <para> | 1331 <para> |
| 1305 There have also been reports of A/V desync when encoding from stdin | 1332 There have also been reports of A/V desync when encoding from stdin |
| 1306 with <application>MEncoder</application>. | 1333 with <application>MEncoder</application>. |
| 1307 Do not do this! Always use a file or CD/DVD/etc device as input. | 1334 Do not do this! Always use a file or CD/DVD/etc device as input. |
| 1308 </para> | 1335 </para> |
| 1309 </sect2> | 1336 </sect2> |
| 1310 | 1337 |
| 1338 <!-- ********** --> | |
| 1339 | |
| 1340 <sect2 id="menc-feat-dvd-mpeg4-codec"> | |
| 1341 <title>Choosing the video codec</title> | |
| 1342 | |
| 1343 <para> | |
| 1344 Which video codec is best to choose depends on several factors, | |
| 1345 like size, quality, streamability, usability and popularity, some of | |
| 1346 which widely depend on personal taste and technical constraints. | |
| 1347 </para> | |
| 1348 <itemizedlist> | |
| 1349 <listitem> | |
| 1350 <para> | |
| 1351 <emphasis role="bold">Compression efficiency</emphasis>: | |
| 1352 It is quite easy to understand that most newer-generation codecs are | |
| 1353 made to increase quality and compression. | |
| 1354 Therefore, the authors of this guide and many other people suggest that | |
| 1355 you cannot go wrong | |
| 1356 <footnote id='fn-menc-feat-dvd-mpeg4-codec-cpu'><para> | |
| 1357 Be careful, however: Decoding DVD-resolution MPEG-4 AVC videos | |
| 1358 requires a fast machine (i.e. a Pentium 4 over 1.5GHz or a Pentium M | |
| 1359 over 1GHz). | |
| 1360 </para></footnote> | |
| 1361 when choosing MPEG-4 AVC codecs like | |
| 1362 <systemitem class="library">x264</systemitem> instead of MPEG-4 ASP codecs | |
| 1363 such as <systemitem class="library">libavcodec</systemitem> MPEG-4 or | |
| 1364 <systemitem class="library">Xvid</systemitem>. | |
| 1365 (Advanced codec developers may be interested in reading Michael | |
| 1366 Niedermayer's opinion on | |
| 1367 "<ulink url="http://guru.multimedia.cx/?p=10">why MPEG4-ASP sucks</ulink>".) | |
| 1368 Likewise, you should get better quality using MPEG-4 ASP than you | |
| 1369 would with MPEG-2 codecs. | |
| 1370 </para> | |
| 1371 | |
| 1372 <para> | |
| 1373 However, newer codecs which are in heavy development can suffer from | |
| 1374 bugs which have not yet been noticed and which can ruin an encode. | |
| 1375 This is simply the tradeoff for using bleeding-edge technology. | |
| 1376 </para> | |
| 1377 | |
| 1378 <para> | |
| 1379 What is more, beginning to use a new codec requires that you spend some | |
| 1380 time becoming familiar with its options, so that you know what | |
| 1381 to adjust to achieve a desired picture quality. | |
| 1382 </para> | |
| 1383 </listitem> | |
| 1384 | |
| 1385 <listitem><para> | |
| 1386 <emphasis role="bold">Hardware compatibility</emphasis>: | |
| 1387 It usually takes a long time for standalone video players to begin to | |
| 1388 include support for the latest video codecs. | |
| 1389 As a result, most only support MPEG-1 (like VCD, XVCD and KVCD), MPEG-2 | |
| 1390 (like DVD, SVCD and KVCD) and MPEG-4 ASP (like DivX, | |
| 1391 <systemitem class="library">libavcodec</systemitem>'s LMP4 and | |
| 1392 <systemitem class="library">Xvid</systemitem>) | |
| 1393 (Beware: Usually, not all MPEG-4 ASP features are supported). | |
| 1394 Please refer to the technical specs of your player (if they are available), | |
| 1395 or google around for more information. | |
| 1396 </para></listitem> | |
| 1397 | |
| 1398 <listitem> | |
| 1399 <para> | |
| 1400 <emphasis role="bold">Best quality per encoding time</emphasis>: | |
| 1401 Codecs that have been around for some time (such as | |
| 1402 <systemitem class="library">libavcodec</systemitem> MPEG-4 and | |
| 1403 <systemitem class="library">Xvid</systemitem>) are usually heavily | |
| 1404 optimized with all kinds of smart algorithms and SIMD assembly code. | |
| 1405 That is why they tend to yield the best quality per encoding time ratio. | |
| 1406 However, they may have some very advanced options that, if enabled, | |
| 1407 will make the encode really slow for marginal gains. | |
| 1408 </para> | |
| 1409 | |
| 1410 <para> | |
| 1411 If you are after blazing speed you should stick around the default | |
| 1412 settings of the video codec (although you should still try the other | |
| 1413 options which are mentioned in other sections of this guide). | |
| 1414 </para> | |
| 1415 | |
| 1416 <para> | |
| 1417 You may also consider choosing a codec which can do multi-threaded | |
| 1418 processing, though this is only useful for users of machines with | |
| 1419 several CPUs. | |
| 1420 <systemitem class="library">libavcodec</systemitem> MPEG-4 does | |
| 1421 allow that, but speed gains are limited, and there is a slight | |
| 1422 negative effect on picture quality. | |
| 1423 <systemitem class="library">Xvid</systemitem>'s multi-threaded encoding, | |
| 1424 activated by the <option>threads</option> option, can be used to | |
| 1425 boost encoding speed — by about 40-60% in typical cases — | |
| 1426 with little if any picture degradation. | |
| 1427 <systemitem class="library">x264</systemitem> also allows multi-threaded | |
| 1428 encoding, which currently speeds up encoding by 94% per CPU core while | |
| 1429 lowering PSNR between 0.005dB and 0.01dB on a typical setup. | |
| 1430 </para> | |
| 1431 </listitem> | |
| 1432 | |
| 1433 <listitem> | |
| 1434 <para> | |
| 1435 <emphasis role="bold">Personal taste</emphasis>: | |
| 1436 This is where it gets almost irrational: For the same reason that some | |
| 1437 hung on to DivX 3 for years when newer codecs were already doing wonders, | |
| 1438 some folks will prefer <systemitem class="library">Xvid</systemitem> | |
| 1439 or <systemitem class="library">libavcodec</systemitem> MPEG-4 over | |
| 1440 <systemitem class="library">x264</systemitem>. | |
| 1441 </para> | |
| 1442 <para> | |
| 1443 You should make your own judgement; do not take advice from people who | |
| 1444 swear by one codec. | |
| 1445 Take a few sample clips from raw sources and compare different | |
| 1446 encoding options and codecs to find one that suits you best. | |
| 1447 The best codec is the one you master, and the one that looks | |
| 1448 best to your eyes on your display | |
| 1449 <footnote id='fn-menc-feat-dvd-mpeg4-codec-playback'><para> | |
| 1450 The same encode may not look the same on someone else's monitor or | |
| 1451 when played back by a different decoder, so future-proof your encodes by | |
| 1452 playing them back on different setups. | |
| 1453 </para></footnote>! | |
| 1454 </para> | |
| 1455 </listitem> | |
| 1456 </itemizedlist> | |
| 1457 | |
| 1458 <para> | |
| 1459 Please refer to the section | |
| 1460 <link linkend="menc-feat-selecting-codec">selecting codecs and container formats</link> | |
| 1461 to get a list of supported codecs. | |
| 1462 </para> | |
| 1463 </sect2> | |
| 1464 | |
| 1465 <!-- ********** --> | |
| 1466 | |
| 1311 <sect2 id="menc-feat-dvd-mpeg4-audio"> | 1467 <sect2 id="menc-feat-dvd-mpeg4-audio"> |
| 1312 <title>Audio</title> | 1468 <title>Audio</title> |
| 1313 | 1469 |
| 1314 <para> | 1470 <para> |
| 1315 Audio is a much simpler problem to solve: if you care about quality, just | 1471 Audio is a much simpler problem to solve: if you care about quality, just |
| 1316 leave it as is. | 1472 leave it as is. |
| 1317 Even AC3 5.1 streams are at most 448Kbit/s, and they are worth every bit. | 1473 Even AC-3 5.1 streams are at most 448Kbit/s, and they are worth every bit. |
| 1318 You might be tempted to transcode the audio to high quality Vorbis, but | 1474 You might be tempted to transcode the audio to high quality Vorbis, but |
| 1319 just because you do not have an A/V receiver for AC3 pass-through today | 1475 just because you do not have an A/V receiver for AC-3 pass-through today |
| 1320 does not mean you will not have one tomorrow. Future-proof your DVD rips by | 1476 does not mean you will not have one tomorrow. Future-proof your DVD rips by |
| 1321 preserving the AC3 stream. | 1477 preserving the AC-3 stream. |
| 1322 You can keep the AC3 stream either by copying it directly into the video | 1478 You can keep the AC-3 stream either by copying it directly into the video |
| 1323 stream <link linkend="menc-feat-mpeg4">during the encoding</link>. | 1479 stream <link linkend="menc-feat-mpeg4">during the encoding</link>. |
| 1324 You can also extract the AC3 stream in order to mux it into containers such | 1480 You can also extract the AC-3 stream in order to mux it into containers such |
| 1325 as NUT or Matroska. | 1481 as NUT or Matroska. |
| 1326 <screen>mplayer <replaceable>source_file.vob</replaceable> -aid 129 -dumpaudio -dumpfile <replaceable>sound.ac3</replaceable></screen> | 1482 <screen> |
| 1327 will dump into the file <replaceable>sound.ac3</replaceable> the | 1483 mplayer <replaceable>source_file.vob</replaceable> -aid 129 -dumpaudio -dumpfile <replaceable>sound.ac3</replaceable> |
| 1328 audio track number 129 from the file | 1484 </screen> |
| 1329 <replaceable>source_file.vob</replaceable> (NB: DVD VOB files | 1485 will dump into the file <replaceable>sound.ac3</replaceable> the |
| 1330 usually use a different audio numbering, | 1486 audio track number 129 from the file |
| 1331 which means that the VOB audio track 129 is the 2nd audio track of the file). | 1487 <replaceable>source_file.vob</replaceable> (NB: DVD VOB files |
| 1332 </para> | 1488 usually use a different audio numbering, |
| 1333 | 1489 which means that the VOB audio track 129 is the 2nd audio track of the file). |
| 1334 <para> | 1490 </para> |
| 1335 But sometimes you truly have no choice but to further compress the | 1491 |
| 1336 sound so that more bits can be spent on the video. | 1492 <para> |
| 1337 Most people choose to compress audio with either MP3 or Vorbis audio | 1493 But sometimes you truly have no choice but to further compress the |
| 1338 codecs. | 1494 sound so that more bits can be spent on the video. |
| 1339 While the latter is a very space-efficient codec, MP3 is better supported | 1495 Most people choose to compress audio with either MP3 or Vorbis audio codecs. |
| 1340 by hardware players, although this trend is changing. | 1496 While the latter is a very space-efficient codec, MP3 is better supported |
| 1341 </para> | 1497 by hardware players, although this trend is changing. |
| 1342 | 1498 </para> |
| 1343 <para> | 1499 |
| 1344 Do <emphasis>not</emphasis> use <option>-nosound</option> when encoding | 1500 <para> |
| 1345 a file with audio, even if you will be encoding and muxing audio | 1501 Do <emphasis>not</emphasis> use <option>-nosound</option> when encoding |
| 1346 separately later. | 1502 a file with audio, even if you will be encoding and muxing audio |
| 1347 Though it may work in ideal cases, using <option>-nosound</option> is | 1503 separately later. |
| 1348 likely to hide some problems in your encoding command line setting. | 1504 Though it may work in ideal cases, using <option>-nosound</option> is |
| 1349 In other words, having a soundtrack during your encode assures you that, | 1505 likely to hide some problems in your encoding command line setting. |
| 1350 provided you do not see messages such as | 1506 In other words, having a soundtrack during your encode assures you that, |
| 1351 <quote>Too many audio packets in the buffer</quote>, you will be able | 1507 provided you do not see messages such as |
| 1352 to get proper sync. | 1508 <quote>Too many audio packets in the buffer</quote>, you will be able |
| 1353 </para> | 1509 to get proper sync. |
| 1354 | 1510 </para> |
| 1355 <para> | 1511 |
| 1356 You need to have <application>MEncoder</application> process the sound. | 1512 <para> |
| 1357 You can for example copy the orignal soundtrack during the encode with | 1513 You need to have <application>MEncoder</application> process the sound. |
| 1358 <option>-oac copy</option> or convert it to a "light" 4 kHz mono WAV | 1514 You can for example copy the original soundtrack during the encode with |
| 1359 PCM with <option>-oac pcm -channels 1 -srate 4000</option>. | 1515 <option>-oac copy</option> or convert it to a "light" 4 kHz mono WAV |
| 1360 Otherwise, in some cases, it will generate a video file that will not sync | 1516 PCM with <option>-oac pcm -channels 1 -srate 4000</option>. |
| 1361 with the audio. | 1517 Otherwise, in some cases, it will generate a video file that will not sync |
| 1362 Such cases are when the number of video frames in the source file does | 1518 with the audio. |
| 1363 not match up to the total length of audio frames or whenever there | 1519 Such cases are when the number of video frames in the source file does |
| 1364 are discontinuities/splices where there are missing or extra audio frames. | 1520 not match up to the total length of audio frames or whenever there |
| 1365 The correct way to handle this kind of problem is to insert silence or | 1521 are discontinuities/splices where there are missing or extra audio frames. |
| 1366 cut audio at these points. | 1522 The correct way to handle this kind of problem is to insert silence or |
| 1367 However <application>MPlayer</application> cannot do that, so if you | 1523 cut audio at these points. |
| 1368 demux the AC3 audio and encode it with a separate app (or dump it to PCM with | 1524 However <application>MPlayer</application> cannot do that, so if you |
| 1369 <application>MPlayer</application>), the splices will be left incorrect | 1525 demux the AC-3 audio and encode it with a separate app (or dump it to PCM with |
| 1370 and the only way to correct them is to drop/dup video frames at the | 1526 <application>MPlayer</application>), the splices will be left incorrect |
| 1371 splice. | 1527 and the only way to correct them is to drop/duplicate video frames at the |
| 1372 As long as <application>MEncoder</application> sees the audio when it is | 1528 splice. |
| 1373 encoding the video, it can do this dropping/duping (which is usually OK | 1529 As long as <application>MEncoder</application> sees the audio when it is |
| 1374 since it takes place at full black/scenechange, but if | 1530 encoding the video, it can do this dropping/duping (which is usually OK |
| 1375 <application>MEncoder</application> cannot see the audio, it will just | 1531 since it takes place at full black/scene change), but if |
| 1376 process all frames as-is and they will not fit the final audio stream when | 1532 <application>MEncoder</application> cannot see the audio, it will just |
| 1377 you for example merge your audio and video track into a Matroska file. | 1533 process all frames as-is and they will not fit the final audio stream when |
| 1378 </para> | 1534 you for example merge your audio and video track into a Matroska file. |
| 1379 | 1535 </para> |
| 1380 <para> | 1536 |
| 1381 First of all, you will have to convert the DVD sound into a WAV file that the | 1537 <para> |
| 1382 audio codec can use as input. | 1538 First of all, you will have to convert the DVD sound into a WAV file that the |
| 1383 For example: | 1539 audio codec can use as input. |
| 1384 <screen>mplayer <replaceable>source_file.vob</replaceable> -ao pcm:file=<replaceable>destination_sound.wav</replaceable> -vc dummy -aid 1 -vo null</screen> | 1540 For example: |
| 1385 will dump the second audio track from the file | 1541 <screen> |
| 1386 <replaceable>source_file.vob</replaceable> into the file | 1542 mplayer <replaceable>source_file.vob</replaceable> -ao pcm:file=<replaceable>destination_sound.wav</replaceable> \ |
| 1387 <replaceable>destination_sound.wav</replaceable>. | 1543 -vc dummy -aid 1 -vo null |
| 1388 You may want to normalize the sound before encoding, as DVD audio tracks | 1544 </screen> |
| 1389 are commonly recorded at low volumes. | 1545 will dump the second audio track from the file |
| 1390 You can use the tool <application>normalize</application> for instance, | 1546 <replaceable>source_file.vob</replaceable> into the file |
| 1391 which is available in most distributions. | 1547 <replaceable>destination_sound.wav</replaceable>. |
| 1392 If you are using Windows, a tool such as <application>BeSweet</application> | 1548 You may want to normalize the sound before encoding, as DVD audio tracks |
| 1393 can do the same job. | 1549 are commonly recorded at low volumes. |
| 1394 You will compress in either Vorbis or MP3. | 1550 You can use the tool <application>normalize</application> for instance, |
| 1395 For example: | 1551 which is available in most distributions. |
| 1396 <screen>oggenc -q1 <replaceable>destination_sound.wav</replaceable></screen> | 1552 If you are using Windows, a tool such as <application>BeSweet</application> |
| 1397 will encode <replaceable>destination_sound.wav</replaceable> with | 1553 can do the same job. |
| 1398 the encoding quality 1, which is roughly equivalent to 80Kb/s, and | 1554 You will compress in either Vorbis or MP3. |
| 1399 is the minimum quality at which you should encode if you care about | 1555 For example: |
| 1400 quality. | 1556 <screen>oggenc -q1 <replaceable>destination_sound.wav</replaceable></screen> |
| 1401 Please note that MEncoder currently cannot mux Vorbis audio tracks | 1557 will encode <replaceable>destination_sound.wav</replaceable> with |
| 1402 into the output file because it only supports AVI and MPEG | 1558 the encoding quality 1, which is roughly equivalent to 80Kb/s, and |
| 1403 containers as an output, each of which may lead to audio/video | 1559 is the minimum quality at which you should encode if you care about |
| 1404 playback synchronization problems with some players when the AVI file | 1560 quality. |
| 1405 contain VBR audio streams such as Vorbis. | 1561 Please note that <application>MEncoder</application> currently cannot |
| 1406 Do not worry, this document will show you how you can do that with third | 1562 mux Vorbis audio tracks |
| 1407 party programs. | 1563 into the output file because it only supports AVI and MPEG |
| 1408 </para> | 1564 containers as an output, each of which may lead to audio/video |
| 1409 | 1565 playback synchronization problems with some players when the AVI file |
| 1566 contain VBR audio streams such as Vorbis. | |
| 1567 Do not worry, this document will show you how you can do that with third | |
| 1568 party programs. | |
| 1569 </para> | |
| 1410 </sect2> | 1570 </sect2> |
| 1411 | 1571 |
| 1572 <!-- ********** --> | |
| 1412 | 1573 |
| 1413 <sect2 id="menc-feat-dvd-mpeg4-muxing"> | 1574 <sect2 id="menc-feat-dvd-mpeg4-muxing"> |
| 1414 <title>Muxing</title> | 1575 <title>Muxing</title> |
| 1415 <para> | 1576 |
| 1416 Now that you have encoded your video, you will most likely want | 1577 <para> |
| 1417 to mux it with one or more audio tracks into a movie container, such | 1578 Now that you have encoded your video, you will most likely want |
| 1418 as AVI, MPEG, Matroska or NUT. | 1579 to mux it with one or more audio tracks into a movie container, such |
| 1419 <application>MEncoder</application> is currently only able to natively output | 1580 as AVI, MPEG, Matroska or NUT. |
| 1420 audio and video into MPEG and AVI container formats. | 1581 <application>MEncoder</application> is currently only able to natively output |
| 1421 for example: | 1582 audio and video into MPEG and AVI container formats. |
| 1422 <screen>mencoder -oac copy -ovc copy -o <replaceable>output_movie.avi</replaceable> -audiofile <replaceable>input_audio.mp2</replaceable> <replaceable>input_video.avi</replaceable></screen> | 1583 for example: |
| 1423 This would merge the video file <replaceable>input_video.avi</replaceable> | 1584 <screen> |
| 1424 and the audio file <replaceable>input_audio.mp2</replaceable> | 1585 mencoder -oac copy -ovc copy -o <replaceable>output_movie.avi</replaceable> \ |
| 1425 into the AVI file <replaceable>output_movie.avi</replaceable>. | 1586 -audiofile <replaceable>input_audio.mp2</replaceable> <replaceable>input_video.avi</replaceable> |
| 1426 This command works with MPEG-1 layer I, II and III (more commonly known | 1587 </screen> |
| 1427 as MP3) audio, WAV and a few other audio formats too. | 1588 This would merge the video file <replaceable>input_video.avi</replaceable> |
| 1428 </para> | 1589 and the audio file <replaceable>input_audio.mp2</replaceable> |
| 1429 | 1590 into the AVI file <replaceable>output_movie.avi</replaceable>. |
| 1430 <para> | 1591 This command works with MPEG-1 layer I, II and III (more commonly known |
| 1431 MEncoder features experimental support for | 1592 as MP3) audio, WAV and a few other audio formats too. |
| 1432 <systemitem class="library">libavformat</systemitem>, which is a | 1593 </para> |
| 1433 library from the FFmpeg project that supports muxing and demuxing | 1594 |
| 1434 a variety of containers. | 1595 <para> |
| 1435 For example: | 1596 <application>MEncoder</application> features experimental support for |
| 1436 <screen>mencoder -oac copy -ovc copy -o <replaceable>output_movie.asf</replaceable> -audiofile <replaceable>input_audio.mp2</replaceable> <replaceable>input_video.avi</replaceable> -of lavf -lavfopts format=asf</screen> | 1597 <systemitem class="library">libavformat</systemitem>, which is a |
| 1437 This will do the same thing as the previous example, except that | 1598 library from the FFmpeg project that supports muxing and demuxing |
| 1438 the output container will be ASF. | 1599 a variety of containers. |
| 1439 Please note that this support is highly experimental (but getting | 1600 For example: |
| 1440 better every day), and will only work if you compiled | 1601 <screen> |
| 1441 <application>MPlayer</application> with the support for | 1602 mencoder -oac copy -ovc copy -o <replaceable>output_movie.asf</replaceable> -audiofile <replaceable>input_audio.mp2</replaceable> \ |
| 1442 <systemitem class="library">libavformat</systemitem> enabled (which | 1603 <replaceable>input_video.avi</replaceable> -of lavf -lavfopts format=asf |
| 1443 means that a pre-packaged binary version will not work in most cases). | 1604 </screen> |
| 1605 This will do the same thing as the previous example, except that | |
| 1606 the output container will be ASF. | |
| 1607 Please note that this support is highly experimental (but getting | |
| 1608 better every day), and will only work if you compiled | |
| 1609 <application>MPlayer</application> with the support for | |
| 1610 <systemitem class="library">libavformat</systemitem> enabled (which | |
| 1611 means that a pre-packaged binary version will not work in most cases). | |
| 1444 </para> | 1612 </para> |
| 1445 | 1613 |
| 1446 | 1614 |
| 1447 <sect3 id="menc-feat-dvd-mpeg4-muxing-filter-issues"> | 1615 <sect3 id="menc-feat-dvd-mpeg4-muxing-filter-issues"> |
| 1448 <title>Improving muxing and A/V sync reliability</title> | 1616 <title>Improving muxing and A/V sync reliability</title> |
| 1449 <para> | 1617 |
| 1450 You may experience some serious A/V sync problems while trying to mux | 1618 <para> |
| 1451 your video and some audio tracks, where no matter how you adjust the | 1619 You may experience some serious A/V sync problems while trying to mux |
| 1452 audio delay, you will never get proper sync. | 1620 your video and some audio tracks, where no matter how you adjust the |
| 1453 That may happen when you use some video filters that will drop or | 1621 audio delay, you will never get proper sync. |
| 1454 duplicate some frames, like the inverse telecine filters. | 1622 That may happen when you use some video filters that will drop or |
| 1455 It is strongly encouraged to append the <option>harddup</option> video | 1623 duplicate some frames, like the inverse telecine filters. |
| 1456 filter at the end of the filter chain to avoid this kind of problem. | 1624 It is strongly encouraged to append the <option>harddup</option> video |
| 1457 </para> | 1625 filter at the end of the filter chain to avoid this kind of problem. |
| 1458 | 1626 </para> |
| 1459 <para> | 1627 |
| 1460 Without <option>harddup</option>, if <application>MEncoder</application> | 1628 <para> |
| 1461 wants to duplicate a frame, it relies on the muxer to put a mark on the | 1629 Without <option>harddup</option>, if <application>MEncoder</application> |
| 1462 container so that the last frame will be displayed again to maintain | 1630 wants to duplicate a frame, it relies on the muxer to put a mark on the |
| 1463 sync while writing no actual frame. | 1631 container so that the last frame will be displayed again to maintain |
| 1464 With <option>harddup</option>, <application>MEncoder</application> | 1632 sync while writing no actual frame. |
| 1465 will instead just push the last frame displayed again into the filter | 1633 With <option>harddup</option>, <application>MEncoder</application> |
| 1466 chain. | 1634 will instead just push the last frame displayed again into the filter |
| 1467 This means that the encoder receives the <emphasis>exact</emphasis> | 1635 chain. |
| 1468 same frame twice, and compresses it. | 1636 This means that the encoder receives the <emphasis>exact</emphasis> |
| 1469 This will result in a slightly bigger file, but will not cause problems | 1637 same frame twice, and compresses it. |
| 1470 when demuxing or remuxing into other container formats. | 1638 This will result in a slightly bigger file, but will not cause problems |
| 1471 </para> | 1639 when demuxing or remuxing into other container formats. |
| 1472 | 1640 </para> |
| 1473 <para> | 1641 |
| 1474 You may also have no choice but to use <option>harddup</option> with | 1642 <para> |
| 1475 container formats that are not too tightly linked with | 1643 You may also have no choice but to use <option>harddup</option> with |
| 1476 <application>MEncoder</application> such as the ones supported through | 1644 container formats that are not too tightly linked with |
| 1477 <systemitem class="library">libavformat</systemitem>, which may not | 1645 <application>MEncoder</application> such as the ones supported through |
| 1478 support frame duplication at the container level. | 1646 <systemitem class="library">libavformat</systemitem>, which may not |
| 1647 support frame duplication at the container level. | |
| 1479 </para> | 1648 </para> |
| 1480 </sect3> | 1649 </sect3> |
| 1481 | 1650 |
| 1482 | 1651 |
| 1483 <sect3 id="menc-feat-dvd-mpeg4-muxing-avi-limitations"> | 1652 <sect3 id="menc-feat-dvd-mpeg4-muxing-avi-limitations"> |
| 1484 <title>Limitations of the AVI container</title> | 1653 <title>Limitations of the AVI container</title> |
| 1485 <para> | 1654 |
| 1486 Although it is the most widely-supported container format after MPEG-1, | 1655 <para> |
| 1487 AVI also has some major drawbacks. | 1656 Although it is the most widely-supported container format after MPEG-1, |
| 1488 Perhaps the most obvious is the overhead. | 1657 AVI also has some major drawbacks. |
| 1489 For each chunk of the AVI file, 24 bytes are wasted on headers and | 1658 Perhaps the most obvious is the overhead. |
| 1490 index. | 1659 For each chunk of the AVI file, 24 bytes are wasted on headers and index. |
| 1491 This translates into a little over 5 MB per hour, or 1-2.5% | 1660 This translates into a little over 5 MB per hour, or 1-2.5% |
| 1492 overhead for a 700 MB movie. This may not seem like much, but it could | 1661 overhead for a 700 MB movie. This may not seem like much, but it could |
| 1493 mean the difference between being able to use 700 kbit/sec video or | 1662 mean the difference between being able to use 700 kbit/sec video or |
| 1494 714 kbit/sec, and every bit of quality counts. | 1663 714 kbit/sec, and every bit of quality counts. |
| 1495 </para> | 1664 </para> |
| 1496 | 1665 |
| 1497 <para> | 1666 <para> |
| 1498 In addition this gross inefficiency, AVI also has the following major | 1667 In addition this gross inefficiency, AVI also has the following major |
| 1499 limitations: | 1668 limitations: |
| 1500 </para> | 1669 </para> |
| 1501 | 1670 |
| 1502 <orderedlist> | 1671 <orderedlist> |
| 1503 <listitem> | 1672 <listitem><para> |
| 1504 <para> | |
| 1505 Only fixed-fps content can be stored. This is particularly limiting | 1673 Only fixed-fps content can be stored. This is particularly limiting |
| 1506 if the original material you want to encode is mixed content, for | 1674 if the original material you want to encode is mixed content, for |
| 1507 example a mix of NTSC video and film material. | 1675 example a mix of NTSC video and film material. |
| 1508 Actually there are hacks that can be used to store mixed-framerate | 1676 Actually there are hacks that can be used to store mixed-framerate |
| 1509 content in AVI, but they increase the (already huge) overhead | 1677 content in AVI, but they increase the (already huge) overhead |
| 1510 fivefold or more and so are not practical. | 1678 fivefold or more and so are not practical. |
| 1511 </para> | 1679 </para></listitem> |
| 1512 </listitem> | 1680 <listitem><para> |
| 1513 <listitem> | |
| 1514 <para> | |
| 1515 Audio in AVI files must be either constant-bitrate (CBR) or | 1681 Audio in AVI files must be either constant-bitrate (CBR) or |
| 1516 constant-framesize (i.e. all frames decode to the same number of | 1682 constant-framesize (i.e. all frames decode to the same number of |
| 1517 samples). | 1683 samples). |
| 1518 Unfortunately, the most efficient codec, Vorbis, does not meet | 1684 Unfortunately, the most efficient codec, Vorbis, does not meet |
| 1519 either of these requirements. | 1685 either of these requirements. |
| 1520 Therefore, if you plan to store your movie in AVI, you will have to | 1686 Therefore, if you plan to store your movie in AVI, you will have to |
| 1521 use a less efficient codec such as MP3 or AC3. | 1687 use a less efficient codec such as MP3 or AC-3. |
| 1522 </para> | 1688 </para></listitem> |
| 1523 </listitem> | |
| 1524 </orderedlist> | 1689 </orderedlist> |
| 1525 | 1690 |
| 1526 <para> | 1691 <para> |
| 1527 Having said all that, <application>MEncoder</application> does not | 1692 Having said all that, <application>MEncoder</application> does not |
| 1528 currently support variable-fps output or Vorbis encoding. | 1693 currently support variable-fps output or Vorbis encoding. |
| 1529 Therefore, you may not see these as limitations if | 1694 Therefore, you may not see these as limitations if |
| 1530 <application>MEncoder</application> is the | 1695 <application>MEncoder</application> is the |
| 1531 only tool you will be using to produce your encodes. | 1696 only tool you will be using to produce your encodes. |
| 1532 However, it is possible to use <application>MEncoder</application> | 1697 However, it is possible to use <application>MEncoder</application> |
| 1533 only for video encoding, and then use external tools to encode | 1698 only for video encoding, and then use external tools to encode |
| 1534 audio and mux it into another container format. | 1699 audio and mux it into another container format. |
| 1535 </para> | 1700 </para> |
| 1536 </sect3> | 1701 </sect3> |
| 1702 | |
| 1537 | 1703 |
| 1538 <sect3 id="menc-feat-dvd-mpeg4-muxing-matroska"> | 1704 <sect3 id="menc-feat-dvd-mpeg4-muxing-matroska"> |
| 1539 <title>Muxing into the Matroska container</title> | 1705 <title>Muxing into the Matroska container</title> |
| 1540 <para> | 1706 |
| 1541 Matroska is a free, open standard container format, aiming | 1707 <para> |
| 1542 to offer a lot of advanced features, which older containers | 1708 Matroska is a free, open standard container format, aiming |
| 1543 like AVI cannot handle. | 1709 to offer a lot of advanced features, which older containers |
| 1544 For example, Matroska supports variable bitrate audio content | 1710 like AVI cannot handle. |
| 1545 (VBR), variable framerates (VFR), chapters, file attachments, | 1711 For example, Matroska supports variable bitrate audio content |
| 1546 error detection code (EDC) and modern A/V Codecs like "Advanced Audio | 1712 (VBR), variable framerates (VFR), chapters, file attachments, |
| 1547 Coding" (AAC), "Vorbis" or "MPEG-4 AVC" (H.264), next to nothing | 1713 error detection code (EDC) and modern A/V Codecs like "Advanced Audio |
| 1548 handled by AVI. | 1714 Coding" (AAC), "Vorbis" or "MPEG-4 AVC" (H.264), next to nothing |
| 1549 </para> | 1715 handled by AVI. |
| 1550 | 1716 </para> |
| 1551 <para> | 1717 |
| 1552 The tools required to create Matroska files are collectively called | 1718 <para> |
| 1553 <application>mkvtoolnix</application>, and are available for most | 1719 The tools required to create Matroska files are collectively called |
| 1554 Unix platforms as well as <application>Windows</application>. | 1720 <application>mkvtoolnix</application>, and are available for most |
| 1555 Because Matroska is an open standard you may find other | 1721 Unix platforms as well as <application>Windows</application>. |
| 1556 tools that suit you better, but since mkvtoolnix is the most | 1722 Because Matroska is an open standard you may find other |
| 1557 common, and is supported by the Matroska team itself, we will | 1723 tools that suit you better, but since mkvtoolnix is the most |
| 1558 only cover its usage. | 1724 common, and is supported by the Matroska team itself, we will |
| 1559 </para> | 1725 only cover its usage. |
| 1560 | 1726 </para> |
| 1561 <para> | 1727 |
| 1562 Probably the easiest way to get started with Matroska is to use | 1728 <para> |
| 1563 <application>MMG</application>, the graphical frontend shipped with | 1729 Probably the easiest way to get started with Matroska is to use |
| 1564 <application>mkvtoolnix</application>, and follow the | 1730 <application>MMG</application>, the graphical frontend shipped with |
| 1565 <ulink url="http://www.bunkus.org/videotools/mkvtoolnix/doc/mkvmerge-gui.html">guide to mkvmerge GUI (mmg)</ulink> | 1731 <application>mkvtoolnix</application>, and follow the |
| 1566 </para> | 1732 <ulink url="http://www.bunkus.org/videotools/mkvtoolnix/doc/mkvmerge-gui.html">guide to mkvmerge GUI (mmg)</ulink> |
| 1567 | 1733 </para> |
| 1568 <para> | 1734 |
| 1569 You may also mux audio and video files using the command line: | 1735 <para> |
| 1570 <screen>mkvmerge -o <replaceable>output.mkv</replaceable> <replaceable>input_video.avi</replaceable> <replaceable>input_audio1.mp3</replaceable> <replaceable>input_audio2.ac3</replaceable></screen> | 1736 You may also mux audio and video files using the command line: |
| 1571 This would merge the video file <replaceable>input_video.avi</replaceable> | 1737 <screen> |
| 1572 and the two audio files <replaceable>input_audio1.mp3</replaceable> | 1738 mkvmerge -o <replaceable>output.mkv</replaceable> <replaceable>input_video.avi</replaceable> <replaceable>input_audio1.mp3</replaceable> <replaceable>input_audio2.ac3</replaceable> |
| 1573 and <replaceable>input_audio2.ac3</replaceable> into the Matroska | 1739 </screen> |
| 1574 file <replaceable>output.mkv</replaceable>. | 1740 This would merge the video file <replaceable>input_video.avi</replaceable> |
| 1575 Matroska, as mentioned earlier, is able to do much more than that, like | 1741 and the two audio files <replaceable>input_audio1.mp3</replaceable> |
| 1576 multiple audio tracks (including fine-tuning of audio/video | 1742 and <replaceable>input_audio2.ac3</replaceable> into the Matroska |
| 1577 synchronization), chapters, subtitles, splitting, etc... | 1743 file <replaceable>output.mkv</replaceable>. |
| 1578 Please refer to the documentation of those applications for | 1744 Matroska, as mentioned earlier, is able to do much more than that, like |
| 1579 more details. | 1745 multiple audio tracks (including fine-tuning of audio/video |
| 1580 </para> | 1746 synchronization), chapters, subtitles, splitting, etc... |
| 1581 | 1747 Please refer to the documentation of those applications for |
| 1748 more details. | |
| 1749 </para> | |
| 1582 </sect3> | 1750 </sect3> |
| 1583 | |
| 1584 </sect2> | 1751 </sect2> |
| 1585 | |
| 1586 </sect1> | 1752 </sect1> |
| 1753 | |
| 1754 | |
| 1755 <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - --> | |
| 1756 | |
| 1587 | 1757 |
| 1588 <sect1 id="menc-feat-telecine"> | 1758 <sect1 id="menc-feat-telecine"> |
| 1589 <title>How to deal with telecine and interlacing within NTSC DVDs</title> | 1759 <title>How to deal with telecine and interlacing within NTSC DVDs</title> |
| 1590 | 1760 |
| 1591 <sect2 id="menc-feat-telecine-intro"> | 1761 <sect2 id="menc-feat-telecine-intro"> |
| 1592 <title>Introduction</title> | 1762 <title>Introduction</title> |
| 1763 | |
| 1593 <formalpara> | 1764 <formalpara> |
| 1594 <title>What is telecine?</title> | 1765 <title>What is telecine?</title> |
| 1595 <para> | 1766 <para> |
| 1596 I suggest you visit this page if you do not understand much of what | 1767 If you do not understand much of what is written in this document, read the |
| 1597 is written in this document: | 1768 <ulink url="http://en.wikipedia.org/wiki/Telecine">Wikipedia entry on telecine</ulink>. |
| 1598 <ulink url="http://www.divx.com/support/guides/guide.php?gid=10">http://www.divx.com/support/guides/guide.php?gid=10</ulink> | 1769 It is an understandable and reasonably comprehensive |
| 1599 This URL links to an understandable and reasonably comprehensive | 1770 description of what telecine is. |
| 1600 description of what telecine is. | |
| 1601 </para></formalpara> | 1771 </para></formalpara> |
| 1602 | 1772 |
| 1603 <formalpara> | 1773 <formalpara> |
| 1604 <title>A note about the numbers.</title> | 1774 <title>A note about the numbers.</title> |
| 1605 <para> | 1775 <para> |
| 1606 Many documents, including the guide linked above, refer to the fields | 1776 Many documents, including the article linked above, refer to the fields |
| 1607 per second value of NTSC video as 59.94 and the corresponding frames | 1777 per second value of NTSC video as 59.94 and the corresponding frames |
| 1608 per second values as 29.97 (for telecined and interlaced) and 23.976 | 1778 per second values as 29.97 (for telecined and interlaced) and 23.976 |
| 1609 (for progressive). For simplicity, some documents even round these | 1779 (for progressive). For simplicity, some documents even round these |
| 1610 numbers to 60, 30, and 24. | 1780 numbers to 60, 30, and 24. |
| 1611 </para></formalpara> | 1781 </para></formalpara> |
| 1612 | 1782 |
| 1613 <para> | 1783 <para> |
| 1614 Strictly speaking, all those numbers are approximations. Black and | 1784 Strictly speaking, all those numbers are approximations. Black and |
| 1615 white NTSC video was exactly 60 fields per second, but 60000/1001 | 1785 white NTSC video was exactly 60 fields per second, but 60000/1001 |
| 1616 was later chosen to accomodate color data while remaining compatible | 1786 was later chosen to accommodate color data while remaining compatible |
| 1617 with contemporary black and white televisions. Digital NTSC video | 1787 with contemporary black and white televisions. Digital NTSC video |
| 1618 (such as on a DVD) is also 60000/1001 fields per second. From this, | 1788 (such as on a DVD) is also 60000/1001 fields per second. From this, |
| 1619 interlaced and telecined video are derived to be 30000/1001 frames | 1789 interlaced and telecined video are derived to be 30000/1001 frames |
| 1620 per second; progressive video is 24000/1001 frames per second. | 1790 per second; progressive video is 24000/1001 frames per second. |
| 1621 </para> | 1791 </para> |
| 1622 | 1792 |
| 1623 <para> | 1793 <para> |
| 1624 Older versions of the <application>MEncoder</application> documentation | 1794 Older versions of the <application>MEncoder</application> documentation |
| 1625 and many archived mailing list posts refer to 59.94, 29.97, and 23.976. | 1795 and many archived mailing list posts refer to 59.94, 29.97, and 23.976. |
| 1626 All <application>MEncoder</application> documentation has been updated | 1796 All <application>MEncoder</application> documentation has been updated |
| 1627 to use the fractional values, and you should use them too. | 1797 to use the fractional values, and you should use them too. |
| 1628 </para> | 1798 </para> |
| 1629 | 1799 |
| 1630 <para> | 1800 <para> |
| 1631 <option>-ofps 23.976</option> is incorrect. | 1801 <option>-ofps 23.976</option> is incorrect. |
| 1632 <option>-ofps 24000/1001</option> should be used instead. | 1802 <option>-ofps 24000/1001</option> should be used instead. |
| 1633 </para> | 1803 </para> |
| 1634 | 1804 |
| 1635 <formalpara> | 1805 <formalpara> |
| 1636 <title>How telecine is used.</title> | 1806 <title>How telecine is used.</title> |
| 1637 <para> | 1807 <para> |
| 1638 All video intended to be displayed on an NTSC | 1808 All video intended to be displayed on an NTSC |
| 1639 television set must be 60000/1001 fields per second. Made-for-TV movies | 1809 television set must be 60000/1001 fields per second. Made-for-TV movies |
| 1640 4 and shows are often filmed directly at 60000/1001 fields per second, but | 1810 and shows are often filmed directly at 60000/1001 fields per second, but |
| 1641 the majority of cinema is filmed at 24 or 24000/1001 frames per | 1811 the majority of cinema is filmed at 24 or 24000/1001 frames per |
| 1642 second. When cinematic movie DVDs are mastered, the video is then | 1812 second. When cinematic movie DVDs are mastered, the video is then |
| 1643 converted for television using a process called telecine. | 1813 converted for television using a process called telecine. |
| 1644 </para></formalpara> | 1814 </para></formalpara> |
| 1645 | 1815 |
| 1646 <para> | 1816 <para> |
| 1647 On a DVD, the video is never actually stored as 60000/1001 fields per | 1817 On a DVD, the video is never actually stored as 60000/1001 fields per |
| 1648 second. For video that was originally 60000/1001, each pair of fields is | 1818 second. For video that was originally 60000/1001, each pair of fields is |
| 1649 combined to form a frame, resulting in 30000/1001 frames per | 1819 combined to form a frame, resulting in 30000/1001 frames per |
| 1650 second. Hardware DVD players then read a flag embedded in the video | 1820 second. Hardware DVD players then read a flag embedded in the video |
| 1651 stream to determine whether the odd- or even-numbered lines should | 1821 stream to determine whether the odd- or even-numbered lines should |
| 1652 form the first field. | 1822 form the first field. |
| 1653 </para> | 1823 </para> |
| 1654 | 1824 |
| 1655 <para> | 1825 <para> |
| 1656 Usually, 24000/1001 frames per second content stays as it is when | 1826 Usually, 24000/1001 frames per second content stays as it is when |
| 1657 encoded for a DVD, and the DVD player must perform telecining | 1827 encoded for a DVD, and the DVD player must perform telecining |
| 1658 on-the-fly. Sometimes, however, the video is telecined | 1828 on-the-fly. Sometimes, however, the video is telecined |
| 1659 <emphasis>before</emphasis> being stored on the DVD; even though it | 1829 <emphasis>before</emphasis> being stored on the DVD; even though it |
| 1660 was originally 24000/1001 frames per second, it becomes 60000/1001 fields per | 1830 was originally 24000/1001 frames per second, it becomes 60000/1001 fields per |
| 1661 second. When it is stored on the DVD, pairs of fields are combined to form | 1831 second. When it is stored on the DVD, pairs of fields are combined to form |
| 1662 30000/1001 frames per second. | 1832 30000/1001 frames per second. |
| 1663 </para> | 1833 </para> |
| 1664 | 1834 |
| 1665 <para> | 1835 <para> |
| 1666 When looking at individual frames formed from 60000/1001 fields per | 1836 When looking at individual frames formed from 60000/1001 fields per |
| 1667 second video, telecined or otherwise, interlacing is clearly visible | 1837 second video, telecined or otherwise, interlacing is clearly visible |
| 1668 wherever there is any motion, because one field (say, the | 1838 wherever there is any motion, because one field (say, the |
| 1669 even-numbered lines) represents a moment in time 1/(60000/1001) | 1839 even-numbered lines) represents a moment in time 1/(60000/1001) |
| 1670 seconds later than the other. Playing interlaced video on a computer | 1840 seconds later than the other. Playing interlaced video on a computer |
| 1671 looks ugly both because the monitor is higher resolution and because | 1841 looks ugly both because the monitor is higher resolution and because |
| 1672 the video is shown frame-after-frame instead of field-after-field. | 1842 the video is shown frame-after-frame instead of field-after-field. |
| 1673 </para> | 1843 </para> |
| 1674 | 1844 |
| 1675 <itemizedlist> | 1845 <itemizedlist> |
| 1676 <title>Notes:</title> | 1846 <title>Notes:</title> |
| 1677 <listitem><para> | 1847 <listitem><para> |
| 1678 This section only applies to NTSC DVDs, and not PAL. | 1848 This section only applies to NTSC DVDs, and not PAL. |
| 1679 </para></listitem> | 1849 </para></listitem> |
| 1680 <listitem><para> | 1850 <listitem><para> |
| 1681 The example <application>MEncoder</application> lines throughout the | 1851 The example <application>MEncoder</application> lines throughout the |
| 1682 document are <emphasis role="bold">not</emphasis> intended for | 1852 document are <emphasis role="bold">not</emphasis> intended for |
| 1683 actual use. They are simply the bare minimum required to encode the | 1853 actual use. They are simply the bare minimum required to encode the |
| 1684 pertaining video category. How to make good DVD rips or fine-tune | 1854 pertaining video category. How to make good DVD rips or fine-tune |
| 1685 <systemitem class="library">libavcodec</systemitem> for maximal | 1855 <systemitem class="library">libavcodec</systemitem> for maximal |
| 1686 quality is not within the scope of this document. | 1856 quality is not within the scope of this section; refer to other |
| 1687 </para></listitem> | 1857 sections within the <link linkend="encoding-guide">MEncoder encoding |
| 1858 guide</link>. | |
| 1859 </para></listitem> | |
| 1688 <listitem><para> | 1860 <listitem><para> |
| 1689 There are a couple footnotes specific to this guide, linked like this: | 1861 There are a couple footnotes specific to this guide, linked like this: |
| 1690 <link linkend="menc-feat-telecine-footnotes">[1]</link> | 1862 <link linkend="menc-feat-telecine-footnotes">[1]</link> |
| 1691 </para></listitem> | 1863 </para></listitem> |
| 1692 </itemizedlist> | 1864 </itemizedlist> |
| 1693 </sect2> | 1865 </sect2> |
| 1694 | 1866 |
| 1867 <!-- ********** --> | |
| 1868 | |
| 1695 <sect2 id="menc-feat-telecine-ident"> | 1869 <sect2 id="menc-feat-telecine-ident"> |
| 1696 <title>How to tell what type of video you have</title> | 1870 <title>How to tell what type of video you have</title> |
| 1697 | 1871 |
| 1698 <sect3 id="menc-feat-telecine-ident-progressive"> | 1872 <sect3 id="menc-feat-telecine-ident-progressive"> |
| 1699 <title>Progressive</title> | 1873 <title>Progressive</title> |
| 1700 <para> | 1874 |
| 1701 Progressive video was originally filmed at 24000/1001 fps, and stored | 1875 <para> |
| 1702 on the DVD without alteration. | 1876 Progressive video was originally filmed at 24000/1001 fps, and stored |
| 1703 </para> | 1877 on the DVD without alteration. |
| 1704 | 1878 </para> |
| 1705 <para> | 1879 |
| 1706 When you play a progressive DVD in <application>MPlayer</application>, | 1880 <para> |
| 1707 <application>MPlayer</application> will print the following line as | 1881 When you play a progressive DVD in <application>MPlayer</application>, |
| 1708 soon as the movie begins to play: | 1882 <application>MPlayer</application> will print the following line as |
| 1709 | 1883 soon as the movie begins to play: |
| 1710 <screen> demux_mpg: 24000/1001 fps progressive NTSC content detected, switching framerate.</screen> | 1884 <screen> |
| 1711 | 1885 demux_mpg: 24000/1001 fps progressive NTSC content detected, switching framerate. |
| 1712 From this point forward, demux_mpg should never say it finds | 1886 </screen> |
| 1713 "30000/1001 fps NTSC content." | 1887 From this point forward, demux_mpg should never say it finds |
| 1714 </para> | 1888 "30000/1001 fps NTSC content." |
| 1715 | 1889 </para> |
| 1716 <para> | 1890 |
| 1717 When you watch progressive video, you should never see any | 1891 <para> |
| 1718 interlacing. Beware, however, because sometimes there is a tiny bit | 1892 When you watch progressive video, you should never see any |
| 1719 of telecine mixed in where you would not expect. I have encountered TV | 1893 interlacing. Beware, however, because sometimes there is a tiny bit |
| 1720 show DVDs that have one second of telecine at every scene change, or | 1894 of telecine mixed in where you would not expect. I have encountered TV |
| 1721 at seemingly random places. I once watched a DVD that had a | 1895 show DVDs that have one second of telecine at every scene change, or |
| 1722 progressive first half, and the second half was telecined. If you | 1896 at seemingly random places. I once watched a DVD that had a |
| 1723 want to be <emphasis>really</emphasis> thorough, you can scan the | 1897 progressive first half, and the second half was telecined. If you |
| 1724 entire movie: | 1898 want to be <emphasis>really</emphasis> thorough, you can scan the |
| 1725 | 1899 entire movie: |
| 1726 <screen>mplayer dvd://1 -nosound -vo null -benchmark</screen> | 1900 <screen>mplayer dvd://1 -nosound -vo null -benchmark</screen> |
| 1727 | 1901 Using <option>-benchmark</option> makes |
| 1728 Using <option>-benchmark</option> makes | 1902 <application>MPlayer</application> play the movie as quickly as it |
| 1729 <application>MPlayer</application> play the movie as quickly as it | 1903 possibly can; still, depending on your hardware, it can take a |
| 1730 possibly can; still, depending on your hardware, it can take a | 1904 while. Every time demux_mpg reports a framerate change, the line |
| 1731 while. Every time demux_mpg reports a framerate change, the line | 1905 immediately above will show you the time at which the change |
| 1732 immediately above will show you the time at which the change | 1906 occurred. |
| 1733 occurred. | 1907 </para> |
| 1734 </para> | 1908 |
| 1735 | 1909 <para> |
| 1736 <para> | 1910 Sometimes progressive video on DVDs is referred to as |
| 1737 Sometimes progressive video on DVDs is referred to as | 1911 "soft-telecine" because it is intended to |
| 1738 "soft-telecine" because it is intended to | 1912 be telecined by the DVD player. |
| 1739 be telecined by the DVD player. | |
| 1740 </para> | 1913 </para> |
| 1741 </sect3> | 1914 </sect3> |
| 1915 | |
| 1742 | 1916 |
| 1743 <sect3 id="menc-feat-telecine-ident-telecined"> | 1917 <sect3 id="menc-feat-telecine-ident-telecined"> |
| 1744 <title>Telecined</title> | 1918 <title>Telecined</title> |
| 1745 <para> | 1919 |
| 1746 Telecined video was originally filmed at 24000/1001, but was telecined | 1920 <para> |
| 1747 <emphasis>before</emphasis> it was written to the DVD. | 1921 Telecined video was originally filmed at 24000/1001, but was telecined |
| 1748 </para> | 1922 <emphasis>before</emphasis> it was written to the DVD. |
| 1749 | 1923 </para> |
| 1750 <para> | 1924 |
| 1751 <application>MPlayer</application> does not (ever) report any | 1925 <para> |
| 1752 framerate changes when it plays telecined video. | 1926 <application>MPlayer</application> does not (ever) report any |
| 1753 </para> | 1927 framerate changes when it plays telecined video. |
| 1754 | 1928 </para> |
| 1755 <para> | 1929 |
| 1756 Watching a telecined video, you will see interlacing artifacts that | 1930 <para> |
| 1757 seem to "blink": they repeatedly appear and disappear. | 1931 Watching a telecined video, you will see interlacing artifacts that |
| 1758 You can look closely at this by | 1932 seem to "blink": they repeatedly appear and disappear. |
| 1759 <orderedlist> | 1933 You can look closely at this by |
| 1760 <listitem> | 1934 <orderedlist> |
| 1761 <screen>mplayer dvd://1</screen> | 1935 <listitem><screen>mplayer dvd://1</screen></listitem> |
| 1762 </listitem> | 1936 <listitem><para> |
| 1763 <listitem><para> | 1937 Seek to a part with motion. |
| 1764 Seek to a part with motion. | 1938 </para></listitem> |
| 1765 </para></listitem> | 1939 <listitem><para> |
| 1766 <listitem><para> | 1940 Use the <keycap>.</keycap> key to step forward one frame at a time. |
| 1767 Use the <keycap>.</keycap> key to step forward one frame at a time. | 1941 </para></listitem> |
| 1768 </para></listitem> | 1942 <listitem><para> |
| 1769 <listitem><para> | 1943 Look at the pattern of interlaced-looking and progressive-looking |
| 1770 Look at the pattern of interlaced-looking and progressive-looking | 1944 frames. If the pattern you see is PPPII,PPPII,PPPII,... then the |
| 1771 frames. If the pattern you see is PPPII,PPPII,PPPII,... then the | 1945 video is telecined. If you see some other pattern, then the video |
| 1772 video is telecined. If you see some other pattern, then the video | 1946 may have been telecined using some non-standard method; |
| 1773 may have been telecined using some non-standard method; | 1947 <application>MEncoder</application> cannot losslessly convert |
| 1774 <application>MEncoder</application> cannot losslessly convert | 1948 non-standard telecine to progressive. If you do not see any |
| 1775 non-standard telecine to progressive. If you do not see any | 1949 pattern at all, then it is most likely interlaced. |
| 1776 pattern at all, then it is most likely interlaced. | 1950 </para></listitem> |
| 1777 </para></listitem> | 1951 </orderedlist> |
| 1778 </orderedlist> | 1952 </para> |
| 1779 </para> | 1953 |
| 1780 | 1954 <para> |
| 1781 <para> | 1955 Sometimes telecined video on DVDs is referred to as |
| 1782 Sometimes telecined video on DVDs is referred to as | 1956 "hard-telecine". Since hard-telecine is already 60000/1001 fields |
| 1783 "hard-telecine". Since hard-telecine is already 60000/1001 fields | 1957 per second, the DVD player plays the video without any manipulation. |
| 1784 per second, the DVD player plays the video without any manipulation. | 1958 </para> |
| 1785 </para> | 1959 |
| 1786 | 1960 <para> |
| 1787 <para> | 1961 Another way to tell if your source is telecined or not is to play |
| 1788 Another way to tell if your source is telecined or not is to play | 1962 the source with the <option>-vf pullup</option> and <option>-v</option> |
| 1789 the source with the <option>-vf pullup</option> and <option>-v</option> | 1963 command line options to see how <option>pullup</option> matches frames. |
| 1790 command line options to see how <option>pullup</option> matches frames. | 1964 If the source is telecined, you should see on the console a 3:2 pattern |
| 1791 If the source is telecined, you should see on the console a 3:2 pattern | 1965 with <systemitem>0+.1.+2</systemitem> and <systemitem>0++1</systemitem> |
| 1792 with <systemitem>0+.1.+2</systemitem> and <systemitem>0++1</systemitem> | 1966 alternating. |
| 1793 alternating. | 1967 This technique has the advantage that you do not need to watch the |
| 1794 This technique has the advantage that you do not need to watch the | 1968 source to identify it, which could be useful if you wish to automate |
| 1795 source to identify it, which could be useful if you wish to automate | 1969 the encoding procedure, or to carry out said procedure remotely via |
| 1796 the encoding procedure, or to carry out said procedure remotely via | 1970 a slow connection. |
| 1797 a slow connection. | 1971 </para> |
| 1798 </para> | |
| 1799 | |
| 1800 </sect3> | 1972 </sect3> |
| 1973 | |
| 1801 | 1974 |
| 1802 <sect3 id="menc-feat-telecine-ident-interlaced"> | 1975 <sect3 id="menc-feat-telecine-ident-interlaced"> |
| 1803 <title>Interlaced</title> | 1976 <title>Interlaced</title> |
| 1804 <para> | 1977 |
| 1805 Interlaced video was originally filmed at 60000/1001 fields per second, | 1978 <para> |
| 1806 and stored on the DVD as 30000/1001 frames per second. The interlacing effect | 1979 Interlaced video was originally filmed at 60000/1001 fields per second, |
| 1807 (often called "combing") is a result of combining pairs of | 1980 and stored on the DVD as 30000/1001 frames per second. The interlacing effect |
| 1808 fields into frames. Each field is supposed to be 1/(60000/1001) seconds apart, | 1981 (often called "combing") is a result of combining pairs of |
| 1809 and when they are displayed simultaneously the difference is apparent. | 1982 fields into frames. Each field is supposed to be 1/(60000/1001) seconds apart, |
| 1810 </para> | 1983 and when they are displayed simultaneously the difference is apparent. |
| 1811 | 1984 </para> |
| 1812 <para> | 1985 |
| 1813 As with telecined video, <application>MPlayer</application> should | 1986 <para> |
| 1814 not ever report any framerate changes when playing interlaced content. | 1987 As with telecined video, <application>MPlayer</application> should |
| 1815 </para> | 1988 not ever report any framerate changes when playing interlaced content. |
| 1816 | 1989 </para> |
| 1817 <para> | 1990 |
| 1818 When you view an interlaced video closely by frame-stepping with the | 1991 <para> |
| 1819 <keycap>.</keycap> key, you will see that every single frame is interlaced. | 1992 When you view an interlaced video closely by frame-stepping with the |
| 1993 <keycap>.</keycap> key, you will see that every single frame is interlaced. | |
| 1820 </para> | 1994 </para> |
| 1821 </sect3> | 1995 </sect3> |
| 1996 | |
| 1822 | 1997 |
| 1823 <sect3 id="menc-feat-telecine-ident-mixedpt"> | 1998 <sect3 id="menc-feat-telecine-ident-mixedpt"> |
| 1824 <title>Mixed progressive and telecine</title> | 1999 <title>Mixed progressive and telecine</title> |
| 1825 <para> | 2000 |
| 1826 All of a "mixed progressive and telecine" video was originally | 2001 <para> |
| 1827 24000/1001 frames per second, but some parts of it ended up being telecined. | 2002 All of a "mixed progressive and telecine" video was originally |
| 1828 </para> | 2003 24000/1001 frames per second, but some parts of it ended up being telecined. |
| 1829 | 2004 </para> |
| 1830 <para> | 2005 |
| 1831 When <application>MPlayer</application> plays this category, it will | 2006 <para> |
| 1832 (often repeatedly) switch back and forth between "30000/1001 fps NTSC" | 2007 When <application>MPlayer</application> plays this category, it will |
| 1833 and "24000/1001 fps progressive NTSC". Watch the bottom of | 2008 (often repeatedly) switch back and forth between "30000/1001 fps NTSC" |
| 1834 <application>MPlayer</application>'s output to see these messages. | 2009 and "24000/1001 fps progressive NTSC". Watch the bottom of |
| 1835 </para> | 2010 <application>MPlayer</application>'s output to see these messages. |
| 1836 | 2011 </para> |
| 1837 <para> | 2012 |
| 1838 You should check the "30000/1001 fps NTSC" sections to make sure | 2013 <para> |
| 1839 they are actually telecine, and not just interlaced. | 2014 You should check the "30000/1001 fps NTSC" sections to make sure |
| 2015 they are actually telecine, and not just interlaced. | |
| 1840 </para> | 2016 </para> |
| 1841 </sect3> | 2017 </sect3> |
| 2018 | |
| 1842 | 2019 |
| 1843 <sect3 id="menc-feat-telecine-ident-mixedpi"> | 2020 <sect3 id="menc-feat-telecine-ident-mixedpi"> |
| 1844 <title>Mixed progressive and interlaced</title> | 2021 <title>Mixed progressive and interlaced</title> |
| 1845 <para> | 2022 |
| 1846 In "mixed progressive and interlaced" content, progressive | 2023 <para> |
| 1847 and interlaced video have been spliced together. | 2024 In "mixed progressive and interlaced" content, progressive |
| 1848 </para> | 2025 and interlaced video have been spliced together. |
| 1849 | 2026 </para> |
| 1850 <para> | 2027 |
| 1851 This category looks just like "mixed progressive and telecine", | 2028 <para> |
| 1852 until you examine the 30000/1001 fps sections and see that they do not have the | 2029 This category looks just like "mixed progressive and telecine", |
| 1853 telecine pattern. | 2030 until you examine the 30000/1001 fps sections and see that they do not have the |
| 2031 telecine pattern. | |
| 1854 </para> | 2032 </para> |
| 1855 </sect3> | 2033 </sect3> |
| 1856 | |
| 1857 </sect2> | 2034 </sect2> |
| 2035 | |
| 2036 <!-- ********** --> | |
| 1858 | 2037 |
| 1859 <sect2 id="menc-feat-telecine-encode"> | 2038 <sect2 id="menc-feat-telecine-encode"> |
| 1860 <title>How to encode each category</title> | 2039 <title>How to encode each category</title> |
| 1861 <para> | 2040 <para> |
| 1862 As I mentioned in the beginning, example <application>MEncoder</application> | 2041 As I mentioned in the beginning, example <application>MEncoder</application> |
| 1863 lines below are <emphasis role="bold">not</emphasis> meant to actually be used; | 2042 lines below are <emphasis role="bold">not</emphasis> meant to actually be used; |
| 1864 they only demonstrate the minimum parameters to properly encode each category. | 2043 they only demonstrate the minimum parameters to properly encode each category. |
| 1865 </para> | 2044 </para> |
| 2045 | |
| 1866 | 2046 |
| 1867 <sect3 id="menc-feat-telecine-encode-progressive"> | 2047 <sect3 id="menc-feat-telecine-encode-progressive"> |
| 1868 <title>Progressive</title> | 2048 <title>Progressive</title> |
| 1869 <para> | 2049 <para> |
| 1870 Progressive video requires no special filtering to encode. The only | 2050 Progressive video requires no special filtering to encode. The only |
| 1871 parameter you need to be sure to use is | 2051 parameter you need to be sure to use is <option>-ofps 24000/1001</option>. |
| 1872 <option>-ofps 24000/1001</option>. Otherwise, <application>MEncoder</application> | 2052 Otherwise, <application>MEncoder</application> |
| 1873 will try to encode at 30000/1001 fps and will duplicate frames. | 2053 will try to encode at 30000/1001 fps and will duplicate frames. |
| 1874 </para> | 2054 </para> |
| 1875 | 2055 |
| 1876 <para> | 2056 <para> |
| 1877 <screen>mencoder dvd://1 -oac copy -ovc lavc -ofps 24000/1001</screen> | 2057 <screen>mencoder dvd://1 -oac copy -ovc lavc -ofps 24000/1001</screen> |
| 1878 </para> | 2058 </para> |
| 1879 | 2059 |
| 1880 <para> | 2060 <para> |
| 1881 It is often the case, however, that a video that looks progressive | 2061 It is often the case, however, that a video that looks progressive |
| 1882 actually has very short parts of telecine mixed in. Unless you are | 2062 actually has very short parts of telecine mixed in. Unless you are |
| 1883 sure, it is safest to treat the video as | 2063 sure, it is safest to treat the video as |
| 1884 <link linkend="menc-feat-telecine-encode-mixedpt">mixed progressive and telecine</link>. | 2064 <link linkend="menc-feat-telecine-encode-mixedpt">mixed progressive and telecine</link>. |
| 1885 The performance loss is small | 2065 The performance loss is small |
| 1886 <link linkend="menc-feat-telecine-footnotes">[3]</link>. | 2066 <link linkend="menc-feat-telecine-footnotes">[3]</link>. |
| 1887 </para> | 2067 </para> |
| 1888 </sect3> | 2068 </sect3> |
| 2069 | |
| 1889 | 2070 |
| 1890 <sect3 id="menc-feat-telecine-encode-telecined"> | 2071 <sect3 id="menc-feat-telecine-encode-telecined"> |
| 1891 <title>Telecined</title> | 2072 <title>Telecined</title> |
| 1892 <para> | 2073 |
| 1893 Telecine can be reversed to retrieve the original 24000/1001 content, | 2074 <para> |
| 1894 using a process called inverse-telecine. | 2075 Telecine can be reversed to retrieve the original 24000/1001 content, |
| 1895 <application>MPlayer</application> contains several filters to | 2076 using a process called inverse-telecine. |
| 1896 accomplish this; the best filter, <option>pullup</option>, is described | 2077 <application>MPlayer</application> contains several filters to |
| 1897 in the <link linkend="menc-feat-telecine-encode-mixedpt">mixed | 2078 accomplish this; the best filter, <option>pullup</option>, is described |
| 1898 progressive and telecine</link> section. | 2079 in the <link linkend="menc-feat-telecine-encode-mixedpt">mixed |
| 2080 progressive and telecine</link> section. | |
| 1899 </para> | 2081 </para> |
| 1900 </sect3> | 2082 </sect3> |
| 2083 | |
| 1901 | 2084 |
| 1902 <sect3 id="menc-feat-telecine-encode-interlaced"> | 2085 <sect3 id="menc-feat-telecine-encode-interlaced"> |
| 1903 <title>Interlaced</title> | 2086 <title>Interlaced</title> |
| 1904 <para> | 2087 |
| 1905 For most practical cases it is not possible to retrieve a complete | 2088 <para> |
| 1906 progressive video from interlaced content. The only way to do so | 2089 For most practical cases it is not possible to retrieve a complete |
| 1907 without losing half of the vertical resolution is to double the | 2090 progressive video from interlaced content. The only way to do so |
| 1908 framerate and try to "guess" what ought to make up the | 2091 without losing half of the vertical resolution is to double the |
| 1909 corresponding lines for each field (this has drawbacks - see method | 2092 framerate and try to "guess" what ought to make up the |
| 1910 3). | 2093 corresponding lines for each field (this has drawbacks - see method 3). |
| 1911 </para> | 2094 </para> |
| 1912 | 2095 |
| 1913 <orderedlist> | 2096 <orderedlist> |
| 1914 <listitem><para> | 2097 <listitem><para> |
| 1915 | |
| 1916 Encode the video in interlaced form. Normally, interlacing wreaks | 2098 Encode the video in interlaced form. Normally, interlacing wreaks |
| 1917 havoc with the encoder's ability to compress well, but | 2099 havoc with the encoder's ability to compress well, but |
| 1918 <systemitem class="library">libavcodec</systemitem> has two | 2100 <systemitem class="library">libavcodec</systemitem> has two |
| 1919 parameters specifically for dealing with storing interlaced video a | 2101 parameters specifically for dealing with storing interlaced video a |
| 1920 bit better: <option> ildct</option> and <option>ilme</option>. Also, | 2102 bit better: <option>ildct</option> and <option>ilme</option>. Also, |
| 1921 using <option>mbd=2</option> is strongly recommended | 2103 using <option>mbd=2</option> is strongly recommended |
| 1922 <link linkend="menc-feat-telecine-footnotes">[2] </link> because it | 2104 <link linkend="menc-feat-telecine-footnotes">[2] </link> because it |
| 1923 will encode macroblocks as non-interlaced in places where there is | 2105 will encode macroblocks as non-interlaced in places where there is |
| 1924 no motion. Note that <option>-ofps</option> is NOT needed here. | 2106 no motion. Note that <option>-ofps</option> is NOT needed here. |
| 1925 | |
| 1926 <screen>mencoder dvd://1 -oac copy -ovc lavc -lavcopts ildct:ilme:mbd=2</screen> | 2107 <screen>mencoder dvd://1 -oac copy -ovc lavc -lavcopts ildct:ilme:mbd=2</screen> |
| 1927 </para></listitem> | 2108 </para></listitem> |
| 1928 <listitem><para> | 2109 <listitem><para> |
| 1929 Use a deinterlacing filter before encoding. There are several of | 2110 Use a deinterlacing filter before encoding. There are several of |
| 1930 these filters available to choose from, each with its own advantages | 2111 these filters available to choose from, each with its own advantages |
| 1931 and disadvantages. Consult <option>mplayer -pphelp</option> to see | 2112 and disadvantages. Consult <option>mplayer -pphelp</option> and |
| 1932 what is available (grep for "deint"), and search the | 2113 <option>mplayer -vf help</option> to see what is available |
| 1933 <ulink url="http://www.mplayerhq.hu/homepage/design6/info.html#mailing_lists"> | 2114 (grep for "deint"), read Michael Niedermayer's |
| 2115 <ulink url="http://guru.multimedia.cx/deinterlacing-filters/">Deinterlacing filters comparison</ulink>, | |
| 2116 and search the | |
| 2117 <ulink url="http://www.mplayerhq.hu/design7/mailing_lists.html"> | |
| 1934 MPlayer mailing lists</ulink> to find many discussions about the | 2118 MPlayer mailing lists</ulink> to find many discussions about the |
| 1935 various filters. Again, the framerate is not changing, so no | 2119 various filters. |
| 2120 Again, the framerate is not changing, so no | |
| 1936 <option>-ofps</option>. Also, deinterlacing should be done after | 2121 <option>-ofps</option>. Also, deinterlacing should be done after |
| 1937 cropping <link linkend="menc-feat-telecine-footnotes">[1]</link> and | 2122 cropping <link linkend="menc-feat-telecine-footnotes">[1]</link> and |
| 1938 before scaling. | 2123 before scaling. |
| 1939 | 2124 <screen>mencoder dvd://1 -oac copy -vf yadif -ovc lavc</screen> |
| 1940 <screen>mencoder dvd://1 -oac copy -vf pp=lb -ovc lavc</screen> | 2125 </para></listitem> |
| 1941 </para></listitem> | |
| 1942 <listitem><para> | 2126 <listitem><para> |
| 1943 Unfortunately, this option is buggy with | 2127 Unfortunately, this option is buggy with |
| 1944 <application>MEncoder</application>; it ought to work well with | 2128 <application>MEncoder</application>; it ought to work well with |
| 1945 <application>MEncoder G2</application>, but that is not here yet. You | 2129 <application>MEncoder G2</application>, but that is not here yet. You |
| 1946 might experience crahes. Anyway, the purpose of <option> -vf | 2130 might experience crashes. Anyway, the purpose of <option> -vf |
| 1947 tfields</option> is to create a full frame out of each field, which | 2131 tfields</option> is to create a full frame out of each field, which |
| 1948 makes the framerate 60000/1001. The advantage of this approach is that no | 2132 makes the framerate 60000/1001. The advantage of this approach is that no |
| 1949 data is ever lost; however, since each frame comes from only one | 2133 data is ever lost; however, since each frame comes from only one |
| 1950 field, the missing lines have to be interpolated somehow. There are | 2134 field, the missing lines have to be interpolated somehow. There are |
| 1951 no very good methods of generating the missing data, and so the | 2135 no very good methods of generating the missing data, and so the |
| 1959 option looks best for your material. Note that when using | 2143 option looks best for your material. Note that when using |
| 1960 <option>tfields</option> you | 2144 <option>tfields</option> you |
| 1961 <emphasis role="bold">have to</emphasis> specify both | 2145 <emphasis role="bold">have to</emphasis> specify both |
| 1962 <option>-fps</option> and <option>-ofps</option> to be twice the | 2146 <option>-fps</option> and <option>-ofps</option> to be twice the |
| 1963 framerate of your original source. | 2147 framerate of your original source. |
| 1964 | 2148 <screen> |
| 1965 <screen>mencoder dvd://1 -oac copy -vf tfields=2 -ovc lavc -fps 60000/1001 -ofps 60000/1001</screen> | 2149 mencoder dvd://1 -oac copy -vf tfields=2 -ovc lavc \ |
| 1966 </para></listitem> | 2150 -fps 60000/1001 -ofps 60000/1001<!-- |
| 2151 --></screen> | |
| 2152 </para></listitem> | |
| 1967 <listitem><para> | 2153 <listitem><para> |
| 1968 If you plan on downscaling dramatically, you can extract and encode | 2154 If you plan on downscaling dramatically, you can extract and encode |
| 1969 only one of the two fields. Of course, you will lose half the vertical | 2155 only one of the two fields. Of course, you will lose half the vertical |
| 1970 resolution, but if you plan on downscaling to at most 1/2 of the | 2156 resolution, but if you plan on downscaling to at most 1/2 of the |
| 1971 original, the loss will not matter much. The result will be a | 2157 original, the loss will not matter much. The result will be a |
| 1973 <option>-vf field</option>, then crop | 2159 <option>-vf field</option>, then crop |
| 1974 <link linkend="menc-feat-telecine-footnotes">[1]</link> and scale | 2160 <link linkend="menc-feat-telecine-footnotes">[1]</link> and scale |
| 1975 appropriately. Remember that you will have to adjust the scale to | 2161 appropriately. Remember that you will have to adjust the scale to |
| 1976 compensate for the vertical resolution being halved. | 2162 compensate for the vertical resolution being halved. |
| 1977 <screen>mencoder dvd://1 -oac copy -vf field=0 -ovc lavc</screen> | 2163 <screen>mencoder dvd://1 -oac copy -vf field=0 -ovc lavc</screen> |
| 1978 </para></listitem> | 2164 </para></listitem> |
| 1979 </orderedlist> | 2165 </orderedlist> |
| 1980 </sect3> | 2166 </sect3> |
| 1981 | 2167 |
| 2168 | |
| 1982 <sect3 id="menc-feat-telecine-encode-mixedpt"> | 2169 <sect3 id="menc-feat-telecine-encode-mixedpt"> |
| 1983 <title>Mixed progressive and telecine</title> | 2170 <title>Mixed progressive and telecine</title> |
| 1984 <para> | 2171 |
| 1985 In order to turn mixed progressive and telecine video into entirely | 2172 <para> |
| 1986 progressive video, the telecined parts have to be | 2173 In order to turn mixed progressive and telecine video into entirely |
| 1987 inverse-telecined. There are three ways to accomplish this, | 2174 progressive video, the telecined parts have to be |
| 1988 described below. Note that you should | 2175 inverse-telecined. There are three ways to accomplish this, |
| 1989 <emphasis role="bold">always</emphasis> inverse-telecine before any | 2176 described below. Note that you should |
| 1990 rescaling; unless you really know what you are doing, | 2177 <emphasis role="bold">always</emphasis> inverse-telecine before any |
| 1991 inverse-telecine before cropping, too | 2178 rescaling; unless you really know what you are doing, |
| 1992 <link linkend="menc-feat-telecine-footnotes">[1]</link>. | 2179 inverse-telecine before cropping, too |
| 1993 <option>-ofps 24000/1001</option> is needed here because the output video | 2180 <link linkend="menc-feat-telecine-footnotes">[1]</link>. |
| 1994 will be 24000/1001 frames per second. | 2181 <option>-ofps 24000/1001</option> is needed here because the output video |
| 2182 will be 24000/1001 frames per second. | |
| 1995 </para> | 2183 </para> |
| 1996 | 2184 |
| 1997 <itemizedlist> | 2185 <itemizedlist> |
| 1998 <listitem><para> | 2186 <listitem><para> |
| 1999 <option>-vf pullup</option> is designed to inverse-telecine | 2187 <option>-vf pullup</option> is designed to inverse-telecine |
| 2001 work properly, <option>pullup</option> <emphasis role="bold">must</emphasis> | 2189 work properly, <option>pullup</option> <emphasis role="bold">must</emphasis> |
| 2002 be followed by the <option>softskip</option> filter or | 2190 be followed by the <option>softskip</option> filter or |
| 2003 else <application>MEncoder</application> will crash. | 2191 else <application>MEncoder</application> will crash. |
| 2004 <option>pullup</option> is, however, the cleanest and most | 2192 <option>pullup</option> is, however, the cleanest and most |
| 2005 accurate method available for encoding both telecine and | 2193 accurate method available for encoding both telecine and |
| 2006 "mixed progressive and telecine". | 2194 "mixed progressive and telecine". |
| 2007 | 2195 <screen> |
| 2008 <screen>mencoder dvd://1 -oac copy -vf pullup,softskip -ovc lavc -ofps 24000/1001</screen> | 2196 mencoder dvd://1 -oac copy -vf pullup,softskip |
| 2009 </para> | 2197 -ovc lavc -ofps 24000/1001<!-- |
| 2010 | 2198 --></screen> |
| 2011 | 2199 </para></listitem> |
| 2012 </listitem> | 2200 <listitem><para> |
| 2013 <listitem><para> | 2201 <option>-vf filmdint</option> is similar to |
| 2202 <option>-vf pullup</option>: both filters attempt to match a pair of | |
| 2203 fields to form a complete frame. <option>filmdint</option> will | |
| 2204 deinterlace individual fields that it cannot match, however, whereas | |
| 2205 <option>pullup</option> will simply drop them. Also, the two filters | |
| 2206 have separate detection code, and <option>filmdint</option> may tend to match fields a | |
| 2207 bit less often. Which filter works better may depend on the input | |
| 2208 video and personal taste; feel free to experiment with fine-tuning | |
| 2209 the filters' options if you encounter problems with either one (see | |
| 2210 the man page for details). For most well-mastered input video, | |
| 2211 however, both filters work quite well, so either one is a safe choice | |
| 2212 to start with. | |
| 2213 <screen> | |
| 2214 mencoder dvd://1 -oac copy -vf filmdint -ovc lavc -ofps 24000/1001<!-- | |
| 2215 --></screen> | |
| 2216 </para></listitem> | |
| 2217 <listitem><para> | |
| 2014 An older method | 2218 An older method |
| 2015 is to, rather than inverse-telecine the telecined parts, telecine | 2219 is to, rather than inverse-telecine the telecined parts, telecine |
| 2016 the non-telecined parts and then inverse-telecine the whole | 2220 the non-telecined parts and then inverse-telecine the whole |
| 2017 video. Sound confusing? softpulldown is a filter that goes through | 2221 video. Sound confusing? softpulldown is a filter that goes through |
| 2018 a video and makes the entire file telecined. If we follow | 2222 a video and makes the entire file telecined. If we follow |
| 2019 softpulldown with either <option>detc</option> or | 2223 softpulldown with either <option>detc</option> or |
| 2020 <option>ivtc</option>, the final result will be entirely | 2224 <option>ivtc</option>, the final result will be entirely |
| 2021 progressive. <option>-ofps 24000/1001</option> is needed. | 2225 progressive. <option>-ofps 24000/1001</option> is needed. |
| 2022 | 2226 <screen> |
| 2023 <screen>mencoder dvd://1 -oac copy -vf softpulldown,ivtc=1 -ovc lavc -ofps 24000/1001</screen> | 2227 mencoder dvd://1 -oac copy -vf softpulldown,ivtc=1 -ovc lavc -ofps 24000/1001 |
| 2024 </para> | 2228 </screen> |
| 2025 </listitem> | 2229 </para></listitem> |
| 2026 | 2230 |
| 2027 <listitem><para> | |
| 2028 I have not used <option>-vf filmdint</option> myself, but here is what | |
| 2029 D Richard Felker III has to say: | |
| 2030 | |
| 2031 <blockquote><para>It is OK, but IMO it tries to deinterlace rather | |
| 2032 than doing inverse telecine too often (much like settop DVD | |
| 2033 players & progressive TVs) which gives ugly flickering and | |
| 2034 other artifacts. If you are going to use it, you at least need to | |
| 2035 spend some time tuning the options and watching the output first | |
| 2036 to make sure it is not messing up.</para></blockquote> | |
| 2037 </para></listitem> | |
| 2038 </itemizedlist> | 2231 </itemizedlist> |
| 2039 </sect3> | 2232 </sect3> |
| 2040 | 2233 |
| 2234 | |
| 2041 <sect3 id="menc-feat-telecine-encode-mixedpi"> | 2235 <sect3 id="menc-feat-telecine-encode-mixedpi"> |
| 2042 <title>Mixed progressive and interlaced</title> | 2236 <title>Mixed progressive and interlaced</title> |
| 2043 <para> | 2237 |
| 2044 There are two options for dealing with this category, each of | 2238 <para> |
| 2045 which is a compromise. You should decide based on the | 2239 There are two options for dealing with this category, each of |
| 2046 duration/location of each type. | 2240 which is a compromise. You should decide based on the |
| 2241 duration/location of each type. | |
| 2047 </para> | 2242 </para> |
| 2048 | 2243 |
| 2049 <itemizedlist> | 2244 <itemizedlist> |
| 2050 <listitem><para> | 2245 <listitem> |
| 2246 <para> | |
| 2051 Treat it as progressive. The interlaced parts will look interlaced, | 2247 Treat it as progressive. The interlaced parts will look interlaced, |
| 2052 and some of the interlaced fields will have to be dropped, resulting | 2248 and some of the interlaced fields will have to be dropped, resulting |
| 2053 in a bit of uneven jumpiness. You can use a postprocessing filter if | 2249 in a bit of uneven jumpiness. You can use a postprocessing filter if |
| 2054 you want to, but it may slightly degrade the progressive parts. | 2250 you want to, but it may slightly degrade the progressive parts. |
| 2055 </para> | 2251 </para> |
| 2059 display the video on an interlaced device (with a TV card, for | 2255 display the video on an interlaced device (with a TV card, for |
| 2060 example). If you have interlaced frames in a 24000/1001 frames per | 2256 example). If you have interlaced frames in a 24000/1001 frames per |
| 2061 second video, they will be telecined along with the progressive | 2257 second video, they will be telecined along with the progressive |
| 2062 frames. Half of the interlaced "frames" will be displayed for three | 2258 frames. Half of the interlaced "frames" will be displayed for three |
| 2063 fields' duration (3/(60000/1001) seconds), resulting in a flicking | 2259 fields' duration (3/(60000/1001) seconds), resulting in a flicking |
| 2064 "jump back in time" effect that looks quite bad. If you | 2260 "jump back in time" effect that looks quite bad. If you |
| 2065 even attempt this, you <emphasis role="bold">must</emphasis> use a | 2261 even attempt this, you <emphasis role="bold">must</emphasis> use a |
| 2066 deinterlacing filter like <option>lb</option> or | 2262 deinterlacing filter like <option>lb</option> or |
| 2067 <option>l5</option>. | 2263 <option>l5</option>. |
| 2068 </para> | 2264 </para> |
| 2069 | 2265 |
| 2082 display it. If your video is 90% progressive and you never intend to | 2278 display it. If your video is 90% progressive and you never intend to |
| 2083 show it on a TV, you should favor a progressive approach. If it is | 2279 show it on a TV, you should favor a progressive approach. If it is |
| 2084 only half progressive, you probably want to encode it as if it is all | 2280 only half progressive, you probably want to encode it as if it is all |
| 2085 interlaced. | 2281 interlaced. |
| 2086 </para> | 2282 </para> |
| 2087 </listitem> | 2283 </listitem> |
| 2088 | 2284 |
| 2089 <listitem><para> | 2285 <listitem><para> |
| 2090 Treat it as interlaced. Some frames of the progressive parts will | 2286 Treat it as interlaced. Some frames of the progressive parts will |
| 2091 need to be duplicated, resulting in uneven jumpiness. Again, | 2287 need to be duplicated, resulting in uneven jumpiness. Again, |
| 2092 deinterlacing filters may slightly degrade the progressive parts. | 2288 deinterlacing filters may slightly degrade the progressive parts. |
| 2093 </para></listitem> | 2289 </para></listitem> |
| 2094 | |
| 2095 </itemizedlist> | 2290 </itemizedlist> |
| 2096 </sect3> | 2291 </sect3> |
| 2097 | |
| 2098 </sect2> | 2292 </sect2> |
| 2293 | |
| 2294 <!-- ********** --> | |
| 2099 | 2295 |
| 2100 <sect2 id="menc-feat-telecine-footnotes"> | 2296 <sect2 id="menc-feat-telecine-footnotes"> |
| 2101 <title>Footnotes</title> | 2297 <title>Footnotes</title> |
| 2298 | |
| 2102 <orderedlist> | 2299 <orderedlist> |
| 2103 <listitem><formalpara> | 2300 <listitem> |
| 2301 <formalpara> | |
| 2104 <title>About cropping:</title> | 2302 <title>About cropping:</title> |
| 2105 <para> | 2303 <para> |
| 2106 Video data on DVDs are stored in a format called YUV 4:2:0. In YUV | 2304 Video data on DVDs are stored in a format called YUV 4:2:0. In YUV |
| 2107 video, luma ("brightness") and chroma ("color") | 2305 video, luma ("brightness") and chroma ("color") |
| 2108 are stored separately. Because the human eye is somewhat less | 2306 are stored separately. Because the human eye is somewhat less |
| 2109 sensitive to color than it is to brightness, in a YUV 4:2:0 picture | 2307 sensitive to color than it is to brightness, in a YUV 4:2:0 picture |
| 2110 there is only one chroma pixel for every four luma pixels. In a | 2308 there is only one chroma pixel for every four luma pixels. In a |
| 2111 progressive picture, each square of four luma pixels (two on each | 2309 progressive picture, each square of four luma pixels (two on each |
| 2112 side) has one common chroma pixel. You must crop progressive YUV | 2310 side) has one common chroma pixel. You must crop progressive YUV |
| 2142 <para> | 2340 <para> |
| 2143 For interlaced (not telecined) video, you must always crop | 2341 For interlaced (not telecined) video, you must always crop |
| 2144 vertically by multiples of four unless you use <option>-vf | 2342 vertically by multiples of four unless you use <option>-vf |
| 2145 field</option> before cropping. | 2343 field</option> before cropping. |
| 2146 </para> | 2344 </para> |
| 2147 </listitem> | 2345 </listitem> |
| 2148 | 2346 |
| 2149 <listitem><formalpara> | 2347 <listitem><formalpara> |
| 2150 <title>About encoding parameters and quality:</title> | 2348 <title>About encoding parameters and quality:</title> |
| 2151 <para> | 2349 <para> |
| 2152 Just because I recommend <option>mbd=2</option> here does not mean it | 2350 Just because I recommend <option>mbd=2</option> here does not mean it |
| 2158 encoding). There are many other options to | 2356 encoding). There are many other options to |
| 2159 <systemitem class="library">libavcodec</systemitem> that increase | 2357 <systemitem class="library">libavcodec</systemitem> that increase |
| 2160 encoding quality (and decrease encoding speed) but that is beyond | 2358 encoding quality (and decrease encoding speed) but that is beyond |
| 2161 the scope of this document. | 2359 the scope of this document. |
| 2162 </para> | 2360 </para> |
| 2163 </formalpara> | 2361 </formalpara></listitem> |
| 2164 </listitem> | |
| 2165 | 2362 |
| 2166 <listitem><formalpara> | 2363 <listitem><formalpara> |
| 2167 <title>About the performance of pullup:</title> | 2364 <title>About the performance of pullup:</title> |
| 2168 <para> | 2365 <para> |
| 2169 It is safe to use <option>pullup</option> (along with <option>softskip | 2366 It is safe to use <option>pullup</option> (along with <option>softskip |
| 2170 </option>) on progressive video, and is usually a good idea unless | 2367 </option>) on progressive video, and is usually a good idea unless |
| 2171 the source has been definitively verified to be entirely progressive. | 2368 the source has been definitively verified to be entirely progressive. |
| 2172 The performace loss is small for most cases. On a bare-minimum encode, | 2369 The performance loss is small for most cases. On a bare-minimum encode, |
| 2173 <option>pullup</option> causes <application>MEncoder</application> to | 2370 <option>pullup</option> causes <application>MEncoder</application> to |
| 2174 be 50% slower. Adding sound processing and advanced <option>lavcopts | 2371 be 50% slower. Adding sound processing and advanced <option>lavcopts |
| 2175 </option> overshadows that difference, bringing the performance | 2372 </option> overshadows that difference, bringing the performance |
| 2176 decrease of using <option>pullup</option> down to 2%. | 2373 decrease of using <option>pullup</option> down to 2%. |
| 2177 </para> | 2374 </para> |
| 2178 </formalpara> | 2375 </formalpara></listitem> |
| 2179 </listitem> | |
| 2180 | |
| 2181 </orderedlist> | 2376 </orderedlist> |
| 2182 | |
| 2183 </sect2> | 2377 </sect2> |
| 2184 | |
| 2185 </sect1> | 2378 </sect1> |
| 2379 | |
| 2380 | |
| 2381 <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - --> | |
| 2186 | 2382 |
| 2187 | 2383 |
| 2188 <sect1 id="menc-feat-enc-libavcodec"> | 2384 <sect1 id="menc-feat-enc-libavcodec"> |
| 2189 <title>Encoding with the <systemitem class="library">libavcodec</systemitem> | 2385 <title>Encoding with the <systemitem class="library">libavcodec</systemitem> |
| 2190 codec family</title> | 2386 codec family</title> |
| 2191 | 2387 |
| 2192 <para> | 2388 <para> |
| 2193 <link linkend="ffmpeg"><systemitem class="library">libavcodec</systemitem></link> | 2389 <systemitem class="library">libavcodec</systemitem> |
| 2194 provides simple encoding to a lot of interesting video and audio formats. | 2390 provides simple encoding to a lot of interesting video and audio formats. |
| 2195 You can encode to the following codecs (more or less up to date): | 2391 You can encode to the following codecs (more or less up to date): |
| 2196 </para> | 2392 </para> |
| 2197 | 2393 |
| 2394 <!-- ********** --> | |
| 2395 | |
| 2198 <sect2 id="menc-feat-enc-libavcodec-video-codecs"> | 2396 <sect2 id="menc-feat-enc-libavcodec-video-codecs"> |
| 2199 <title><systemitem class="library">libavcodec</systemitem>'s video codecs</title> | 2397 <title><systemitem class="library">libavcodec</systemitem>'s |
| 2398 video codecs</title> | |
| 2200 | 2399 |
| 2201 <para> | 2400 <para> |
| 2202 <informaltable frame="all"> | 2401 <informaltable frame="all"> |
| 2203 <tgroup cols="2"> | 2402 <tgroup cols="2"> |
| 2204 <thead> | 2403 <thead> |
| 2205 <row><entry>Video codec name</entry><entry>Description</entry></row> | 2404 <row><entry>Video codec name</entry><entry>Description</entry></row> |
| 2206 </thead> | 2405 </thead> |
| 2207 <tbody> | 2406 <tbody> |
| 2208 <row><entry>mjpeg</entry><entry> | 2407 <row> |
| 2209 Motion JPEG | 2408 <entry>mjpeg</entry> |
| 2210 </entry></row> | 2409 <entry>Motion JPEG</entry> |
| 2211 <row><entry>ljpeg</entry><entry> | 2410 </row> |
| 2212 lossless JPEG | 2411 <row> |
| 2213 </entry></row> | 2412 <entry>ljpeg</entry> |
| 2214 <row><entry>h261</entry><entry> | 2413 <entry>lossless JPEG</entry> |
| 2215 H.261 | 2414 </row> |
| 2216 </entry></row> | 2415 <row> |
| 2217 <row><entry>h263</entry><entry> | 2416 <entry>jpegls</entry> |
| 2218 H.263 | 2417 <entry>JPEG LS</entry> |
| 2219 </entry></row> | 2418 </row> |
| 2220 <row><entry>h263p</entry><entry> | 2419 <row> |
| 2221 H.263+ | 2420 <entry>targa</entry> |
| 2222 </entry></row> | 2421 <entry>Targa image</entry> |
| 2223 <row><entry>mpeg4</entry><entry> | 2422 </row> |
| 2224 ISO standard MPEG-4 (DivX 5, XviD compatible) | 2423 <row> |
| 2225 </entry></row> | 2424 <entry>gif</entry> |
| 2226 <row><entry>msmpeg4</entry><entry> | 2425 <entry>GIF image</entry> |
| 2227 pre-standard MPEG-4 variant by MS, v3 (AKA DivX3) | 2426 </row> |
| 2228 </entry></row> | 2427 <row> |
| 2229 <row><entry>msmpeg4v2</entry><entry> | 2428 <entry>bmp</entry> |
| 2230 pre-standard MPEG-4 by MS, v2 (used in old ASF files) | 2429 <entry>BMP image</entry> |
| 2231 </entry></row> | 2430 </row> |
| 2232 <row><entry>wmv1</entry><entry> | 2431 <row> |
| 2233 Windows Media Video, version 1 (AKA WMV7) | 2432 <entry>png</entry> |
| 2234 </entry></row> | 2433 <entry>PNG image</entry> |
| 2235 <row><entry>wmv2</entry><entry> | 2434 </row> |
| 2236 Windows Media Video, version 2 (AKA WMV8) | 2435 <row> |
| 2237 </entry></row> | 2436 <entry>h261</entry> |
| 2238 <row><entry>rv10</entry><entry> | 2437 <entry>H.261</entry> |
| 2239 RealVideo 1.0 | 2438 </row> |
| 2240 </entry></row> | 2439 <row> |
| 2241 <row><entry>rv20</entry><entry> | 2440 <entry>h263</entry> |
| 2242 RealVideo 2.0 | 2441 <entry>H.263 </entry> |
| 2243 </entry></row> | 2442 </row> |
| 2244 <row><entry>mpeg1video</entry><entry> | 2443 <row> |
| 2245 MPEG-1 video | 2444 <entry>h263p</entry> |
| 2246 </entry></row> | 2445 <entry>H.263+</entry> |
| 2247 <row><entry>mpeg2video</entry><entry> | 2446 </row> |
| 2248 MPEG-2 video | 2447 <row> |
| 2249 </entry></row> | 2448 <entry>mpeg4</entry> |
| 2250 <row><entry>huffyuv</entry><entry> | 2449 <entry>ISO standard MPEG-4 (DivX, Xvid compatible)</entry> |
| 2251 lossless compression | 2450 </row> |
| 2252 </entry></row> | 2451 <row> |
| 2253 <row><entry>asv1</entry><entry> | 2452 <entry>msmpeg4</entry> |
| 2254 ASUS Video v1 | 2453 <entry>pre-standard MPEG-4 variant by MS, v3 (AKA DivX3)</entry> |
| 2255 </entry></row> | 2454 </row> |
| 2256 <row><entry>asv2</entry><entry> | 2455 <row> |
| 2257 ASUS Video v2 | 2456 <entry>msmpeg4v2</entry> |
| 2258 </entry></row> | 2457 <entry>pre-standard MPEG-4 by MS, v2 (used in old ASF files)</entry> |
| 2259 <row><entry>ffv1</entry><entry> | 2458 </row> |
| 2260 FFmpeg's lossless video codec | 2459 <row> |
| 2261 </entry></row> | 2460 <entry>wmv1</entry> |
| 2262 <row><entry>svq1</entry><entry> | 2461 <entry>Windows Media Video, version 1 (AKA WMV7)</entry> |
| 2263 Sorenson video 1 | 2462 </row> |
| 2264 </entry></row> | 2463 <row> |
| 2265 <row><entry>flv</entry><entry> | 2464 <entry>wmv2</entry> |
| 2266 Sorenson H.263 used in Flash Video | 2465 <entry>Windows Media Video, version 2 (AKA WMV8)</entry> |
| 2267 </entry></row> | 2466 </row> |
| 2268 <row><entry>dvvideo</entry><entry> | 2467 <row> |
| 2269 Sony Digital Video | 2468 <entry>rv10</entry> |
| 2270 </entry></row> | 2469 <entry>RealVideo 1.0</entry> |
| 2271 <row><entry>snow</entry><entry> | 2470 </row> |
| 2272 FFmpeg's experimental wavelet-based codec | 2471 <row> |
| 2273 </entry></row> | 2472 <entry>rv20</entry> |
| 2473 <entry>RealVideo 2.0</entry> | |
| 2474 </row> | |
| 2475 <row> | |
| 2476 <entry>mpeg1video</entry> | |
| 2477 <entry>MPEG-1 video</entry> | |
| 2478 </row> | |
| 2479 <row> | |
| 2480 <entry>mpeg2video</entry> | |
| 2481 <entry>MPEG-2 video</entry> | |
| 2482 </row> | |
| 2483 <row> | |
| 2484 <entry>huffyuv</entry> | |
| 2485 <entry>lossless compression</entry> | |
| 2486 </row> | |
| 2487 <row> | |
| 2488 <entry>ffvhuff</entry> | |
| 2489 <entry>FFmpeg modified huffyuv lossless</entry> | |
| 2490 </row> | |
| 2491 <row> | |
| 2492 <entry>asv1</entry> | |
| 2493 <entry>ASUS Video v1</entry> | |
| 2494 </row> | |
| 2495 <row> | |
| 2496 <entry>asv2</entry> | |
| 2497 <entry>ASUS Video v2</entry> | |
| 2498 </row> | |
| 2499 <row> | |
| 2500 <entry>ffv1</entry> | |
| 2501 <entry>FFmpeg's lossless video codec</entry> | |
| 2502 </row> | |
| 2503 <row> | |
| 2504 <entry>svq1</entry> | |
| 2505 <entry>Sorenson video 1</entry> | |
| 2506 </row> | |
| 2507 <row> | |
| 2508 <entry>flv</entry> | |
| 2509 <entry>Sorenson H.263 used in Flash Video</entry> | |
| 2510 </row> | |
| 2511 <row> | |
| 2512 <entry>flashsv</entry> | |
| 2513 <entry>Flash Screen Video</entry> | |
| 2514 </row> | |
| 2515 <row> | |
| 2516 <entry>dvvideo</entry> | |
| 2517 <entry>Sony Digital Video</entry> | |
| 2518 </row> | |
| 2519 <row> | |
| 2520 <entry>snow</entry> | |
| 2521 <entry>FFmpeg's experimental wavelet-based codec</entry> | |
| 2522 </row> | |
| 2523 <row> | |
| 2524 <entry>zmbv</entry> | |
| 2525 <entry>Zip Motion Blocks Video</entry> | |
| 2526 </row> | |
| 2527 <row> | |
| 2528 <entry>dnxhd</entry> | |
| 2529 <entry>AVID DNxHD</entry> | |
| 2530 </row> | |
| 2274 </tbody> | 2531 </tbody> |
| 2275 </tgroup> | 2532 </tgroup> |
| 2276 </informaltable> | 2533 </informaltable> |
| 2277 | 2534 |
| 2278 The first column contains the codec names that should be passed after the | 2535 The first column contains the codec names that should be passed after the |
| 2279 <literal>vcodec</literal> config, like: <option>-lavcopts vcodec=msmpeg4</option> | 2536 <literal>vcodec</literal> config, |
| 2280 </para> | 2537 like: <option>-lavcopts vcodec=msmpeg4</option> |
| 2281 <informalexample> | 2538 </para> |
| 2282 <para> | 2539 |
| 2540 <informalexample><para> | |
| 2283 An example with MJPEG compression: | 2541 An example with MJPEG compression: |
| 2284 <screen>mencoder dvd://2 -o title2.avi -ovc lavc -lavcopts vcodec=mjpeg -oac copy</screen> | 2542 <screen> |
| 2285 </para> | 2543 mencoder dvd://2 -o <replaceable>title2.avi</replaceable> -ovc lavc -lavcopts vcodec=mjpeg -oac copy |
| 2286 </informalexample> | 2544 </screen> |
| 2545 </para></informalexample> | |
| 2287 </sect2> | 2546 </sect2> |
| 2288 | 2547 |
| 2548 <!-- ********** --> | |
| 2549 | |
| 2289 <sect2 id="menc-feat-enc-libavcodec-audio-codecs"> | 2550 <sect2 id="menc-feat-enc-libavcodec-audio-codecs"> |
| 2290 <title><systemitem class="library">libavcodec</systemitem>'s audio codecs</title> | 2551 <title><systemitem class="library">libavcodec</systemitem>'s |
| 2552 audio codecs</title> | |
| 2553 | |
| 2291 <para> | 2554 <para> |
| 2292 <informaltable frame="all"> | 2555 <informaltable frame="all"> |
| 2293 <tgroup cols="2"> | 2556 <tgroup cols="2"> |
| 2294 <thead> | 2557 <thead> |
| 2295 <row><entry>Audio codec name</entry><entry>Description</entry></row> | 2558 <row><entry>Audio codec name</entry><entry>Description</entry></row> |
| 2296 </thead> | 2559 </thead> |
| 2297 <tbody> | 2560 <tbody> |
| 2298 <row> | 2561 <row> |
| 2299 <entry>mp2</entry> | 2562 <entry>ac3</entry> |
| 2300 <entry>MPEG Layer 2</entry> | 2563 <entry>Dolby Digital (AC-3)</entry> |
| 2301 </row> | 2564 </row> |
| 2302 <row> | 2565 <row> |
| 2303 <entry>ac3</entry> | 2566 <entry>adpcm_*</entry> |
| 2304 <entry>AC3, AKA Dolby Digital</entry> | 2567 <entry>Adaptive PCM formats - see supplementary table</entry> |
| 2305 </row> | 2568 </row> |
| 2306 <row> | 2569 <row> |
| 2307 <entry>adpcm_ima_wav</entry> | 2570 <entry>flac</entry> |
| 2308 <entry>IMA adaptive PCM (4 bits per sample, 4:1 compression)</entry> | 2571 <entry>Free Lossless Audio Codec (FLAC)</entry> |
| 2309 </row> | 2572 </row> |
| 2310 <row> | 2573 <row> |
| 2311 <entry>sonic</entry> | 2574 <entry>g726</entry> |
| 2312 <entry>experimental lossy/lossless codec</entry> | 2575 <entry>G.726 ADPCM</entry> |
| 2313 </row> | 2576 </row> |
| 2577 <row> | |
| 2578 <entry>libamr_nb</entry> | |
| 2579 <entry>3GPP Adaptive Multi-Rate (AMR) narrow-band</entry> | |
| 2580 </row> | |
| 2581 <row> | |
| 2582 <entry>libamr_wb</entry> | |
| 2583 <entry>3GPP Adaptive Multi-Rate (AMR) wide-band</entry> | |
| 2584 </row> | |
| 2585 <row> | |
| 2586 <entry>libfaac</entry> | |
| 2587 <entry>Advanced Audio Coding (AAC) - using FAAC</entry> | |
| 2588 </row> | |
| 2589 <row> | |
| 2590 <entry>libgsm</entry> | |
| 2591 <entry>ETSI GSM 06.10 full rate</entry> | |
| 2592 </row> | |
| 2593 <row> | |
| 2594 <entry>libgsm_ms</entry> | |
| 2595 <entry>Microsoft GSM</entry> | |
| 2596 </row> | |
| 2597 <row> | |
| 2598 <entry>libmp3lame</entry> | |
| 2599 <entry>MPEG-1 audio layer 3 (MP3) - using LAME</entry> | |
| 2600 </row> | |
| 2601 <row> | |
| 2602 <entry>mp2</entry> | |
| 2603 <entry>MPEG-1 audio layer 2 (MP2)</entry> | |
| 2604 </row> | |
| 2605 <row> | |
| 2606 <entry>pcm_*</entry> | |
| 2607 <entry>PCM formats - see supplementary table</entry> | |
| 2608 </row> | |
| 2609 <row> | |
| 2610 <entry>roq_dpcm</entry> | |
| 2611 <entry>Id Software RoQ DPCM</entry> | |
| 2612 </row> | |
| 2613 <row> | |
| 2614 <entry>sonic</entry> | |
| 2615 <entry>experimental FFmpeg lossy codec</entry> | |
| 2616 </row> | |
| 2617 <row> | |
| 2618 <entry>sonicls</entry> | |
| 2619 <entry>experimental FFmpeg lossless codec</entry> | |
| 2620 </row> | |
| 2621 <row> | |
| 2622 <entry>vorbis</entry> | |
| 2623 <entry>Vorbis</entry> | |
| 2624 </row> | |
| 2625 <row> | |
| 2626 <entry>wmav1</entry> | |
| 2627 <entry>Windows Media Audio v1</entry> | |
| 2628 </row> | |
| 2629 <row> | |
| 2630 <entry>wmav2</entry> | |
| 2631 <entry>Windows Media Audio v2</entry> | |
| 2632 </row> | |
| 2314 </tbody> | 2633 </tbody> |
| 2315 </tgroup> | 2634 </tgroup> |
| 2316 </informaltable> | 2635 </informaltable> |
| 2317 | 2636 |
| 2318 The first column contains the codec names that should be passed after the | 2637 The first column contains the codec names that should be passed after the |
| 2319 <literal>acodec</literal> option, like: <option>-lavcopts acodec=ac3</option> | 2638 <literal>acodec</literal> option, like: <option>-lavcopts acodec=ac3</option> |
| 2320 </para> | 2639 </para> |
| 2321 | 2640 |
| 2322 <informalexample> | 2641 <informalexample><para> |
| 2323 <para> | 2642 An example with AC-3 compression: |
| 2324 An example with AC3 compression: | 2643 <screen> |
| 2325 <screen>mencoder dvd://2 -o title2.avi -oac lavc -lavcopts acodec=ac3 -ovc copy</screen> | 2644 mencoder dvd://2 -o <replaceable>title2.avi</replaceable> -oac lavc -lavcopts acodec=ac3 -ovc copy |
| 2326 </para> | 2645 </screen> |
| 2327 </informalexample> | 2646 </para></informalexample> |
| 2328 | 2647 |
| 2329 <para> | 2648 <para> |
| 2330 Contrary to <systemitem class="library">libavcodec</systemitem>'s video | 2649 Contrary to <systemitem class="library">libavcodec</systemitem>'s video |
| 2331 codecs, its audio codecs do not make a wise usage of the bits they are | 2650 codecs, its audio codecs do not make a wise usage of the bits they are |
| 2332 given as they lack some minimal psychoacoustic model (if at all) | 2651 given as they lack some minimal psychoacoustic model (if at all) |
| 2333 which most other codec implementations feature. | 2652 which most other codec implementations feature. |
| 2334 However, note that all these audio codecs are very fast and work | 2653 However, note that all these audio codecs are very fast and work |
| 2335 out-of-the-box everywhere <application>MEncoder</application> has been | 2654 out-of-the-box everywhere <application>MEncoder</application> has been |
| 2336 compiled with <systemitem class="library">libavcodec</systemitem> (which | 2655 compiled with <systemitem class="library">libavcodec</systemitem> (which |
| 2337 is the case most of time), and do not depend on external libraries. | 2656 is the case most of time), and do not depend on external libraries. |
| 2338 </para> | 2657 </para> |
| 2658 | |
| 2659 <sect3 id="menc-feat-enc-libavcodec-audio-codecs-pcmadpcm"> | |
| 2660 <title>PCM/ADPCM format supplementary table</title> | |
| 2661 | |
| 2662 <para> | |
| 2663 <informaltable frame="all"> | |
| 2664 <tgroup cols="2"> | |
| 2665 <thead> | |
| 2666 <row><entry>PCM/ADPCM codec name</entry><entry>Description</entry></row> | |
| 2667 </thead> | |
| 2668 <tbody> | |
| 2669 <row> | |
| 2670 <entry>pcm_s32le</entry> | |
| 2671 <entry>signed 32-bit little-endian</entry> | |
| 2672 </row> | |
| 2673 <row> | |
| 2674 <entry>pcm_s32be</entry> | |
| 2675 <entry>signed 32-bit big-endian</entry> | |
| 2676 </row> | |
| 2677 <row> | |
| 2678 <entry>pcm_u32le</entry> | |
| 2679 <entry>unsigned 32-bit little-endian</entry> | |
| 2680 </row> | |
| 2681 <row> | |
| 2682 <entry>pcm_u32be</entry> | |
| 2683 <entry>unsigned 32-bit big-endian</entry> | |
| 2684 </row> | |
| 2685 <row> | |
| 2686 <entry>pcm_s24le</entry> | |
| 2687 <entry>signed 24-bit little-endian</entry> | |
| 2688 </row> | |
| 2689 <row> | |
| 2690 <entry>pcm_s24be</entry> | |
| 2691 <entry>signed 24-bit big-endian</entry> | |
| 2692 </row> | |
| 2693 <row> | |
| 2694 <entry>pcm_u24le</entry> | |
| 2695 <entry>unsigned 24-bit little-endian</entry> | |
| 2696 </row> | |
| 2697 <row> | |
| 2698 <entry>pcm_u24be</entry> | |
| 2699 <entry>unsigned 24-bit big-endian</entry> | |
| 2700 </row> | |
| 2701 <row> | |
| 2702 <entry>pcm_s16le</entry> | |
| 2703 <entry>signed 16-bit little-endian</entry> | |
| 2704 </row> | |
| 2705 <row> | |
| 2706 <entry>pcm_s16be</entry> | |
| 2707 <entry>signed 16-bit big-endian</entry> | |
| 2708 </row> | |
| 2709 <row> | |
| 2710 <entry>pcm_u16le</entry> | |
| 2711 <entry>unsigned 16-bit little-endian</entry> | |
| 2712 </row> | |
| 2713 <row> | |
| 2714 <entry>pcm_u16be</entry> | |
| 2715 <entry>unsigned 16-bit big-endian</entry> | |
| 2716 </row> | |
| 2717 <row> | |
| 2718 <entry>pcm_s8</entry> | |
| 2719 <entry>signed 8-bit</entry> | |
| 2720 </row> | |
| 2721 <row> | |
| 2722 <entry>pcm_u8</entry> | |
| 2723 <entry>unsigned 8-bit</entry> | |
| 2724 </row> | |
| 2725 <row> | |
| 2726 <entry>pcm_alaw</entry> | |
| 2727 <entry>G.711 A-LAW </entry> | |
| 2728 </row> | |
| 2729 <row> | |
| 2730 <entry>pcm_mulaw</entry> | |
| 2731 <entry>G.711 μ-LAW</entry> | |
| 2732 </row> | |
| 2733 <row> | |
| 2734 <entry>pcm_s24daud</entry> | |
| 2735 <entry>signed 24-bit D-Cinema Audio format</entry> | |
| 2736 </row> | |
| 2737 <row> | |
| 2738 <entry>pcm_zork</entry> | |
| 2739 <entry>Activision Zork Nemesis</entry> | |
| 2740 </row> | |
| 2741 <row> | |
| 2742 <entry>adpcm_ima_qt</entry> | |
| 2743 <entry>Apple QuickTime</entry> | |
| 2744 </row> | |
| 2745 <row> | |
| 2746 <entry>adpcm_ima_wav</entry> | |
| 2747 <entry>Microsoft/IBM WAVE</entry> | |
| 2748 </row> | |
| 2749 <row> | |
| 2750 <entry>adpcm_ima_dk3</entry> | |
| 2751 <entry>Duck DK3</entry> | |
| 2752 </row> | |
| 2753 <row> | |
| 2754 <entry>adpcm_ima_dk4</entry> | |
| 2755 <entry>Duck DK4</entry> | |
| 2756 </row> | |
| 2757 <row> | |
| 2758 <entry>adpcm_ima_ws</entry> | |
| 2759 <entry>Westwood Studios</entry> | |
| 2760 </row> | |
| 2761 <row> | |
| 2762 <entry>adpcm_ima_smjpeg</entry> | |
| 2763 <entry>SDL Motion JPEG</entry> | |
| 2764 </row> | |
| 2765 <row> | |
| 2766 <entry>adpcm_ms</entry> | |
| 2767 <entry>Microsoft</entry> | |
| 2768 </row> | |
| 2769 <row> | |
| 2770 <entry>adpcm_4xm</entry> | |
| 2771 <entry>4X Technologies</entry> | |
| 2772 </row> | |
| 2773 <row> | |
| 2774 <entry>adpcm_xa</entry> | |
| 2775 <entry>Phillips Yellow Book CD-ROM eXtended Architecture</entry> | |
| 2776 </row> | |
| 2777 <row> | |
| 2778 <entry>adpcm_ea</entry> | |
| 2779 <entry>Electronic Arts</entry> | |
| 2780 </row> | |
| 2781 <row> | |
| 2782 <entry>adpcm_ct</entry> | |
| 2783 <entry>Creative 16->4-bit</entry> | |
| 2784 </row> | |
| 2785 <row> | |
| 2786 <entry>adpcm_swf</entry> | |
| 2787 <entry>Adobe Shockwave Flash</entry> | |
| 2788 </row> | |
| 2789 <row> | |
| 2790 <entry>adpcm_yamaha</entry> | |
| 2791 <entry>Yamaha</entry> | |
| 2792 </row> | |
| 2793 <row> | |
| 2794 <entry>adpcm_sbpro_4</entry> | |
| 2795 <entry>Creative VOC SoundBlaster Pro 8->4-bit</entry> | |
| 2796 </row> | |
| 2797 <row> | |
| 2798 <entry>adpcm_sbpro_3</entry> | |
| 2799 <entry>Creative VOC SoundBlaster Pro 8->2.6-bit</entry> | |
| 2800 </row> | |
| 2801 <row> | |
| 2802 <entry>adpcm_sbpro_2</entry> | |
| 2803 <entry>Creative VOC SoundBlaster Pro 8->2-bit</entry> | |
| 2804 </row> | |
| 2805 <row> | |
| 2806 <entry>adpcm_thp</entry> | |
| 2807 <entry>Nintendo GameCube FMV THP</entry> | |
| 2808 </row> | |
| 2809 <row> | |
| 2810 <entry>adpcm_adx</entry> | |
| 2811 <entry>Sega/CRI ADX</entry> | |
| 2812 </row> | |
| 2813 </tbody> | |
| 2814 </tgroup> | |
| 2815 </informaltable> | |
| 2816 </para> | |
| 2817 </sect3> | |
| 2818 | |
| 2339 </sect2> | 2819 </sect2> |
| 2340 | 2820 |
| 2821 <!-- ********** --> | |
| 2341 | 2822 |
| 2342 <sect2 id="menc-feat-dvd-mpeg4-lavc-encoding-options"> | 2823 <sect2 id="menc-feat-dvd-mpeg4-lavc-encoding-options"> |
| 2343 <title>Encoding options of libavcodec</title> | 2824 <title>Encoding options of libavcodec</title> |
| 2344 | 2825 |
| 2345 <para> | 2826 <para> |
| 2346 Ideally, you would probably want to be able to just tell the encoder to switch | 2827 Ideally, you would probably want to be able to just tell the encoder to switch |
| 2347 into "high quality" mode and move on. | 2828 into "high quality" mode and move on. |
| 2348 That would probably be nice, but unfortunately hard to implement as different | 2829 That would probably be nice, but unfortunately hard to implement as different |
| 2349 encoding options yield different quality results depending on the source material. | 2830 encoding options yield different quality results depending on the source |
| 2350 That is because compression depends on the visual properties of the video | 2831 material. That is because compression depends on the visual properties of the |
| 2351 in question. | 2832 video in question. |
| 2352 For example, anime and live action have very different properties and | 2833 For example, Anime and live action have very different properties and |
| 2353 thus require different options to obtain optimum encoding. | 2834 thus require different options to obtain optimum encoding. |
| 2354 The good news is that some options should never be left out, like | 2835 The good news is that some options should never be left out, like |
| 2355 <option>mbd=2</option>, <option>trell</option>, and <option>v4mv</option>. | 2836 <option>mbd=2</option>, <option>trell</option>, and <option>v4mv</option>. |
| 2356 See below for a detailed description of common encoding options. | 2837 See below for a detailed description of common encoding options. |
| 2357 </para> | 2838 </para> |
| 2358 | |
| 2359 | 2839 |
| 2360 <itemizedlist> | 2840 <itemizedlist> |
| 2361 <title>Options to adjust:</title> | 2841 <title>Options to adjust:</title> |
| 2362 <listitem><para> | 2842 <listitem><para> |
| 2363 <emphasis role="bold">vmax_b_frames</emphasis>: 1 or 2 is good, depending on | 2843 <emphasis role="bold">vmax_b_frames</emphasis>: 1 or 2 is good, depending on |
| 2366 need to activate closed GOP support, using | 2846 need to activate closed GOP support, using |
| 2367 <systemitem class="library">libavcodec</systemitem>'s <option>cgop</option> | 2847 <systemitem class="library">libavcodec</systemitem>'s <option>cgop</option> |
| 2368 option, but you need to deactivate scene detection, which | 2848 option, but you need to deactivate scene detection, which |
| 2369 is not a good idea as it will hurt encode efficiency a bit. | 2849 is not a good idea as it will hurt encode efficiency a bit. |
| 2370 </para></listitem> | 2850 </para></listitem> |
| 2371 | |
| 2372 <listitem><para> | 2851 <listitem><para> |
| 2373 <emphasis role="bold">vb_strategy=1</emphasis>: helps in high-motion scenes. | 2852 <emphasis role="bold">vb_strategy=1</emphasis>: helps in high-motion scenes. |
| 2374 On some videos, vmax_b_frames may hurt quality, but vmax_b_frames=2 along | 2853 On some videos, vmax_b_frames may hurt quality, but vmax_b_frames=2 along |
| 2375 with vb_strategy=1 helps. | 2854 with vb_strategy=1 helps. |
| 2376 </para></listitem> | 2855 </para></listitem> |
| 2377 | |
| 2378 <listitem><para> | 2856 <listitem><para> |
| 2379 <emphasis role="bold">dia</emphasis>: motion search range. Bigger is better | 2857 <emphasis role="bold">dia</emphasis>: motion search range. Bigger is better |
| 2380 and slower. | 2858 and slower. |
| 2381 Negative values are a completely different scale. | 2859 Negative values are a completely different scale. |
| 2382 Good values are -1 for a fast encode, or 2-4 for slower. | 2860 Good values are -1 for a fast encode, or 2-4 for slower. |
| 2383 </para></listitem> | 2861 </para></listitem> |
| 2384 | |
| 2385 <listitem><para> | 2862 <listitem><para> |
| 2386 <emphasis role="bold">predia</emphasis>: motion search pre-pass. | 2863 <emphasis role="bold">predia</emphasis>: motion search pre-pass. |
| 2387 Not as important as dia. Good values are 1 (default) to 4. Requires preme=2 | 2864 Not as important as dia. Good values are 1 (default) to 4. Requires preme=2 |
| 2388 to really be useful. | 2865 to really be useful. |
| 2389 </para></listitem> | 2866 </para></listitem> |
| 2390 | |
| 2391 <listitem><para> | 2867 <listitem><para> |
| 2392 <emphasis role="bold">cmp, subcmp, precmp</emphasis>: Comparison function for | 2868 <emphasis role="bold">cmp, subcmp, precmp</emphasis>: Comparison function for |
| 2393 motion estimation. | 2869 motion estimation. |
| 2394 Experiment with values of 0 (default), 2 (hadamard), 3 (dct), and 6 (rate | 2870 Experiment with values of 0 (default), 2 (hadamard), 3 (dct), and 6 (rate |
| 2395 distortion). | 2871 distortion). |
| 2396 0 is fastest, and sufficient for precmp. | 2872 0 is fastest, and sufficient for precmp. |
| 2397 For cmp and subcmp, 2 is good for anime, and 3 is good for live action. | 2873 For cmp and subcmp, 2 is good for Anime, and 3 is good for live action. |
| 2398 6 may or may not be slightly better, but is slow. | 2874 6 may or may not be slightly better, but is slow. |
| 2399 </para></listitem> | 2875 </para></listitem> |
| 2400 | |
| 2401 <listitem><para> | 2876 <listitem><para> |
| 2402 <emphasis role="bold">last_pred</emphasis>: Number of motion predictors to | 2877 <emphasis role="bold">last_pred</emphasis>: Number of motion predictors to |
| 2403 take from the previous frame. | 2878 take from the previous frame. |
| 2404 1-3 or so help at little speed cost. | 2879 1-3 or so help at little speed cost. |
| 2405 Higher values are slow for no extra gain. | 2880 Higher values are slow for no extra gain. |
| 2406 </para></listitem> | 2881 </para></listitem> |
| 2407 | 2882 <listitem><para> |
| 2408 <listitem><para> | 2883 <emphasis role="bold">cbp, mv0</emphasis>: Controls the selection of |
| 2409 <emphasis role="bold">cbp, mv0</emphasis>: Controls the selection of macroblocks. | 2884 macroblocks. Small speed cost for small quality gain. |
| 2410 Small speed cost for small quality gain. | 2885 </para></listitem> |
| 2411 </para></listitem> | |
| 2412 | |
| 2413 <listitem><para> | 2886 <listitem><para> |
| 2414 <emphasis role="bold">qprd</emphasis>: adaptive quantization based on the | 2887 <emphasis role="bold">qprd</emphasis>: adaptive quantization based on the |
| 2415 macroblock's complexity. | 2888 macroblock's complexity. |
| 2416 May help or hurt depending on the video and other options. | 2889 May help or hurt depending on the video and other options. |
| 2417 This can cause artifacts unless you set vqmax to some reasonably small value | 2890 This can cause artifacts unless you set vqmax to some reasonably small value |
| 2418 (6 is good, maybe as low as 4); vqmin=1 should also help. | 2891 (6 is good, maybe as low as 4); vqmin=1 should also help. |
| 2419 </para></listitem> | 2892 </para></listitem> |
| 2420 | |
| 2421 <listitem><para> | 2893 <listitem><para> |
| 2422 <emphasis role="bold">qns</emphasis>: very slow, especially when combined | 2894 <emphasis role="bold">qns</emphasis>: very slow, especially when combined |
| 2423 with qprd. | 2895 with qprd. |
| 2424 This option will make the encoder minimize noise due to compression | 2896 This option will make the encoder minimize noise due to compression |
| 2425 artifacts instead of making the encoded video strictly match the source. | 2897 artifacts instead of making the encoded video strictly match the source. |
| 2426 Do not use this unless you have already tweaked everything else as far as it | 2898 Do not use this unless you have already tweaked everything else as far as it |
| 2427 will go and the results still are not good enough. | 2899 will go and the results still are not good enough. |
| 2428 </para></listitem> | 2900 </para></listitem> |
| 2429 | |
| 2430 <listitem><para> | 2901 <listitem><para> |
| 2431 <emphasis role="bold">vqcomp</emphasis>: Tweak ratecontrol. | 2902 <emphasis role="bold">vqcomp</emphasis>: Tweak ratecontrol. |
| 2432 What values are good depends on the movie. | 2903 What values are good depends on the movie. |
| 2433 You can safely leave this alone if you want. | 2904 You can safely leave this alone if you want. |
| 2434 Reducing vqcomp puts more bits on low-complexity scenes, increasing it puts | 2905 Reducing vqcomp puts more bits on low-complexity scenes, increasing it puts |
| 2435 them on high-complexity scenes (default: 0.5, range: 0-1. recommended range: | 2906 them on high-complexity scenes (default: 0.5, range: 0-1. recommended range: |
| 2436 0.5-0.7). | 2907 0.5-0.7). |
| 2437 </para></listitem> | 2908 </para></listitem> |
| 2438 | |
| 2439 <listitem><para> | 2909 <listitem><para> |
| 2440 <emphasis role="bold">vlelim, vcelim</emphasis>: Sets the single coefficient | 2910 <emphasis role="bold">vlelim, vcelim</emphasis>: Sets the single coefficient |
| 2441 elimination threshold for luminance and chroma planes. | 2911 elimination threshold for luminance and chroma planes. |
| 2442 These are encoded separately in all MPEG-like algorithms. | 2912 These are encoded separately in all MPEG-like algorithms. |
| 2443 The idea behind these options is to use some good heuristics to determine | 2913 The idea behind these options is to use some good heuristics to determine |
| 2444 when the change in a block is less than the threshold you specify, and in | 2914 when the change in a block is less than the threshold you specify, and in |
| 2445 such a case, to just encode the block as "no change". | 2915 such a case, to just encode the block as "no change". |
| 2446 This saves bits and perhaps speeds up encoding. vlelim=-4 and vcelim=9 | 2916 This saves bits and perhaps speeds up encoding. vlelim=-4 and vcelim=9 |
| 2447 seem to be good for live movies, but seem not to help with anime; | 2917 seem to be good for live movies, but seem not to help with Anime; |
| 2448 when encoding animation, you should probably leave them unchanged. | 2918 when encoding animation, you should probably leave them unchanged. |
| 2449 </para></listitem> | 2919 </para></listitem> |
| 2450 | |
| 2451 <listitem><para> | 2920 <listitem><para> |
| 2452 <emphasis role="bold">qpel</emphasis>: Quarter pixel motion estimation. | 2921 <emphasis role="bold">qpel</emphasis>: Quarter pixel motion estimation. |
| 2453 MPEG-4 uses half pixel precision for its motion search by default, | 2922 MPEG-4 uses half pixel precision for its motion search by default, |
| 2454 therefore this option comes with an overhead as more information will be | 2923 therefore this option comes with an overhead as more information will be |
| 2455 stored in the encoded file. | 2924 stored in the encoded file. |
| 2456 The compression gain/loss depends on the movie, but it is usually not very | 2925 The compression gain/loss depends on the movie, but it is usually not very |
| 2457 effective on anime. | 2926 effective on Anime. |
| 2458 qpel always incurs a significant cost in CPU decode time (+25% in | 2927 qpel always incurs a significant cost in CPU decode time (+25% in |
| 2459 practice). | 2928 practice). |
| 2460 </para></listitem> | 2929 </para></listitem> |
| 2461 | |
| 2462 <listitem><para> | 2930 <listitem><para> |
| 2463 <emphasis role="bold">psnr</emphasis>: does not affect the actual encoding, | 2931 <emphasis role="bold">psnr</emphasis>: does not affect the actual encoding, |
| 2464 but writes a log file giving the type/size/quality of each frame, and | 2932 but writes a log file giving the type/size/quality of each frame, and |
| 2465 prints a summary of PSNR (Peak Signal to Noise Ratio) at the end. | 2933 prints a summary of PSNR (Peak Signal to Noise Ratio) at the end. |
| 2466 </para></listitem> | 2934 </para></listitem> |
| 2467 | |
| 2468 </itemizedlist> | 2935 </itemizedlist> |
| 2469 | 2936 |
| 2470 <itemizedlist> | 2937 <itemizedlist> |
| 2471 <title>Options not recommended to play with:</title> | 2938 <title>Options not recommended to play with:</title> |
| 2472 <listitem><para> | 2939 <listitem><para> |
| 2473 <emphasis role="bold">vme</emphasis>: The default is best. | 2940 <emphasis role="bold">vme</emphasis>: The default is best. |
| 2474 </para></listitem> | 2941 </para></listitem> |
| 2475 | |
| 2476 <listitem><para> | 2942 <listitem><para> |
| 2477 <emphasis role="bold">lumi_mask, dark_mask</emphasis>: Psychovisual adaptive | 2943 <emphasis role="bold">lumi_mask, dark_mask</emphasis>: Psychovisual adaptive |
| 2478 quantization. | 2944 quantization. |
| 2479 You do not want to play with those options if you care about quality. | 2945 You do not want to play with those options if you care about quality. |
| 2480 Reasonable values may be effective in your case, but be warned this is very | 2946 Reasonable values may be effective in your case, but be warned this is very |
| 2481 subjective. | 2947 subjective. |
| 2482 </para></listitem> | 2948 </para></listitem> |
| 2483 | |
| 2484 <listitem><para> | 2949 <listitem><para> |
| 2485 <emphasis role="bold">scplx_mask</emphasis>: Tries to prevent blocky | 2950 <emphasis role="bold">scplx_mask</emphasis>: Tries to prevent blocky |
| 2486 artifacts, but postprocessing is better. | 2951 artifacts, but postprocessing is better. |
| 2487 </para></listitem> | 2952 </para></listitem> |
| 2488 </itemizedlist> | 2953 </itemizedlist> |
| 2489 </sect2> | 2954 </sect2> |
| 2490 | 2955 |
| 2956 <!-- ********** --> | |
| 2957 | |
| 2491 <sect2 id="menc-feat-mpeg4-lavc-example-settings"> | 2958 <sect2 id="menc-feat-mpeg4-lavc-example-settings"> |
| 2492 <title>Encoding setting examples</title> | 2959 <title>Encoding setting examples</title> |
| 2493 | 2960 |
| 2494 <para> | 2961 <para> |
| 2495 The following settings are examples of different encoding | 2962 The following settings are examples of different encoding |
| 2496 option combinations that affect the speed vs quality tradeoff | 2963 option combinations that affect the speed vs quality tradeoff |
| 2497 at the same target bitrate. | 2964 at the same target bitrate. |
| 2498 </para> | 2965 </para> |
| 2499 | 2966 |
| 2500 <para> | 2967 <para> |
| 2501 All the encoding settings were tested on a 720x448 @30000/1001 fps | 2968 All the encoding settings were tested on a 720x448 @30000/1001 fps |
| 2502 video sample, the target bitrate was 900kbps, and the machine was an | 2969 video sample, the target bitrate was 900kbps, and the machine was an |
| 2503 AMD-64 3400+ at 2400 Mhz in 64 bits mode. | 2970 AMD-64 3400+ at 2400 MHz in 64 bits mode. |
| 2504 Each encoding setting features the measured encoding speed (in | 2971 Each encoding setting features the measured encoding speed (in |
| 2505 frames per second) and the PSNR loss (in dB) compared to the "very | 2972 frames per second) and the PSNR loss (in dB) compared to the "very |
| 2506 high quality" setting. | 2973 high quality" setting. |
| 2507 Please understand that depending on your source, your machine type | 2974 Please understand that depending on your source, your machine type |
| 2508 and development advancements, you may get very different results. | 2975 and development advancements, you may get very different results. |
| 2509 </para> | 2976 </para> |
| 2510 | 2977 |
| 2511 <para> | 2978 <para> |
| 2512 <informaltable frame="all"> | 2979 <informaltable frame="all"> |
| 2513 <tgroup cols="4"> | 2980 <tgroup cols="4"> |
| 2514 <thead> | 2981 <thead> |
| 2515 <row><entry>Description</entry><entry>Encoding options</entry><entry>speed (in fps)</entry><entry>Relative PSNR loss (in dB)</entry></row> | 2982 <row> |
| 2983 <entry>Description</entry> | |
| 2984 <entry>Encoding options</entry> | |
| 2985 <entry>speed (in fps)</entry> | |
| 2986 <entry>Relative PSNR loss (in dB)</entry> | |
| 2987 </row> | |
| 2516 </thead> | 2988 </thead> |
| 2517 <tbody> | 2989 <tbody> |
| 2518 <row> | 2990 <row> |
| 2519 <entry>Very high quality</entry> | 2991 <entry>Very high quality</entry> |
| 2520 <entry><option>vcodec=mpeg4:mbd=2:mv0:trell:v4mv:cbp:last_pred=3:predia=2:dia=2:vmax_b_frames=2:vb_strategy=1:precmp=2:cmp=2:subcmp=2:preme=2:vme=5:naq:qns=2</option></entry> | 2992 <entry><option>vcodec=mpeg4:mbd=2:mv0:trell:v4mv:cbp:last_pred=3:predia=2:dia=2:vmax_b_frames=2:vb_strategy=1:precmp=2:cmp=2:subcmp=2:preme=2:qns=2</option></entry> |
| 2521 <entry>6fps</entry> | 2993 <entry>6fps</entry> |
| 2522 <entry>0dB</entry> | 2994 <entry>0dB</entry> |
| 2523 </row> | 2995 </row> |
| 2524 <row> | 2996 <row> |
| 2525 <entry>High quality</entry> | 2997 <entry>High quality</entry> |
| 2543 </tgroup> | 3015 </tgroup> |
| 2544 </informaltable> | 3016 </informaltable> |
| 2545 </para> | 3017 </para> |
| 2546 </sect2> | 3018 </sect2> |
| 2547 | 3019 |
| 2548 <sect2 id="custommatrices"><title>Custom inter/intra matrices</title> | 3020 <!-- ********** --> |
| 3021 | |
| 3022 <sect2 id="custommatrices"> | |
| 3023 <title>Custom inter/intra matrices</title> | |
| 2549 | 3024 |
| 2550 <para> | 3025 <para> |
| 2551 With this feature of | 3026 With this feature of |
| 2552 <link linkend="ffmpeg"><systemitem class="library">libavcodec</systemitem></link> | 3027 <systemitem class="library">libavcodec</systemitem> |
| 2553 you are able to set custom inter (I-frames/keyframes) and intra | 3028 you are able to set custom inter (I-frames/keyframes) and intra |
| 2554 (P-frames/predicted frames) matrices. It is supported by many of the codecs: | 3029 (P-frames/predicted frames) matrices. It is supported by many of the codecs: |
| 2555 <systemitem>mpeg1video</systemitem> and <systemitem>mpeg2video</systemitem> | 3030 <systemitem>mpeg1video</systemitem> and <systemitem>mpeg2video</systemitem> |
| 2556 are reported as working. | 3031 are reported as working. |
| 2557 </para> | 3032 </para> |
| 2560 A typical usage of this feature is to set the matrices preferred by the | 3035 A typical usage of this feature is to set the matrices preferred by the |
| 2561 <ulink url="http://www.kvcd.net/">KVCD</ulink> specifications. | 3036 <ulink url="http://www.kvcd.net/">KVCD</ulink> specifications. |
| 2562 </para> | 3037 </para> |
| 2563 | 3038 |
| 2564 <para> | 3039 <para> |
| 2565 The <emphasis role="bold">KVCD "Notch" Quantization Matrix:</emphasis> | 3040 The <emphasis role="bold">KVCD "Notch" Quantization Matrix:</emphasis> |
| 2566 </para> | 3041 </para> |
| 2567 | 3042 |
| 2568 <para> | 3043 <para> |
| 2569 Intra: | 3044 Intra: |
| 2570 <screen> | 3045 <screen> |
| 2592 </para> | 3067 </para> |
| 2593 | 3068 |
| 2594 <para> | 3069 <para> |
| 2595 Usage: | 3070 Usage: |
| 2596 <screen> | 3071 <screen> |
| 2597 $ mencoder <replaceable>input.avi</replaceable> -o <replaceable>output.avi</replaceable> -oac copy -ovc lavc -lavcopts inter_matrix=...:intra_matrix=... | 3072 mencoder <replaceable>input.avi</replaceable> -o <replaceable>output.avi</replaceable> -oac copy -ovc lavc \ |
| 3073 -lavcopts inter_matrix=...:intra_matrix=... | |
| 2598 </screen> | 3074 </screen> |
| 2599 </para> | 3075 </para> |
| 2600 | 3076 |
| 2601 <para> | 3077 <para> |
| 2602 <screen> | 3078 <screen> |
| 2603 $ mencoder <replaceable>input.avi</replaceable> -ovc lavc -lavcopts | 3079 mencoder <replaceable>input.avi</replaceable> -ovc lavc -lavcopts \ |
| 2604 vcodec=mpeg2video:intra_matrix=8,9,12,22,26,27,29,34,9,10,14,26,27,29,34,37, | 3080 vcodec=mpeg2video:intra_matrix=8,9,12,22,26,27,29,34,9,10,14,26,27,29,34,37,\ |
| 2605 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, | 3081 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,\ |
| 2606 29,34,37,38,40,48,58,29,34,37,38,40,48,58,69,34,37,38,40,48,58,69,79 | 3082 29,34,37,38,40,48,58,29,34,37,38,40,48,58,69,34,37,38,40,48,58,69,79\ |
| 2607 :inter_matrix=16,18,20,22,24,26,28,30,18,20,22,24,26,28,30,32,20,22,24,26, | 3083 :inter_matrix=16,18,20,22,24,26,28,30,18,20,22,24,26,28,30,32,20,22,24,26,\ |
| 2608 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, | 3084 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,\ |
| 2609 36,38,40,28,30,32,34,36,38,42,42,30,32,34,36,38,40,42,44 -oac copy -o svcd.mpg | 3085 36,38,40,28,30,32,34,36,38,42,42,30,32,34,36,38,40,42,44 -oac copy -o svcd.mpg |
| 2610 </screen> | 3086 </screen> |
| 2611 </para> | 3087 </para> |
| 2612 </sect2> | 3088 </sect2> |
| 2613 | 3089 |
| 3090 <!-- ********** --> | |
| 2614 | 3091 |
| 2615 <sect2 id="menc-feat-dvd-mpeg4-example"> | 3092 <sect2 id="menc-feat-dvd-mpeg4-example"> |
| 2616 <title>Example</title> | 3093 <title>Example</title> |
| 2617 | 3094 |
| 2618 <para> | 3095 <para> |
| 2619 So, you have just bought your shiny new copy of Harry Potter and the Chamber | 3096 So, you have just bought your shiny new copy of Harry Potter and the Chamber |
| 2620 of Secrets (widescreen edition, of course), and you want to rip this DVD | 3097 of Secrets (widescreen edition, of course), and you want to rip this DVD |
| 2621 so that you can add it to your Home Theatre PC. This is a region 1 DVD, | 3098 so that you can add it to your Home Theatre PC. This is a region 1 DVD, |
| 2622 so it is NTSC. The example below will still apply to PAL, except you will | 3099 so it is NTSC. The example below will still apply to PAL, except you will |
| 2623 omit <option>-ofps 24000/1001</option> (because the output framerate is the | 3100 omit <option>-ofps 24000/1001</option> (because the output framerate is the |
| 2624 same as the input framerate), and of course the crop dimensions will be | 3101 same as the input framerate), and of course the crop dimensions will be |
| 2625 different. | 3102 different. |
| 2626 </para> | 3103 </para> |
| 2627 | 3104 |
| 2628 <para> | 3105 <para> |
| 2629 After running <option>mplayer dvd://1</option>, we follow the process | 3106 After running <option>mplayer dvd://1</option>, we follow the process |
| 2630 detailed in the section <link linkend="menc-feat-telecine">How to deal | 3107 detailed in the section <link linkend="menc-feat-telecine">How to deal |
| 2631 with telecine and interlacing in NTSC DVDs</link> and discover that it is | 3108 with telecine and interlacing in NTSC DVDs</link> and discover that it is |
| 2632 24000/1001 fps progressive video, which means that we need not use an inverse | 3109 24000/1001 fps progressive video, which means that we need not use an inverse |
| 2633 telecine filter, such as <option>pullup</option> or | 3110 telecine filter, such as <option>pullup</option> or |
| 2634 <option>filmdint</option>. | 3111 <option>filmdint</option>. |
| 2635 </para> | 3112 </para> |
| 2636 | 3113 |
| 2637 <para> | 3114 <para id="menc-feat-dvd-mpeg4-example-crop"> |
| 2638 Next, we want to determine the appropriate crop rectangle, so we use the | 3115 Next, we want to determine the appropriate crop rectangle, so we use the |
| 2639 cropdetect filter: | 3116 cropdetect filter: |
| 2640 | 3117 <screen>mplayer dvd://1 -vf cropdetect</screen> |
| 2641 <screen>mplayer dvd://1 -vf cropdetect</screen> | 3118 Make sure you seek to a fully filled frame (such as a bright scene, |
| 2642 | 3119 past the opening credits and logos), and |
| 2643 Make sure you seek to a fully filled frame (such as a bright scene), and | 3120 you will see in <application>MPlayer</application>'s console output: |
| 2644 you will see in <application>MPlayer</application>'s console output: | 3121 <screen>crop area: X: 0..719 Y: 57..419 (-vf crop=720:362:0:58)</screen> |
| 2645 | 3122 We then play the movie back with this filter to test its correctness: |
| 2646 <screen>crop area: X: 0..719 Y: 57..419 (-vf crop=720:362:0:58)</screen> | 3123 <screen>mplayer dvd://1 -vf crop=720:362:0:58</screen> |
| 2647 | 3124 And we see that it looks perfectly fine. Next, we ensure the width and |
| 2648 We then play the movie back with this filter to test its correctness: | 3125 height are a multiple of 16. The width is fine, however the height is |
| 2649 | 3126 not. Since we did not fail 7th grade math, we know that the nearest |
| 2650 <screen>mplayer dvd://1 -vf crop=720:362:0:58</screen> | 3127 multiple of 16 lower than 362 is 352. |
| 2651 | 3128 </para> |
| 2652 And we see that it looks perfectly fine. Next, we ensure the width and | 3129 |
| 2653 height are a multiple of 16. The width is fine, however the height is | 3130 <para> |
| 2654 not. Since we did not fail 7th grade math, we know that the nearest | 3131 We could just use <option>crop=720:352:0:58</option>, but it would be nice |
| 2655 multiple of 16 lower than 362 is 352. | 3132 to take a little off the top and a little off the bottom so that we |
| 2656 </para> | 3133 retain the center. We have shrunk the height by 10 pixels, but we do not |
| 2657 | 3134 want to increase the y-offset by 5-pixels since that is an odd number and |
| 2658 <para> | 3135 will adversely affect quality. Instead, we will increase the y-offset by |
| 2659 We could just use <option>crop=720:352:0:58</option>, but it would be nice | 3136 4 pixels: |
| 2660 to take a little off the top and a little off the bottom so that we | 3137 <screen>mplayer dvd://1 -vf crop=720:352:0:62</screen> |
| 2661 retain the center. We have shrunk the height by 10 pixels, but we do not | 3138 Another reason to shave pixels from both the top and the bottom is that we |
| 2662 want to increase the y-offset by 5-pixels since that is an odd number and | 3139 ensure we have eliminated any half-black pixels if they exist. Note that if |
| 2663 will adversely affect quality. Instead, we will increase the y-offset by | 3140 your video is telecined, make sure the <option>pullup</option> filter (or |
| 2664 4 pixels: | 3141 whichever inverse telecine filter you decide to use) appears in the filter |
| 2665 | 3142 chain before you crop. If it is interlaced, deinterlace before cropping. |
| 2666 <screen>mplayer dvd://1 -vf crop=720:352:0:62</screen> | 3143 (If you choose to preserve the interlaced video, then make sure your |
| 2667 | 3144 vertical crop offset is a multiple of 4.) |
| 2668 Another reason to shave pixels from both the top and the bottom is that we | 3145 </para> |
| 2669 ensure we have eliminated any half-black pixels if they exist. Note that if | 3146 |
| 2670 your video is telecined, make sure the <option>pullup</option> filter (or | 3147 <para> |
| 2671 whichever inverse telecine filter you decide to use) appears in the filter | 3148 If you are really concerned about losing those 10 pixels, you might |
| 2672 chain before you crop. If it is interlaced, deinterlace before cropping. | 3149 prefer instead to scale the dimensions down to the nearest multiple of 16. |
| 2673 (If you choose to preserve the interlaced video, then make sure your | 3150 The filter chain would look like: |
| 2674 vertical crop offset is a multiple of 4.) | 3151 <screen>-vf crop=720:362:0:58,scale=720:352</screen> |
| 2675 </para> | 3152 Scaling the video down like this will mean that some small amount of |
| 2676 | 3153 detail is lost, though it probably will not be perceptible. Scaling up will |
| 2677 <para> | 3154 result in lower quality (unless you increase the bitrate). Cropping |
| 2678 If you are really concerned about losing those 10 pixels, you might | 3155 discards those pixels altogether. It is a tradeoff that you will want to |
| 2679 prefer instead to scale the dimensions down to the nearest multiple of 16. | 3156 consider for each circumstance. For example, if the DVD video was made |
| 2680 The filter chain would look like: | 3157 for television, you might want to avoid vertical scaling, since the line |
| 2681 | 3158 sampling corresponds to the way the content was originally recorded. |
| 2682 <screen>-vf crop=720:362:0:58,scale=720:352</screen> | 3159 </para> |
| 2683 | 3160 |
| 2684 Scaling the video down like this will mean that some small amount of | 3161 <para> |
| 2685 detail is lost, though it probably will not be perceptible. Scaling up will | 3162 On inspection, we see that our movie has a fair bit of action and high |
| 2686 result in lower quality (unless you increase the bitrate). Cropping | 3163 amounts of detail, so we pick 2400Kbit for our bitrate. |
| 2687 discards those pixels altogether. It is a tradeoff that you will want to | 3164 </para> |
| 2688 consider for each circumstance. For example, if the DVD video was made | 3165 |
| 2689 for television, you might want to avoid vertical scaling, since the line | 3166 <para> |
| 2690 sampling corresponds to the way the content was originally recorded. | 3167 We are now ready to do the two pass encode. Pass one: |
| 2691 </para> | 3168 <screen> |
| 2692 | 3169 mencoder dvd://1 -ofps 24000/1001 -oac copy -o <replaceable>Harry_Potter_2.avi</replaceable> -ovc lavc \ |
| 2693 <para> | 3170 -lavcopts vcodec=mpeg4:vbitrate=2400:v4mv:mbd=2:trell:cmp=3:subcmp=3:autoaspect:vpass=1 \ |
| 2694 On inspection, we see that our movie has a fair bit of action and high | 3171 -vf pullup,softskip,crop=720:352:0:62,hqdn3d=2:1:2 |
| 2695 amounts of detail, so we pick 2400Kbit for our bitrate. | 3172 </screen> |
| 2696 </para> | 3173 And pass two is the same, except that we specify <option>vpass=2</option>: |
| 2697 | 3174 <screen> |
| 2698 <para> | 3175 mencoder dvd://1 -ofps 24000/1001 -oac copy -o <replaceable>Harry_Potter_2.avi</replaceable> -ovc lavc \ |
| 2699 We are now ready to do the two pass encode. Pass one: | 3176 -lavcopts vcodec=mpeg4:vbitrate=2400:v4mv:mbd=2:trell:cmp=3:subcmp=3:autoaspect:vpass=2 \ |
| 2700 | 3177 -vf pullup,softskip,crop=720:352:0:62,hqdn3d=2:1:2 |
| 2701 <screen>mencoder dvd://1 -ofps 24000/1001 -oac copy -vf crop=720:352:0:62,hqdn3d=2:1:2 -ovc lavc \ | 3178 </screen> |
| 2702 -lavcopts vcodec=mpeg4:vbitrate=2400:v4mv:mbd=2:trell:cmp=3:subcmp=3:mbcmp=3:autoaspect:vpass=1 \ | 3179 </para> |
| 2703 -o Harry_Potter_2.avi</screen> | 3180 |
| 2704 | 3181 <para> |
| 2705 And pass two is the same, except that we specify <option>vpass=2</option>: | 3182 The options <option>v4mv:mbd=2:trell</option> will greatly increase the |
| 2706 | 3183 quality at the expense of encoding time. There is little reason to leave |
| 2707 <screen>mencoder dvd://1 -ofps 24000/1001 -oac copy -vf crop=720:352:0:62,hqdn3d=2:1:2 -ovc lavc \ | 3184 these options out when the primary goal is quality. The options |
| 2708 -lavcopts vcodec=mpeg4:vbitrate=2400:v4mv:mbd=2:trell:cmp=3:subcmp=3:mbcmp=3:autoaspect:vpass=2 \ | 3185 <option>cmp=3:subcmp=3</option> select a comparison function that |
| 2709 -o Harry_Potter_2.avi</screen> | 3186 yields higher quality than the defaults. You might try experimenting with |
| 2710 </para> | 3187 this parameter (refer to the man page for the possible values) as |
| 2711 | 3188 different functions can have a large impact on quality depending on the |
| 2712 <para> | 3189 source material. For example, if you find |
| 2713 The options <option>v4mv:mbd=2:trell</option> will greatly increase the | 3190 <systemitem class="library">libavcodec</systemitem> produces too much |
| 2714 quality at the expense of encoding time. There is little reason to leave | 3191 blocky artifacts, you could try selecting the experimental NSSE as |
| 2715 these options out when the primary goal is quality. The options | 3192 comparison function via <option>*cmp=10</option>. |
| 2716 <option>cmp=3:subcmp=3:mbcmp=3</option> select a comparison function that | 3193 </para> |
| 2717 yields higher quality than the defaults. You might try experimenting with | 3194 |
| 2718 this parameter (refer to the man page for the possible values) as | 3195 <para> |
| 2719 different functions can have a large impact on quality depending on the | 3196 For this movie, the resulting AVI will be 138 minutes long and nearly |
| 2720 source material. For example, if you find | 3197 3GB. And because you said that file size does not matter, this is a |
| 2721 <systemitem class="library">libavcodec</systemitem> produces too much | 3198 perfectly acceptable size. However, if you had wanted it smaller, you |
| 2722 blocky artifacting, you could try selecting the experimental NSSE as | 3199 could try a lower bitrate. Increasing bitrates have diminishing |
| 2723 comparison function via <option>*cmp=10</option>. | 3200 returns, so while we might clearly see an improvement from 1800Kbit to |
| 2724 </para> | 3201 2000Kbit, it might not be so noticeable above 2000Kbit. Feel |
| 2725 | 3202 free to experiment until you are happy. |
| 2726 <para> | 3203 </para> |
| 2727 For this movie, the resulting AVI will be 138 minutes long and nearly | 3204 |
| 2728 3GB. And because you said that file size does not matter, this is a | 3205 <para> |
| 2729 perfectly acceptable size. However, if you had wanted it smaller, you | 3206 Because we passed the source video through a denoise filter, you may want |
| 2730 could try a lower bitrate. Increasing bitrates have diminishing | 3207 to add some of it back during playback. This, along with the |
| 2731 returns, so while we might clearly see an improvement from 1800Kbit to | 3208 <option>spp</option> post-processing filter, drastically improves the |
| 2732 2000Kbit, it might not be so noticeable above 2000Kbit. Feel | 3209 perception of quality and helps eliminate blocky artifacts in the video. |
| 2733 free to experiment until you are happy. | 3210 With <application>MPlayer</application>'s <option>autoq</option> option, |
| 2734 </para> | 3211 you can vary the amount of post-processing done by the spp filter |
| 2735 | 3212 depending on available CPU. Also, at this point, you may want to apply |
| 2736 <para> | 3213 gamma and/or color correction to best suit your display. For example: |
| 2737 Because we passed the source video through a denoise filter, you may want | 3214 <screen> |
| 2738 to add some of it back during playback. This, along with the | 3215 mplayer <replaceable>Harry_Potter_2.avi</replaceable> -vf spp,noise=9ah:5ah,eq2=1.2 -autoq 3 |
| 2739 <option>spp</option> post-processing filter, drastically improves the | 3216 </screen> |
| 2740 perception of quality and helps eliminate blocky artifacts in the video. | |
| 2741 With <application>MPlayer</application>'s <option>autoq</option> option, | |
| 2742 you can vary the amount of post-processing done by the spp filter | |
| 2743 depending on available CPU. Also, at this point, you may want to apply | |
| 2744 gamma and/or color correction to best suit your display. For example: | |
| 2745 | |
| 2746 <screen>mplayer Harry_Potter_2.avi -vf spp,noise=9ah:5ah,eq2=1.2 -autoq 3</screen> | |
| 2747 | |
| 2748 </para> | 3217 </para> |
| 2749 </sect2> | 3218 </sect2> |
| 2750 </sect1> | 3219 </sect1> |
| 2751 | 3220 |
| 2752 | 3221 |
| 3222 <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - --> | |
| 3223 | |
| 3224 | |
| 2753 <sect1 id="menc-feat-xvid"> | 3225 <sect1 id="menc-feat-xvid"> |
| 2754 <title>Encoding with the <systemitem class="library">XviD</systemitem> | 3226 <title>Encoding with the <systemitem class="library">Xvid</systemitem> |
| 2755 codec</title> | 3227 codec</title> |
| 2756 <para> | 3228 |
| 2757 <systemitem class="library">XviD</systemitem> is a free library for | 3229 <para> |
| 2758 encoding MPEG-4 ASP video streams. | 3230 <systemitem class="library">Xvid</systemitem> is a free library for |
| 2759 Before starting to encode, you need to <link linkend="xvid"> | 3231 encoding MPEG-4 ASP video streams. |
| 2760 set up <application>MEncoder</application> to support it</link>. | 3232 Before starting to encode, you need to <link linkend="xvid"> |
| 2761 </para> | 3233 set up <application>MEncoder</application> to support it</link>. |
| 2762 <para> | 3234 </para> |
| 2763 This guide mainly aims at featuring the same kind of information | 3235 |
| 2764 as x264's encoding guide. | 3236 <para> |
| 2765 Therefore, please begin by reading | 3237 This guide mainly aims at featuring the same kind of information |
| 2766 <link linkend="menc-feat-x264-encoding-options-intro">the first part</link> | 3238 as x264's encoding guide. |
| 2767 of that guide. | 3239 Therefore, please begin by reading |
| 2768 </para> | 3240 <link linkend="menc-feat-x264-encoding-options-intro">the first part</link> |
| 2769 | 3241 of that guide. |
| 3242 </para> | |
| 3243 | |
| 3244 <!-- ********** --> | |
| 2770 | 3245 |
| 2771 <sect2 id="menc-feat-xvid-intro"> | 3246 <sect2 id="menc-feat-xvid-intro"> |
| 2772 <title>What options should I use to get the best results?</title> | 3247 <title>What options should I use to get the best results?</title> |
| 2773 | 3248 |
| 2774 <para> | 3249 <para> |
| 2775 Please begin by reviewing the | 3250 Please begin by reviewing the |
| 2776 <systemitem class="library">XviD</systemitem> section of | 3251 <systemitem class="library">Xvid</systemitem> section of |
| 2777 <application>MPlayer</application>'s man page. | 3252 <application>MPlayer</application>'s man page. |
| 2778 This section is intended to be a supplement to the man page. | 3253 This section is intended to be a supplement to the man page. |
| 2779 </para> | 3254 </para> |
| 2780 <para> | 3255 |
| 2781 The XviD default settings are already a good tradeoff between | 3256 <para> |
| 2782 speed and quality, therefore you can safely stick to them if | 3257 The Xvid default settings are already a good tradeoff between |
| 2783 the following section puzzles you. | 3258 speed and quality, therefore you can safely stick to them if |
| 3259 the following section puzzles you. | |
| 2784 </para> | 3260 </para> |
| 2785 </sect2> | 3261 </sect2> |
| 2786 | 3262 |
| 3263 <!-- ********** --> | |
| 3264 | |
| 2787 <sect2 id="menc-feat-xvid-encoding-options"> | 3265 <sect2 id="menc-feat-xvid-encoding-options"> |
| 2788 <title>Encoding options of <systemitem class="library">XviD</systemitem></title> | 3266 <title>Encoding options of <systemitem class="library">Xvid</systemitem></title> |
| 2789 | 3267 |
| 2790 <itemizedlist> | 3268 <itemizedlist> |
| 2791 <listitem><para> | 3269 <listitem><para> |
| 2792 <emphasis role="bold">vhq</emphasis> | 3270 <emphasis role="bold">vhq</emphasis> |
| 2793 This setting affects the macroblock decision algorithm, where the | 3271 This setting affects the macroblock decision algorithm, where the |
| 2794 higher the setting, the wiser the decision. | 3272 higher the setting, the wiser the decision. |
| 2795 The default setting may be safely used for every encode, while | 3273 The default setting may be safely used for every encode, while |
| 2796 higher settings always help PSNR but are significantly slower. | 3274 higher settings always help PSNR but are significantly slower. |
| 2797 Please note that a better PSNR does not necessarily mean | 3275 Please note that a better PSNR does not necessarily mean |
| 2798 that the picture will look better, but tells you that it is | 3276 that the picture will look better, but tells you that it is |
| 2799 closer to the original. | 3277 closer to the original. |
| 2800 Turning it off will noticeably speed up encoding; if speed is | 3278 Turning it off will noticeably speed up encoding; if speed is |
| 2801 critical for you, the tradeoff may be worth it. | 3279 critical for you, the tradeoff may be worth it. |
| 2802 </para></listitem> | 3280 </para></listitem> |
| 2803 | 3281 <listitem><para> |
| 2804 <listitem><para> | 3282 <emphasis role="bold">bvhq</emphasis> |
| 2805 <emphasis role="bold">bvhq</emphasis> | |
| 2806 This does the same job as vhq, but does it on B-frames. | 3283 This does the same job as vhq, but does it on B-frames. |
| 2807 It has a negligible impact on speed, and slightly improves quality | 3284 It has a negligible impact on speed, and slightly improves quality |
| 2808 (around +0.1dB PSNR). | 3285 (around +0.1dB PSNR). |
| 2809 </para></listitem> | 3286 </para></listitem> |
| 2810 | 3287 <listitem><para> |
| 2811 <listitem><para> | 3288 <emphasis role="bold">max_bframes</emphasis> |
| 2812 <emphasis role="bold">max_bframes</emphasis> | |
| 2813 A higher number of consecutive allowed B-frames usually improves | 3289 A higher number of consecutive allowed B-frames usually improves |
| 2814 compressibility, although it may also lead to more blocking artifacts. | 3290 compressibility, although it may also lead to more blocking artifacts. |
| 2815 The default setting is a good tradeoff between compressibility and | 3291 The default setting is a good tradeoff between compressibility and |
| 2816 quality, but you may increase it up to 3 if you are bitrate-starved. | 3292 quality, but you may increase it up to 3 if you are bitrate-starved. |
| 2817 You may also decrease it to 1 or 0 if you are aiming at perfect | 3293 You may also decrease it to 1 or 0 if you are aiming at perfect |
| 2818 quality, though in that case you should make sure your | 3294 quality, though in that case you should make sure your |
| 2819 target bitrate is high enough to ensure that the encoder does not | 3295 target bitrate is high enough to ensure that the encoder does not |
| 2820 have to increase quantizers to reach it. | 3296 have to increase quantizers to reach it. |
| 2821 </para></listitem> | 3297 </para></listitem> |
| 2822 | 3298 <listitem><para> |
| 2823 <listitem><para> | 3299 <emphasis role="bold">bf_threshold</emphasis> |
| 2824 <emphasis role="bold">bf_threshold</emphasis> | |
| 2825 This controls the B-frame sensitivity of the encoder, where a higher | 3300 This controls the B-frame sensitivity of the encoder, where a higher |
| 2826 value leads to more B-frames being used (and vice versa). | 3301 value leads to more B-frames being used (and vice versa). |
| 2827 This setting is to be used together with <option>max_bframes</option>; | 3302 This setting is to be used together with <option>max_bframes</option>; |
| 2828 if you are bitrate-starved, you should increase both | 3303 if you are bitrate-starved, you should increase both |
| 2829 <option>max_bframes</option> and <option>bf_threshold</option>, | 3304 <option>max_bframes</option> and <option>bf_threshold</option>, |
| 2838 However, if you need to be compatible with standalone players that | 3313 However, if you need to be compatible with standalone players that |
| 2839 only support old DivX profiles (which only supports up to 1 | 3314 only support old DivX profiles (which only supports up to 1 |
| 2840 consecutive B-frame), this would be your only way to | 3315 consecutive B-frame), this would be your only way to |
| 2841 increase compressibility through using B-frames. | 3316 increase compressibility through using B-frames. |
| 2842 </para></listitem> | 3317 </para></listitem> |
| 2843 | 3318 <listitem><para> |
| 2844 <listitem><para> | 3319 <emphasis role="bold">trellis</emphasis> |
| 2845 <emphasis role="bold">trellis</emphasis> | |
| 2846 Optimizes the quantization process to get an optimal tradeoff | 3320 Optimizes the quantization process to get an optimal tradeoff |
| 2847 between PSNR and bitrate, which allows significant bit saving. | 3321 between PSNR and bitrate, which allows significant bit saving. |
| 2848 These bits will in return be spent elsewhere on the video, | 3322 These bits will in return be spent elsewhere on the video, |
| 2849 raising overall visual quality. | 3323 raising overall visual quality. |
| 2850 You should always leave it on as its impact on quality is huge. | 3324 You should always leave it on as its impact on quality is huge. |
| 2851 Even if you are looking for speed, do not disable it until you | 3325 Even if you are looking for speed, do not disable it until you |
| 2852 have turned down <option>vhq</option> and all other more | 3326 have turned down <option>vhq</option> and all other more |
| 2853 CPU-hungry options to the minimum. | 3327 CPU-hungry options to the minimum. |
| 2854 </para></listitem> | 3328 </para></listitem> |
| 2855 | |
| 2856 <listitem><para> | 3329 <listitem><para> |
| 2857 <emphasis role="bold">hq_ac</emphasis> | 3330 <emphasis role="bold">hq_ac</emphasis> |
| 2858 Activates a better coefficient cost estimation method, which slightly | 3331 Activates a better coefficient cost estimation method, which slightly |
| 2859 reduces filesize by around 0.15 to 0.19% (which corresponds to less | 3332 reduces file size by around 0.15 to 0.19% (which corresponds to less |
| 2860 than 0.01dB PSNR increase), while having a negligible impact on speed. | 3333 than 0.01dB PSNR increase), while having a negligible impact on speed. |
| 2861 It is therefore recommended to always leave it on. | 3334 It is therefore recommended to always leave it on. |
| 2862 </para></listitem> | 3335 </para></listitem> |
| 2863 | |
| 2864 <listitem><para> | 3336 <listitem><para> |
| 2865 <emphasis role="bold">cartoon</emphasis> | 3337 <emphasis role="bold">cartoon</emphasis> |
| 2866 Designed to better encode cartoon content, and has no impact on | 3338 Designed to better encode cartoon content, and has no impact on |
| 2867 speed as it just tunes the mode decision heuristics for this type | 3339 speed as it just tunes the mode decision heuristics for this type |
| 2868 of content. | 3340 of content. |
| 2869 </para></listitem> | 3341 </para></listitem> |
| 2870 | 3342 <listitem> |
| 2871 <listitem><para> | 3343 <para> |
| 2872 <emphasis role="bold">me_quality</emphasis> | 3344 <emphasis role="bold">me_quality</emphasis> |
| 2873 This setting is to control the precision of the motion estimation. | 3345 This setting is to control the precision of the motion estimation. |
| 2874 The higher <option>me_quality</option>, the more | 3346 The higher <option>me_quality</option>, the more |
| 2875 precise the estimation of the original motion will be, and the | 3347 precise the estimation of the original motion will be, and the |
| 2876 better the resulting clip will capture the original motion. | 3348 better the resulting clip will capture the original motion. |
| 2877 </para> | 3349 </para> |
| 2878 <para> | 3350 <para> |
| 2879 The default setting is best in all cases; | 3351 The default setting is best in all cases; |
| 2880 thus it is not recommended to turn it down unless you are | 3352 thus it is not recommended to turn it down unless you are |
| 2881 really looking for speed, as all the bits saved by a good motion | 3353 really looking for speed, as all the bits saved by a good motion |
| 2882 estimation would be spent elsewhere, raising overall quality. | 3354 estimation would be spent elsewhere, raising overall quality. |
| 2883 Therefore, do not go any lower than 5, and even that only as a last | 3355 Therefore, do not go any lower than 5, and even that only as a last |
| 2884 resort. | 3356 resort. |
| 2885 </para></listitem> | 3357 </para> |
| 2886 | 3358 </listitem> |
| 2887 <listitem><para> | 3359 <listitem><para> |
| 2888 <emphasis role="bold">chroma_me</emphasis> | 3360 <emphasis role="bold">chroma_me</emphasis> |
| 2889 Improves motion estimation by also taking the chroma (color) | 3361 Improves motion estimation by also taking the chroma (color) |
| 2890 information into account, whereas <option>me_quality</option> | 3362 information into account, whereas <option>me_quality</option> |
| 2891 alone only uses luma (grayscale). | 3363 alone only uses luma (grayscale). |
| 2892 This slows down encoding by 5-10% but improves visual quality | 3364 This slows down encoding by 5-10% but improves visual quality |
| 2893 quite a bit by reducing blocking effects and reduces filesize by | 3365 quite a bit by reducing blocking effects and reduces file size by |
| 2894 around 1.3%. | 3366 around 1.3%. |
| 2895 If you are looking for speed, you should disable this option before | 3367 If you are looking for speed, you should disable this option before |
| 2896 starting to consider reducing <option>me_quality</option>. | 3368 starting to consider reducing <option>me_quality</option>. |
| 2897 </para></listitem> | 3369 </para></listitem> |
| 2898 | |
| 2899 <listitem><para> | 3370 <listitem><para> |
| 2900 <emphasis role="bold">chroma_opt</emphasis> | 3371 <emphasis role="bold">chroma_opt</emphasis> |
| 2901 Is intended to increase chroma image quality around pure | 3372 Is intended to increase chroma image quality around pure |
| 2902 white/black edges, rather than improving compression. | 3373 white/black edges, rather than improving compression. |
| 2903 This can help to reduce the "red stairs" effect. | 3374 This can help to reduce the "red stairs" effect. |
| 2904 </para></listitem> | 3375 </para></listitem> |
| 2905 | |
| 2906 <listitem><para> | 3376 <listitem><para> |
| 2907 <emphasis role="bold">lumi_mask</emphasis> | 3377 <emphasis role="bold">lumi_mask</emphasis> |
| 2908 Tries to give less bitrate to part of the picture that the | 3378 Tries to give less bitrate to part of the picture that the |
| 2909 human eye cannot see very well, which should allow the encoder | 3379 human eye cannot see very well, which should allow the encoder |
| 2910 to spend the saved bits on more important parts of the picture. | 3380 to spend the saved bits on more important parts of the picture. |
| 2911 The quality of the encode yielded by this option highly depends | 3381 The quality of the encode yielded by this option highly depends |
| 2912 on personal preferences and on the type and monitor settings | 3382 on personal preferences and on the type and monitor settings |
| 2913 used to watch it (typically, it will not look as good if it is | 3383 used to watch it (typically, it will not look as good if it is |
| 2914 bright or if it is a TFT monitor). | 3384 bright or if it is a TFT monitor). |
| 2915 </para></listitem> | 3385 </para></listitem> |
| 2916 | 3386 <listitem> |
| 2917 <listitem><para> | 3387 <para> |
| 2918 <emphasis role="bold">qpel</emphasis> | 3388 <emphasis role="bold">qpel</emphasis> |
| 2919 Raise the number of candidate motion vectors by increasing | 3389 Raise the number of candidate motion vectors by increasing |
| 2920 the precision of the motion estimation from halfpel to | 3390 the precision of the motion estimation from halfpel to |
| 2921 quarterpel. | 3391 quarterpel. |
| 2922 The idea is to find better motion vectors which will in return | 3392 The idea is to find better motion vectors which will in return |
| 2923 reduce bitrate (hence increasing quality). | 3393 reduce bitrate (hence increasing quality). |
| 2924 However, motion vectors with quarterpel precision require a | 3394 However, motion vectors with quarterpel precision require a |
| 2925 few extra bits to code, but the candidate vectors do not always | 3395 few extra bits to code, but the candidate vectors do not always |
| 2926 give (much) better results. | 3396 give (much) better results. |
| 2927 Quite often, the codec still spends bits on the extra precision, | 3397 Quite often, the codec still spends bits on the extra precision, |
| 2928 but little or no extra quality is gained in return. | 3398 but little or no extra quality is gained in return. |
| 2929 Unfortunately, there is no way to foresee the possible gains of | 3399 Unfortunately, there is no way to foresee the possible gains of |
| 2930 <option>qpel</option>, so you need to actually encode with and | 3400 <option>qpel</option>, so you need to actually encode with and |
| 2931 without it to know for sure. | 3401 without it to know for sure. |
| 2932 </para><para> | 3402 </para> |
| 2933 <option>qpel</option> can be almost double encoding time, and | 3403 <para> |
| 2934 requires as much as 25% more processing power to decode. | 3404 <option>qpel</option> can be almost double encoding time, and |
| 2935 It is not supported by all standalone players. | 3405 requires as much as 25% more processing power to decode. |
| 2936 </para></listitem> | 3406 It is not supported by all standalone players. |
| 2937 | 3407 </para> |
| 3408 </listitem> | |
| 2938 <listitem><para> | 3409 <listitem><para> |
| 2939 <emphasis role="bold">gmc</emphasis> | 3410 <emphasis role="bold">gmc</emphasis> |
| 2940 Tries to save bits on panning scenes by using a single motion | 3411 Tries to save bits on panning scenes by using a single motion |
| 2941 vector for the whole frame. | 3412 vector for the whole frame. |
| 2942 This almost always raises PSNR, but significantly slows down | 3413 This almost always raises PSNR, but significantly slows down |
| 2943 encoding (as well as decoding). | 3414 encoding (as well as decoding). |
| 2944 Therefore, you should only use it when you have turned | 3415 Therefore, you should only use it when you have turned |
| 2945 <option>vhq</option> to the maximum. | 3416 <option>vhq</option> to the maximum. |
| 2946 <systemitem class="library">XviD</systemitem>'s GMC is more | 3417 <systemitem class="library">Xvid</systemitem>'s GMC is more |
| 2947 sophisticated than DivX's, but is only supported by few | 3418 sophisticated than DivX's, but is only supported by few |
| 2948 standalone players. | 3419 standalone players. |
| 2949 </para></listitem> | 3420 </para></listitem> |
| 2950 | |
| 2951 </itemizedlist> | 3421 </itemizedlist> |
| 2952 </sect2> | 3422 </sect2> |
| 2953 | 3423 |
| 3424 <!-- ********** --> | |
| 3425 | |
| 2954 <sect2 id="menc-feat-xvid-encoding-profiles"> | 3426 <sect2 id="menc-feat-xvid-encoding-profiles"> |
| 2955 <title>Encoding profiles</title> | 3427 <title>Encoding profiles</title> |
| 2956 <para> | 3428 |
| 2957 XviD supports encoding profiles through the <option>profile</option> option, | 3429 <para> |
| 2958 which are used to impose restrictions on the properties of the XviD video | 3430 Xvid supports encoding profiles through the <option>profile</option> option, |
| 2959 stream such that it will be playable on anything which supports the | 3431 which are used to impose restrictions on the properties of the Xvid video |
| 2960 chosen profile. | 3432 stream such that it will be playable on anything which supports the |
| 2961 The restrictions relate to resolutions, bitrates and certain MPEG-4 | 3433 chosen profile. |
| 2962 features. | 3434 The restrictions relate to resolutions, bitrates and certain MPEG-4 |
| 2963 The following table shows what each profile supports. | 3435 features. |
| 2964 </para> | 3436 The following table shows what each profile supports. |
| 3437 </para> | |
| 3438 | |
| 2965 <informaltable> | 3439 <informaltable> |
| 2966 <tgroup cols="16" align="center"> | 3440 <tgroup cols="16" align="center"> |
| 2967 <colspec colnum="1" colname="col1"/> | 3441 <colspec colnum="1" colname="col1"/> |
| 2968 <colspec colnum="2" colname="col2"/> | 3442 <colspec colnum="2" colname="col2"/> |
| 2969 <colspec colnum="3" colname="col3"/> | 3443 <colspec colnum="3" colname="col3"/> |
| 2982 <colspec colnum="16" colname="col16"/> | 3456 <colspec colnum="16" colname="col16"/> |
| 2983 <colspec colnum="17" colname="col17"/> | 3457 <colspec colnum="17" colname="col17"/> |
| 2984 <spanspec spanname="spa2-5" namest="col2" nameend="col5"/> | 3458 <spanspec spanname="spa2-5" namest="col2" nameend="col5"/> |
| 2985 <spanspec spanname="spa6-11" namest="col6" nameend="col11"/> | 3459 <spanspec spanname="spa6-11" namest="col6" nameend="col11"/> |
| 2986 <spanspec spanname="spa12-17" namest="col12" nameend="col17"/> | 3460 <spanspec spanname="spa12-17" namest="col12" nameend="col17"/> |
| 2987 <tbody> | 3461 <tbody> |
| 2988 <row> | 3462 <row> |
| 2989 <entry></entry> | 3463 <entry></entry> |
| 2990 <entry spanname="spa2-5">Simple</entry> | 3464 <entry spanname="spa2-5">Simple</entry> |
| 2991 <entry spanname="spa6-11">Advanced Simple</entry> | 3465 <entry spanname="spa6-11">Advanced Simple</entry> |
| 2992 <entry spanname="spa12-17">DivX</entry> | 3466 <entry spanname="spa12-17">DivX</entry> |
| 2993 </row> | 3467 </row> |
| 2994 <row> | 3468 <row> |
| 2995 <entry>Profile name</entry> | 3469 <entry>Profile name</entry> |
| 2996 <entry>0</entry> | 3470 <entry>0</entry> |
| 2997 <entry>1</entry> | 3471 <entry>1</entry> |
| 2998 <entry>2</entry> | 3472 <entry>2</entry> |
| 2999 <entry>3</entry> | 3473 <entry>3</entry> |
| 3000 <entry>0</entry> | 3474 <entry>0</entry> |
| 3001 <entry>1</entry> | 3475 <entry>1</entry> |
| 3002 <entry>2</entry> | 3476 <entry>2</entry> |
| 3003 <entry>3</entry> | 3477 <entry>3</entry> |
| 3004 <entry>4</entry> | 3478 <entry>4</entry> |
| 3005 <entry>5</entry> | 3479 <entry>5</entry> |
| 3006 <entry>Handheld</entry> | 3480 <entry>Handheld</entry> |
| 3007 <entry>Portable NTSC</entry> | 3481 <entry>Portable NTSC</entry> |
| 3008 <entry>Portable PAL</entry> | 3482 <entry>Portable PAL</entry> |
| 3009 <entry>Home Theater NTSC</entry> | 3483 <entry>Home Theater NTSC</entry> |
| 3010 <entry>Home Theater PAL</entry> | 3484 <entry>Home Theater PAL</entry> |
| 3011 <entry>HDTV</entry> | 3485 <entry>HDTV</entry> |
| 3012 </row> | 3486 </row> |
| 3013 <row> | 3487 <row> |
| 3014 <entry>Width [pixels]</entry> | 3488 <entry>Width [pixels]</entry> |
| 3015 <entry>176</entry> | 3489 <entry>176</entry> |
| 3016 <entry>176</entry> | 3490 <entry>176</entry> |
| 3017 <entry>352</entry> | 3491 <entry>352</entry> |
| 3018 <entry>352</entry> | 3492 <entry>352</entry> |
| 3019 <entry>176</entry> | 3493 <entry>176</entry> |
| 3020 <entry>176</entry> | 3494 <entry>176</entry> |
| 3021 <entry>352</entry> | 3495 <entry>352</entry> |
| 3022 <entry>352</entry> | 3496 <entry>352</entry> |
| 3023 <entry>352</entry> | 3497 <entry>352</entry> |
| 3024 <entry>720</entry> | 3498 <entry>720</entry> |
| 3025 <entry>176</entry> | 3499 <entry>176</entry> |
| 3026 <entry>352</entry> | 3500 <entry>352</entry> |
| 3027 <entry>352</entry> | 3501 <entry>352</entry> |
| 3028 <entry>720</entry> | 3502 <entry>720</entry> |
| 3029 <entry>720</entry> | 3503 <entry>720</entry> |
| 3030 <entry>1280</entry> | 3504 <entry>1280</entry> |
| 3031 </row> | 3505 </row> |
| 3032 <row> | 3506 <row> |
| 3033 <entry>Height [pixels]</entry> | 3507 <entry>Height [pixels]</entry> |
| 3034 <entry>144</entry> | 3508 <entry>144</entry> |
| 3035 <entry>144</entry> | 3509 <entry>144</entry> |
| 3036 <entry>288</entry> | 3510 <entry>288</entry> |
| 3037 <entry>288</entry> | 3511 <entry>288</entry> |
| 3038 <entry>144</entry> | 3512 <entry>144</entry> |
| 3039 <entry>144</entry> | 3513 <entry>144</entry> |
| 3040 <entry>288</entry> | 3514 <entry>288</entry> |
| 3041 <entry>288</entry> | 3515 <entry>288</entry> |
| 3042 <entry>576</entry> | 3516 <entry>576</entry> |
| 3043 <entry>576</entry> | 3517 <entry>576</entry> |
| 3044 <entry>144</entry> | 3518 <entry>144</entry> |
| 3045 <entry>240</entry> | 3519 <entry>240</entry> |
| 3046 <entry>288</entry> | 3520 <entry>288</entry> |
| 3047 <entry>480</entry> | 3521 <entry>480</entry> |
| 3048 <entry>576</entry> | 3522 <entry>576</entry> |
| 3049 <entry>720</entry> | 3523 <entry>720</entry> |
| 3050 </row> | 3524 </row> |
| 3051 <row> | 3525 <row> |
| 3052 <entry>Frame rate [fps]</entry> | 3526 <entry>Frame rate [fps]</entry> |
| 3053 <entry>15</entry> | 3527 <entry>15</entry> |
| 3054 <entry>15</entry> | 3528 <entry>15</entry> |
| 3055 <entry>15</entry> | 3529 <entry>15</entry> |
| 3056 <entry>15</entry> | 3530 <entry>15</entry> |
| 3057 <entry>30</entry> | 3531 <entry>30</entry> |
| 3058 <entry>30</entry> | 3532 <entry>30</entry> |
| 3059 <entry>15</entry> | 3533 <entry>15</entry> |
| 3060 <entry>30</entry> | 3534 <entry>30</entry> |
| 3061 <entry>30</entry> | 3535 <entry>30</entry> |
| 3062 <entry>30</entry> | 3536 <entry>30</entry> |
| 3063 <entry>15</entry> | 3537 <entry>15</entry> |
| 3064 <entry>30</entry> | 3538 <entry>30</entry> |
| 3065 <entry>25</entry> | 3539 <entry>25</entry> |
| 3066 <entry>30</entry> | 3540 <entry>30</entry> |
| 3067 <entry>25</entry> | 3541 <entry>25</entry> |
| 3068 <entry>30</entry> | 3542 <entry>30</entry> |
| 3069 </row> | 3543 </row> |
| 3070 <row> | 3544 <row> |
| 3071 <entry>Max average bitrate [kbps]</entry> | 3545 <entry>Max average bitrate [kbps]</entry> |
| 3072 <entry>64</entry> | 3546 <entry>64</entry> |
| 3073 <entry>64</entry> | 3547 <entry>64</entry> |
| 3074 <entry>128</entry> | 3548 <entry>128</entry> |
| 3075 <entry>384</entry> | 3549 <entry>384</entry> |
| 3076 <entry>128</entry> | 3550 <entry>128</entry> |
| 3077 <entry>128</entry> | 3551 <entry>128</entry> |
| 3078 <entry>384</entry> | 3552 <entry>384</entry> |
| 3079 <entry>768</entry> | 3553 <entry>768</entry> |
| 3080 <entry>3000</entry> | 3554 <entry>3000</entry> |
| 3081 <entry>8000</entry> | 3555 <entry>8000</entry> |
| 3082 <entry>537.6</entry> | 3556 <entry>537.6</entry> |
| 3083 <entry>4854</entry> | 3557 <entry>4854</entry> |
| 3084 <entry>4854</entry> | 3558 <entry>4854</entry> |
| 3085 <entry>4854</entry> | 3559 <entry>4854</entry> |
| 3086 <entry>4854</entry> | 3560 <entry>4854</entry> |
| 3087 <entry>9708.4</entry> | 3561 <entry>9708.4</entry> |
| 3088 </row> | 3562 </row> |
| 3089 <row> | 3563 <row> |
| 3090 <entry>Peak average bitrate over 3 secs [kbps]</entry> | 3564 <entry>Peak average bitrate over 3 secs [kbps]</entry> |
| 3091 <entry></entry> | 3565 <entry></entry> |
| 3092 <entry></entry> | 3566 <entry></entry> |
| 3093 <entry></entry> | 3567 <entry></entry> |
| 3094 <entry></entry> | 3568 <entry></entry> |
| 3095 <entry></entry> | 3569 <entry></entry> |
| 3096 <entry></entry> | 3570 <entry></entry> |
| 3097 <entry></entry> | 3571 <entry></entry> |
| 3098 <entry></entry> | 3572 <entry></entry> |
| 3099 <entry></entry> | 3573 <entry></entry> |
| 3100 <entry></entry> | 3574 <entry></entry> |
| 3101 <entry>800</entry> | 3575 <entry>800</entry> |
| 3102 <entry>8000</entry> | 3576 <entry>8000</entry> |
| 3103 <entry>8000</entry> | 3577 <entry>8000</entry> |
| 3104 <entry>8000</entry> | 3578 <entry>8000</entry> |
| 3105 <entry>8000</entry> | 3579 <entry>8000</entry> |
| 3106 <entry>16000</entry> | 3580 <entry>16000</entry> |
| 3107 </row> | 3581 </row> |
| 3108 <row> | 3582 <row> |
| 3109 <entry>Max. B-frames</entry> | 3583 <entry>Max. B-frames</entry> |
| 3110 <entry>0</entry> | 3584 <entry>0</entry> |
| 3111 <entry>0</entry> | 3585 <entry>0</entry> |
| 3112 <entry>0</entry> | 3586 <entry>0</entry> |
| 3113 <entry>0</entry> | 3587 <entry>0</entry> |
| 3114 <entry></entry> | 3588 <entry></entry> |
| 3115 <entry></entry> | 3589 <entry></entry> |
| 3116 <entry></entry> | 3590 <entry></entry> |
| 3117 <entry></entry> | 3591 <entry></entry> |
| 3118 <entry></entry> | 3592 <entry></entry> |
| 3119 <entry></entry> | 3593 <entry></entry> |
| 3120 <entry>0</entry> | 3594 <entry>0</entry> |
| 3121 <entry>1</entry> | 3595 <entry>1</entry> |
| 3122 <entry>1</entry> | 3596 <entry>1</entry> |
| 3123 <entry>1</entry> | 3597 <entry>1</entry> |
| 3124 <entry>1</entry> | 3598 <entry>1</entry> |
| 3125 <entry>2</entry> | 3599 <entry>2</entry> |
| 3126 </row> | 3600 </row> |
| 3127 <row> | 3601 <row> |
| 3128 <entry>MPEG quantization</entry> | 3602 <entry>MPEG quantization</entry> |
| 3129 <entry></entry> | 3603 <entry></entry> |
| 3130 <entry></entry> | 3604 <entry></entry> |
| 3131 <entry></entry> | 3605 <entry></entry> |
| 3132 <entry></entry> | 3606 <entry></entry> |
| 3133 <entry>X</entry> | 3607 <entry>X</entry> |
| 3134 <entry>X</entry> | 3608 <entry>X</entry> |
| 3135 <entry>X</entry> | 3609 <entry>X</entry> |
| 3136 <entry>X</entry> | 3610 <entry>X</entry> |
| 3137 <entry>X</entry> | 3611 <entry>X</entry> |
| 3138 <entry>X</entry> | 3612 <entry>X</entry> |
| 3139 <entry></entry> | 3613 <entry></entry> |
| 3140 <entry></entry> | 3614 <entry></entry> |
| 3141 <entry></entry> | 3615 <entry></entry> |
| 3142 <entry></entry> | 3616 <entry></entry> |
| 3143 <entry></entry> | 3617 <entry></entry> |
| 3144 <entry></entry> | 3618 <entry></entry> |
| 3145 </row> | 3619 </row> |
| 3146 <row> | 3620 <row> |
| 3147 <entry>Adaptive quantization</entry> | 3621 <entry>Adaptive quantization</entry> |
| 3148 <entry></entry> | 3622 <entry></entry> |
| 3149 <entry></entry> | 3623 <entry></entry> |
| 3150 <entry></entry> | 3624 <entry></entry> |
| 3151 <entry></entry> | 3625 <entry></entry> |
| 3152 <entry>X</entry> | 3626 <entry>X</entry> |
| 3153 <entry>X</entry> | 3627 <entry>X</entry> |
| 3154 <entry>X</entry> | 3628 <entry>X</entry> |
| 3155 <entry>X</entry> | 3629 <entry>X</entry> |
| 3156 <entry>X</entry> | 3630 <entry>X</entry> |
| 3157 <entry>X</entry> | 3631 <entry>X</entry> |
| 3158 <entry>X</entry> | 3632 <entry>X</entry> |
| 3159 <entry>X</entry> | 3633 <entry>X</entry> |
| 3160 <entry>X</entry> | 3634 <entry>X</entry> |
| 3161 <entry>X</entry> | 3635 <entry>X</entry> |
| 3162 <entry>X</entry> | 3636 <entry>X</entry> |
| 3163 <entry>X</entry> | 3637 <entry>X</entry> |
| 3164 </row> | 3638 </row> |
| 3165 <row> | 3639 <row> |
| 3166 <entry>Interlaced encoding</entry> | 3640 <entry>Interlaced encoding</entry> |
| 3167 <entry></entry> | 3641 <entry></entry> |
| 3168 <entry></entry> | 3642 <entry></entry> |
| 3169 <entry></entry> | 3643 <entry></entry> |
| 3170 <entry></entry> | 3644 <entry></entry> |
| 3171 <entry>X</entry> | 3645 <entry>X</entry> |
| 3172 <entry>X</entry> | 3646 <entry>X</entry> |
| 3173 <entry>X</entry> | 3647 <entry>X</entry> |
| 3174 <entry>X</entry> | 3648 <entry>X</entry> |
| 3175 <entry>X</entry> | 3649 <entry>X</entry> |
| 3176 <entry>X</entry> | 3650 <entry>X</entry> |
| 3177 <entry></entry> | 3651 <entry></entry> |
| 3178 <entry></entry> | 3652 <entry></entry> |
| 3179 <entry></entry> | 3653 <entry></entry> |
| 3180 <entry>X</entry> | 3654 <entry>X</entry> |
| 3181 <entry>X</entry> | 3655 <entry>X</entry> |
| 3182 <entry>X</entry> | 3656 <entry>X</entry> |
| 3183 </row> | 3657 </row> |
| 3184 <row> | 3658 <row> |
| 3185 <entry>Quaterpixel</entry> | 3659 <entry>Quarterpixel</entry> |
| 3186 <entry></entry> | 3660 <entry></entry> |
| 3187 <entry></entry> | 3661 <entry></entry> |
| 3188 <entry></entry> | 3662 <entry></entry> |
| 3189 <entry></entry> | 3663 <entry></entry> |
| 3190 <entry>X</entry> | 3664 <entry>X</entry> |
| 3191 <entry>X</entry> | 3665 <entry>X</entry> |
| 3192 <entry>X</entry> | 3666 <entry>X</entry> |
| 3193 <entry>X</entry> | 3667 <entry>X</entry> |
| 3194 <entry>X</entry> | 3668 <entry>X</entry> |
| 3195 <entry>X</entry> | 3669 <entry>X</entry> |
| 3196 <entry></entry> | 3670 <entry></entry> |
| 3197 <entry></entry> | 3671 <entry></entry> |
| 3198 <entry></entry> | 3672 <entry></entry> |
| 3199 <entry></entry> | 3673 <entry></entry> |
| 3200 <entry></entry> | 3674 <entry></entry> |
| 3201 <entry></entry> | 3675 <entry></entry> |
| 3202 </row> | 3676 </row> |
| 3203 <row> | 3677 <row> |
| 3204 <entry>Global motion compensation</entry> | 3678 <entry>Global motion compensation</entry> |
| 3205 <entry></entry> | 3679 <entry></entry> |
| 3206 <entry></entry> | 3680 <entry></entry> |
| 3207 <entry></entry> | 3681 <entry></entry> |
| 3208 <entry></entry> | 3682 <entry></entry> |
| 3209 <entry>X</entry> | 3683 <entry>X</entry> |
| 3210 <entry>X</entry> | 3684 <entry>X</entry> |
| 3211 <entry>X</entry> | 3685 <entry>X</entry> |
| 3212 <entry>X</entry> | 3686 <entry>X</entry> |
| 3213 <entry>X</entry> | 3687 <entry>X</entry> |
| 3214 <entry>X</entry> | 3688 <entry>X</entry> |
| 3215 <entry></entry> | 3689 <entry></entry> |
| 3216 <entry></entry> | 3690 <entry></entry> |
| 3217 <entry></entry> | 3691 <entry></entry> |
| 3218 <entry></entry> | 3692 <entry></entry> |
| 3219 <entry></entry> | 3693 <entry></entry> |
| 3220 <entry></entry> | 3694 <entry></entry> |
| 3221 </row> | 3695 </row> |
| 3222 </tbody> | 3696 </tbody> |
| 3223 </tgroup> | 3697 </tgroup> |
| 3224 </informaltable> | 3698 </informaltable> |
| 3225 </sect2> | 3699 </sect2> |
| 3226 | 3700 |
| 3701 <!-- ********** --> | |
| 3702 | |
| 3227 <sect2 id="menc-feat-xvid-example-settings"> | 3703 <sect2 id="menc-feat-xvid-example-settings"> |
| 3228 <title>Encoding setting examples</title> | 3704 <title>Encoding setting examples</title> |
| 3229 | 3705 |
| 3230 <para> | 3706 <para> |
| 3231 The following settings are examples of different encoding | 3707 The following settings are examples of different encoding |
| 3232 option combinations that affect the speed vs quality tradeoff | 3708 option combinations that affect the speed vs quality tradeoff |
| 3233 at the same target bitrate. | 3709 at the same target bitrate. |
| 3234 </para> | 3710 </para> |
| 3235 | 3711 |
| 3236 <para> | 3712 <para> |
| 3237 All the encoding settings were tested on a 720x448 @30000/1001 fps | 3713 All the encoding settings were tested on a 720x448 @30000/1001 fps |
| 3238 video sample, the target bitrate was 900kbps, and the machine was an | 3714 video sample, the target bitrate was 900kbps, and the machine was an |
| 3239 AMD-64 3400+ at 2400 Mhz in 64 bits mode. | 3715 AMD-64 3400+ at 2400 MHz in 64 bits mode. |
| 3240 Each encoding setting features the measured encoding speed (in | 3716 Each encoding setting features the measured encoding speed (in |
| 3241 frames per second) and the PSNR loss (in dB) compared to the "very | 3717 frames per second) and the PSNR loss (in dB) compared to the "very |
| 3242 high quality" setting. | 3718 high quality" setting. |
| 3243 Please understand that depending on your source, your machine type | 3719 Please understand that depending on your source, your machine type |
| 3244 and development advancements, you may get very different results. | 3720 and development advancements, you may get very different results. |
| 3245 </para> | 3721 </para> |
| 3246 | 3722 |
| 3247 <para> | |
| 3248 <informaltable frame="all"> | 3723 <informaltable frame="all"> |
| 3249 <tgroup cols="4"> | 3724 <tgroup cols="4"> |
| 3250 <thead> | 3725 <thead> |
| 3251 <row><entry>Description</entry><entry>Encoding options</entry><entry>speed (in fps)</entry><entry>Relative PSNR loss (in dB)</entry></row> | 3726 <row><entry>Description</entry><entry>Encoding options</entry><entry>speed (in fps)</entry><entry>Relative PSNR loss (in dB)</entry></row> |
| 3252 </thead> | 3727 </thead> |
| 3276 <entry>-1.48dB</entry> | 3751 <entry>-1.48dB</entry> |
| 3277 </row> | 3752 </row> |
| 3278 </tbody> | 3753 </tbody> |
| 3279 </tgroup> | 3754 </tgroup> |
| 3280 </informaltable> | 3755 </informaltable> |
| 3281 </para> | |
| 3282 </sect2> | 3756 </sect2> |
| 3283 | |
| 3284 </sect1> | 3757 </sect1> |
| 3285 | 3758 |
| 3759 | |
| 3760 <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - --> | |
| 3761 | |
| 3762 | |
| 3286 <sect1 id="menc-feat-x264"> | 3763 <sect1 id="menc-feat-x264"> |
| 3287 <title>Encoding with the <systemitem class="library">x264</systemitem> codec</title> | 3764 <title>Encoding with the |
| 3288 <para> | 3765 <systemitem class="library">x264</systemitem> codec</title> |
| 3289 <systemitem class="library">x264</systemitem> is a free library for | 3766 |
| 3290 encoding H.264/AVC video streams. | 3767 <para> |
| 3291 Before starting to encode, you need to <link linkend="codec-x264-encode"> | 3768 <systemitem class="library">x264</systemitem> is a free library for |
| 3292 set up <application>MEncoder</application> to support it</link>. | 3769 encoding H.264/AVC video streams. |
| 3293 </para> | 3770 Before starting to encode, you need to |
| 3771 <link linkend="codec-x264">set up <application>MEncoder</application> to support it</link>. | |
| 3772 </para> | |
| 3773 | |
| 3774 <!-- ********** --> | |
| 3294 | 3775 |
| 3295 <sect2 id="menc-feat-x264-encoding-options"> | 3776 <sect2 id="menc-feat-x264-encoding-options"> |
| 3296 <title>Encoding options of x264</title> | 3777 <title>Encoding options of x264</title> |
| 3297 | 3778 |
| 3298 <para> | 3779 <para> |
| 3299 Please begin by reviewing the | 3780 Please begin by reviewing the |
| 3300 <systemitem class="library">x264</systemitem> section of | 3781 <systemitem class="library">x264</systemitem> section of |
| 3301 <application>MPlayer</application>'s man page. | 3782 <application>MPlayer</application>'s man page. |
| 3302 This section is intended to be a supplement to the man page. | 3783 This section is intended to be a supplement to the man page. |
| 3303 Here you will find quick hints about which options are most | 3784 Here you will find quick hints about which options are most |
| 3304 likely to interest most people. The man page is more terse, | 3785 likely to interest most people. The man page is more terse, |
| 3305 but also more exhaustive, and it sometimes offers much better | 3786 but also more exhaustive, and it sometimes offers much better |
| 3306 technical detail. | 3787 technical detail. |
| 3307 </para> | 3788 </para> |
| 3789 | |
| 3308 | 3790 |
| 3309 <sect3 id="menc-feat-x264-encoding-options-intro"> | 3791 <sect3 id="menc-feat-x264-encoding-options-intro"> |
| 3310 <title>Introduction</title> | 3792 <title>Introduction</title> |
| 3311 <para>This guide considers two major categories of encoding options:</para> | 3793 |
| 3794 <para> | |
| 3795 This guide considers two major categories of encoding options: | |
| 3796 </para> | |
| 3312 | 3797 |
| 3313 <orderedlist> | 3798 <orderedlist> |
| 3314 <listitem><para>Options which mainly trade off encoding time vs. quality | 3799 <listitem><para> |
| 3315 </para></listitem> | 3800 Options which mainly trade off encoding time vs. quality |
| 3316 <listitem><para>Options which may be useful for fulfilling various personal | 3801 </para></listitem> |
| 3317 preferences and special requirements</para></listitem> | 3802 <listitem><para> |
| 3803 Options which may be useful for fulfilling various personal | |
| 3804 preferences and special requirements | |
| 3805 </para></listitem> | |
| 3318 </orderedlist> | 3806 </orderedlist> |
| 3319 | 3807 |
| 3320 <para> | 3808 <para> |
| 3321 Ultimately, only you can decide which options are best for your | 3809 Ultimately, only you can decide which options are best for your |
| 3322 purposes. The decision for the first class of options is the simplest: | 3810 purposes. The decision for the first class of options is the simplest: |
| 3323 you only have to decide whether you think the quality differences | 3811 you only have to decide whether you think the quality differences |
| 3324 justify the speed differences. For the second class of options, | 3812 justify the speed differences. For the second class of options, |
| 3325 preferences may be far more subjective, and more factors may be | 3813 preferences may be far more subjective, and more factors may be |
| 3326 involved. Note that some of the "personal preferences and special | 3814 involved. Note that some of the "personal preferences and special |
| 3327 requirements" options can still have large impacts on speed or quality, | 3815 requirements" options can still have large impacts on speed or quality, |
| 3328 but that is not what they are primarily useful for. A couple of the | 3816 but that is not what they are primarily useful for. A couple of the |
| 3329 "personal preference" options may even cause changes that look better | 3817 "personal preference" options may even cause changes that look better |
| 3330 to some people, but look worse to others. | 3818 to some people, but look worse to others. |
| 3331 </para> | 3819 </para> |
| 3332 | 3820 |
| 3333 <para> | 3821 <para> |
| 3334 Before continuing, you need to understand that this guide uses only one | 3822 Before continuing, you need to understand that this guide uses only one |
| 3335 quality metric: global PSNR. | 3823 quality metric: global PSNR. |
| 3336 For a brief explanation of what PSNR is, see | 3824 For a brief explanation of what PSNR is, see |
| 3337 <ulink url="http://en.wikipedia.org/wiki/PSNR">the Wikipedia article on PSNR</ulink>. | 3825 <ulink url="http://en.wikipedia.org/wiki/PSNR">the Wikipedia article on PSNR</ulink>. |
| 3338 Global PSNR is the last PSNR number reported when you include | 3826 Global PSNR is the last PSNR number reported when you include |
| 3339 the <option>psnr</option> option in <option>x264encopts</option>. | 3827 the <option>psnr</option> option in <option>x264encopts</option>. |
| 3340 Any time you read a claim about PSNR, one of the assumptions | 3828 Any time you read a claim about PSNR, one of the assumptions |
| 3341 behind the claim is that equal bitrates are used. | 3829 behind the claim is that equal bitrates are used. |
| 3342 </para> | 3830 </para> |
| 3343 | 3831 |
| 3344 <para> | 3832 <para> |
| 3345 Nearly all of this guide's comments assume you are using | 3833 Nearly all of this guide's comments assume you are using two pass. |
| 3346 two pass. | 3834 When comparing options, there are two major reasons for using |
| 3347 When comparing options, there are two major reasons for using | 3835 two pass encoding. |
| 3348 two pass encoding. | 3836 First, using two pass often gains around 1dB PSNR, which is a |
| 3349 First, using two pass often gains around 1dB PSNR, which is a | 3837 very big difference. |
| 3350 very big difference. | 3838 Secondly, testing options by doing direct quality comparisons |
| 3351 Secondly, testing options by doing direct quality comparisons | 3839 with one pass encodes introduces a major confounding |
| 3352 with one pass encodes introduces a major confounding | 3840 factor: bitrate often varies significantly with each encode. |
| 3353 factor: bitrate often varies significantly with each encode. | 3841 It is not always easy to tell whether quality changes are due |
| 3354 It is not always easy to tell whether quality changes are due | 3842 mainly to changed options, or if they mostly reflect essentially |
| 3355 mainly to changed options, or if they mostly reflect essentially | 3843 random differences in the achieved bitrate. |
| 3356 random differences in the achieved bitrate. | 3844 </para> |
| 3357 </para> | |
| 3358 | |
| 3359 </sect3> | 3845 </sect3> |
| 3846 | |
| 3360 | 3847 |
| 3361 <sect3 id="menc-feat-x264-encoding-options-speedvquality"> | 3848 <sect3 id="menc-feat-x264-encoding-options-speedvquality"> |
| 3362 <title>Options which primarily affect speed and quality</title> | 3849 <title>Options which primarily affect speed and quality</title> |
| 3363 | 3850 |
| 3364 <itemizedlist> | 3851 <itemizedlist> |
| 3365 <listitem><para> | 3852 <listitem> |
| 3853 <para> | |
| 3366 <emphasis role="bold">subq</emphasis>: | 3854 <emphasis role="bold">subq</emphasis>: |
| 3367 Of the options which allow you to trade off speed for quality, | 3855 Of the options which allow you to trade off speed for quality, |
| 3368 <option>subq</option> and <option>frameref</option> (see below) are usually | 3856 <option>subq</option> and <option>frameref</option> (see below) are usually |
| 3369 by far the most important. | 3857 by far the most important. |
| 3370 If you are interested in tweaking either speed or quality, these | 3858 If you are interested in tweaking either speed or quality, these |
| 3379 <option>subq</option>'s effect on PSNR seems fairly constant | 3867 <option>subq</option>'s effect on PSNR seems fairly constant |
| 3380 regardless of the number of reference frames. | 3868 regardless of the number of reference frames. |
| 3381 Typically, <option>subq=5</option> achieves 0.2-0.5 dB higher global | 3869 Typically, <option>subq=5</option> achieves 0.2-0.5 dB higher global |
| 3382 PSNR in comparison <option>subq=1</option>. | 3870 PSNR in comparison <option>subq=1</option>. |
| 3383 This is usually enough to be visible. | 3871 This is usually enough to be visible. |
| 3384 </para> | 3872 </para> |
| 3385 <para> | 3873 <para> |
| 3386 <option>subq=6</option> is the slowest, highest quality mode. | 3874 <option>subq=6</option> is slower and yields better quality at a reasonable |
| 3875 cost. | |
| 3387 In comparison to <option>subq=5</option>, it usually gains 0.1-0.4 dB | 3876 In comparison to <option>subq=5</option>, it usually gains 0.1-0.4 dB |
| 3388 global PSNR with speed costs varying from 25%-100%. | 3877 global PSNR with speed costs varying from 25%-100%. |
| 3389 Unlike other levels of <option>subq</option>, the behavior of | 3878 Unlike other levels of <option>subq</option>, the behavior of |
| 3390 <option>subq=6</option> does not depend much on <option>frameref</option> | 3879 <option>subq=6</option> does not depend much on <option>frameref</option> |
| 3391 and <option>me</option>. Instead, the effectiveness of <option>subq=6 | 3880 and <option>me</option>. Instead, the effectiveness of <option>subq=6 |
| 3392 </option> depends mostly upon the number of B-frames used. In normal | 3881 </option> depends mostly upon the number of B-frames used. In normal |
| 3393 usage, this means <option>subq=6</option> has a large impact on both speed | 3882 usage, this means <option>subq=6</option> has a large impact on both speed |
| 3394 and quality in complex, high motion scenes, but it may not have much effect | 3883 and quality in complex, high motion scenes, but it may not have much effect |
| 3395 in low-motion scenes. Note that it is still recommended to always set | 3884 in low-motion scenes. Note that it is still recommended to always set |
| 3396 <option>bframes</option> to something other than zero (see below). | 3885 <option>bframes</option> to something other than zero (see below). |
| 3397 </para></listitem> | 3886 </para> |
| 3398 <listitem><para> | 3887 <para> |
| 3888 <option>subq=7</option> is the slowest, highest quality mode. | |
| 3889 In comparison to <option>subq=6</option>, it usually gains 0.01-0.05 dB | |
| 3890 global PSNR with speed costs varying from 15%-33%. | |
| 3891 Since the tradeoff encoding time vs. quality is quite low, you should | |
| 3892 only use it if you are after every bit saving and if encoding time is | |
| 3893 not an issue. | |
| 3894 </para> | |
| 3895 </listitem> | |
| 3896 <listitem> | |
| 3897 <para> | |
| 3399 <emphasis role="bold">frameref</emphasis>: | 3898 <emphasis role="bold">frameref</emphasis>: |
| 3400 <option>frameref</option> is set to 1 by default, but this | 3899 <option>frameref</option> is set to 1 by default, but this |
| 3401 should not be taken to imply that it is reasonable to set it | 3900 should not be taken to imply that it is reasonable to set it to 1. |
| 3402 to 1. | |
| 3403 Merely raising <option>frameref</option> to 2 gains around | 3901 Merely raising <option>frameref</option> to 2 gains around |
| 3404 0.15dB PSNR with a 5-10% speed penalty; this seems like a | 3902 0.15dB PSNR with a 5-10% speed penalty; this seems like a good tradeoff. |
| 3405 good tradeoff. | |
| 3406 <option>frameref=3</option> gains around 0.25dB PSNR over | 3903 <option>frameref=3</option> gains around 0.25dB PSNR over |
| 3407 <option>frameref=1</option>, which should be a visible | 3904 <option>frameref=1</option>, which should be a visible difference. |
| 3408 difference. | |
| 3409 <option>frameref=3</option> is around 15% slower than | 3905 <option>frameref=3</option> is around 15% slower than |
| 3410 <option>frameref=1</option>. | 3906 <option>frameref=1</option>. |
| 3411 Unfortunately, diminishing returns set in rapidly. | 3907 Unfortunately, diminishing returns set in rapidly. |
| 3412 <option>frameref=6</option> can be expected to gain only | 3908 <option>frameref=6</option> can be expected to gain only |
| 3413 0.05-0.1 dB over <option>frameref=3</option> at an additional | 3909 0.05-0.1 dB over <option>frameref=3</option> at an additional |
| 3414 15% speed penalty. | 3910 15% speed penalty. |
| 3415 Above <option>frameref=6</option>, the quality gains are | 3911 Above <option>frameref=6</option>, the quality gains are |
| 3416 usually very small (although you should keep in mind throughout | 3912 usually very small (although you should keep in mind throughout |
| 3417 this whole discussion that it can vary quite a lot depending on | 3913 this whole discussion that it can vary quite a lot depending on your source). |
| 3418 your source). | |
| 3419 In a fairly typical case, <option>frameref=12</option> | 3914 In a fairly typical case, <option>frameref=12</option> |
| 3420 will improve global PSNR by a tiny 0.02dB over | 3915 will improve global PSNR by a tiny 0.02dB over |
| 3421 <option>frameref=6</option>, at a speed cost of 15%-20%. | 3916 <option>frameref=6</option>, at a speed cost of 15%-20%. |
| 3422 At such high <option>frameref</option> values, the only really | 3917 At such high <option>frameref</option> values, the only really |
| 3423 good thing that can be said is that increasing it even further will | 3918 good thing that can be said is that increasing it even further will |
| 3424 almost certainly never <emphasis role="bold">harm</emphasis> | 3919 almost certainly never <emphasis role="bold">harm</emphasis> |
| 3425 PSNR, but the additional quality benefits are barely even | 3920 PSNR, but the additional quality benefits are barely even |
| 3426 measurable, let alone perceptible. | 3921 measurable, let alone perceptible. |
| 3427 </para> | 3922 </para> |
| 3428 <note><title>Note:</title> | 3923 <note><title>Note:</title> |
| 3429 <para> | 3924 <para> |
| 3430 Raising <option>frameref</option> to unnecessarily high values | 3925 Raising <option>frameref</option> to unnecessarily high values |
| 3431 <emphasis role="bold">can</emphasis> and | 3926 <emphasis role="bold">can</emphasis> and |
| 3432 <emphasis role="bold">usually does</emphasis> | 3927 <emphasis role="bold">usually does</emphasis> |
| 3433 hurt coding efficiency if you turn CABAC off. | 3928 hurt coding efficiency if you turn CABAC off. |
| 3434 With CABAC on (the default behavior), the possibility of setting | 3929 With CABAC on (the default behavior), the possibility of setting |
| 3435 <option>frameref</option> "too high" currently seems too remote | 3930 <option>frameref</option> "too high" currently seems too remote |
| 3436 to even worry about, and in the future, optimizations may remove | 3931 to even worry about, and in the future, optimizations may remove |
| 3437 the possibility altogether. | 3932 the possibility altogether. |
| 3438 </para> | 3933 </para></note> |
| 3439 </note> | 3934 <para> |
| 3440 <para> | |
| 3441 If you care about speed, a reasonable compromise is to use low | 3935 If you care about speed, a reasonable compromise is to use low |
| 3442 <option>subq</option> and <option>frameref</option> values on | 3936 <option>subq</option> and <option>frameref</option> values on |
| 3443 the first pass, and then raise them on the second pass. | 3937 the first pass, and then raise them on the second pass. |
| 3444 Typically, this has a negligible negative effect on the final | 3938 Typically, this has a negligible negative effect on the final |
| 3445 quality: You will probably lose well under 0.1dB PSNR, which | 3939 quality: You will probably lose well under 0.1dB PSNR, which |
| 3446 should be much too small of a difference to see. | 3940 should be much too small of a difference to see. |
| 3447 However, different values of <option>frameref</option> can | 3941 However, different values of <option>frameref</option> can |
| 3448 occasionally affect frametype decision. | 3942 occasionally affect frame type decision. |
| 3449 Most likely, these are rare outlying cases, but if you want to | 3943 Most likely, these are rare outlying cases, but if you want to |
| 3450 be pretty sure, consider whether your video has either | 3944 be pretty sure, consider whether your video has either |
| 3451 fullscreen repetitive flashing patterns or very large temporary | 3945 fullscreen repetitive flashing patterns or very large temporary |
| 3452 occlusions which might force an I-frame. | 3946 occlusions which might force an I-frame. |
| 3453 Adjust the first-pass <option>frameref</option> so it is large | 3947 Adjust the first-pass <option>frameref</option> so it is large |
| 3455 For example, if the scene flashes back and forth between two images | 3949 For example, if the scene flashes back and forth between two images |
| 3456 over a duration of three frames, set the first pass | 3950 over a duration of three frames, set the first pass |
| 3457 <option>frameref</option> to 3 or higher. | 3951 <option>frameref</option> to 3 or higher. |
| 3458 This issue is probably extremely rare in live action video material, | 3952 This issue is probably extremely rare in live action video material, |
| 3459 but it does sometimes come up in video game captures. | 3953 but it does sometimes come up in video game captures. |
| 3460 </para></listitem> | 3954 </para> |
| 3461 | 3955 </listitem> |
| 3462 <listitem><para> | 3956 <listitem> |
| 3957 <para> | |
| 3463 <emphasis role="bold">me</emphasis>: | 3958 <emphasis role="bold">me</emphasis>: |
| 3464 This option is for choosing the motion estimation search method. | 3959 This option is for choosing the motion estimation search method. |
| 3465 Altering this option provides a straightforward quality-vs-speed | 3960 Altering this option provides a straightforward quality-vs-speed |
| 3466 tradeoff. <option>me=1</option> is only a few percent faster than | 3961 tradeoff. <option>me=dia</option> is only a few percent faster than |
| 3467 the default search, at a cost of under 0.1dB global PSNR. The | 3962 the default search, at a cost of under 0.1dB global PSNR. The |
| 3468 default setting (<option>me=2</option>) is a reasonable tradeoff | 3963 default setting (<option>me=hex</option>) is a reasonable tradeoff |
| 3469 between speed and quality. <option>me=3</option> gains a little under | 3964 between speed and quality. <option>me=umh</option> gains a little under |
| 3470 0.1dB global PSNR, with a speed penalty that varies depending on | 3965 0.1dB global PSNR, with a speed penalty that varies depending on |
| 3471 <option>frameref</option>. At high values of | 3966 <option>frameref</option>. At high values of |
| 3472 <option>frameref</option> (e.g. 12 or so), <option>me=3</option> | 3967 <option>frameref</option> (e.g. 12 or so), <option>me=umh</option> |
| 3473 is about 40% slower than the default <option> me=2</option>. With | 3968 is about 40% slower than the default <option> me=hex</option>. With |
| 3474 <option>frameref=3</option>, the speed penalty incurred drops to | 3969 <option>frameref=3</option>, the speed penalty incurred drops to |
| 3475 25%-30%. | 3970 25%-30%. |
| 3476 </para> | 3971 </para> |
| 3477 <para> | 3972 <para> |
| 3478 <option>me=4</option> uses an exhaustive search that is too slow for | 3973 <option>me=esa</option> uses an exhaustive search that is too slow for |
| 3479 practical use. | 3974 practical use. |
| 3480 </para> | 3975 </para> |
| 3481 </listitem> | 3976 </listitem> |
| 3482 | 3977 <listitem><para> |
| 3483 <listitem><para> | 3978 <emphasis role="bold">partitions=all</emphasis>: |
| 3484 <emphasis role="bold">4x4mv</emphasis>: | |
| 3485 This option enables the use of 8x4, 4x8 and 4x4 subpartitions in | 3979 This option enables the use of 8x4, 4x8 and 4x4 subpartitions in |
| 3486 predicted macroblocks. Enabling it results in a fairly consistent | 3980 predicted macroblocks (in addition to the default partitions). |
| 3981 Enabling it results in a fairly consistent | |
| 3487 10%-15% loss of speed. This option is rather useless in source | 3982 10%-15% loss of speed. This option is rather useless in source |
| 3488 containing only low motion, however in some high-motion source, | 3983 containing only low motion, however in some high-motion source, |
| 3489 particularly source with lots of small moving objects, gains of | 3984 particularly source with lots of small moving objects, gains of |
| 3490 about 0.1dB can be expected. | 3985 about 0.1dB can be expected. |
| 3491 </para> | 3986 </para></listitem> |
| 3492 </listitem> | 3987 <listitem> |
| 3493 | 3988 <para> |
| 3494 <listitem><para> | |
| 3495 <emphasis role="bold">bframes</emphasis>: | 3989 <emphasis role="bold">bframes</emphasis>: |
| 3496 If you are used to encoding with other codecs, you may have found | 3990 If you are used to encoding with other codecs, you may have found |
| 3497 that B-frames are not always useful. | 3991 that B-frames are not always useful. |
| 3498 In H.264, this has changed: there are new techniques and block | 3992 In H.264, this has changed: there are new techniques and block |
| 3499 types that are possible in B-frames. | 3993 types that are possible in B-frames. |
| 3500 Usually, even a naive B-frame choice algorithm can have a | 3994 Usually, even a naive B-frame choice algorithm can have a |
| 3501 significant PSNR benefit. | 3995 significant PSNR benefit. |
| 3502 It is interesting to note that using B-frames usually speeds up | 3996 It is interesting to note that using B-frames usually speeds up |
| 3503 the second pass somewhat, and may also speed up a single | 3997 the second pass somewhat, and may also speed up a single |
| 3504 pass encode if adaptive B-frame decision is turned off. | 3998 pass encode if adaptive B-frame decision is turned off. |
| 3505 </para> | 3999 </para> |
| 3506 <para> | 4000 <para> |
| 3507 With adaptive B-frame decision turned off | 4001 With adaptive B-frame decision turned off |
| 3508 (<option>x264encopts</option>'s <option>nob_adapt</option>), | 4002 (<option>x264encopts</option>'s <option>nob_adapt</option>), |
| 3509 the optimal value for this setting is usually no more than | 4003 the optimal value for this setting is usually no more than |
| 3510 <option>bframes=1</option>, or else high-motion scenes can suffer. | 4004 <option>bframes=1</option>, or else high-motion scenes can suffer. |
| 3511 With adaptive B-frame decision on (the default behavior), it is | 4005 With adaptive B-frame decision on (the default behavior), it is |
| 3512 safe to use higher values; the encoder will reduce the use of | 4006 safe to use higher values; the encoder will reduce the use of |
| 3513 B-frames in scenes where they would hurt compression. | 4007 B-frames in scenes where they would hurt compression. |
| 3514 The encoder rarely chooses to use more than 3 or 4 B-frames; | 4008 The encoder rarely chooses to use more than 3 or 4 B-frames; |
| 3515 setting this option any higher will have little effect. | 4009 setting this option any higher will have little effect. |
| 3516 </para></listitem> | 4010 </para> |
| 3517 | 4011 </listitem> |
| 3518 <listitem><para> | 4012 <listitem> |
| 4013 <para> | |
| 3519 <emphasis role="bold">b_adapt</emphasis>: | 4014 <emphasis role="bold">b_adapt</emphasis>: |
| 3520 Note: This is on by default. | 4015 Note: This is on by default. |
| 3521 </para> | 4016 </para> |
| 3522 <para> | 4017 <para> |
| 3523 With this option enabled, the encoder will use a reasonably fast | 4018 With this option enabled, the encoder will use a reasonably fast |
| 3524 decision process to reduce the number of B-frames used in scenes that | 4019 decision process to reduce the number of B-frames used in scenes that |
| 3525 might not benefit from them as much. | 4020 might not benefit from them as much. |
| 3526 You can use <option>b_bias</option> to tweak how B-frame-happy | 4021 You can use <option>b_bias</option> to tweak how B-frame-happy |
| 3527 the encoder is. | 4022 the encoder is. |
| 3528 The speed penalty of adaptive B-frames is currently rather modest, | 4023 The speed penalty of adaptive B-frames is currently rather modest, |
| 3529 but so is the potential quality gain. | 4024 but so is the potential quality gain. |
| 3530 It usually does not hurt, however. | 4025 It usually does not hurt, however. |
| 3531 Note that this only affects speed and frametype decision on the | 4026 Note that this only affects speed and frame type decision on the |
| 3532 first pass. | 4027 first pass. |
| 3533 <option>b_adapt</option> and <option>b_bias</option> have no | 4028 <option>b_adapt</option> and <option>b_bias</option> have no |
| 3534 effect on subsequent passes. | 4029 effect on subsequent passes. |
| 3535 </para></listitem> | 4030 </para> |
| 3536 | 4031 </listitem> |
| 3537 <listitem><para> | 4032 <listitem><para> |
| 3538 <emphasis role="bold">b_pyramid</emphasis>: | 4033 <emphasis role="bold">b_pyramid</emphasis>: |
| 3539 You might as well enable this option if you are using >=2 B-frames; | 4034 You might as well enable this option if you are using >=2 B-frames; |
| 3540 as the man page says, you get a little quality improvement at no | 4035 as the man page says, you get a little quality improvement at no |
| 3541 speed cost. | 4036 speed cost. |
| 3542 Note that these videos cannot be read by libavcodec-based decoders | 4037 Note that these videos cannot be read by libavcodec-based decoders |
| 3543 older than about March 5, 2005. | 4038 older than about March 5, 2005. |
| 3544 </para></listitem> | 4039 </para></listitem> |
| 3545 | 4040 <listitem> |
| 3546 <listitem><para> | 4041 <para> |
| 3547 <emphasis role="bold">weight_b</emphasis>: | 4042 <emphasis role="bold">weight_b</emphasis>: |
| 3548 In typical cases, there is not much gain with this option. | 4043 In typical cases, there is not much gain with this option. |
| 3549 However, in crossfades or fade-to-black scenes, weighted | 4044 However, in crossfades or fade-to-black scenes, weighted |
| 3550 prediction gives rather large bitrate savings. | 4045 prediction gives rather large bitrate savings. |
| 3551 In MPEG-4 ASP, a fade-to-black is usually best coded as a series | 4046 In MPEG-4 ASP, a fade-to-black is usually best coded as a series |
| 3554 B-frames. | 4049 B-frames. |
| 3555 Encoding time cost is minimal, as no extra decisions need to be made. | 4050 Encoding time cost is minimal, as no extra decisions need to be made. |
| 3556 Also, contrary to what some people seem to guess, the decoder | 4051 Also, contrary to what some people seem to guess, the decoder |
| 3557 CPU requirements are not much affected by weighted prediction, | 4052 CPU requirements are not much affected by weighted prediction, |
| 3558 all else being equal. | 4053 all else being equal. |
| 3559 </para> | 4054 </para> |
| 3560 <para> | 4055 <para> |
| 3561 Unfortunately, the current adaptive B-frame decision algorithm | 4056 Unfortunately, the current adaptive B-frame decision algorithm |
| 3562 has a strong tendency to avoid B-frames during fades. | 4057 has a strong tendency to avoid B-frames during fades. |
| 3563 Until this changes, it may be a good idea to add | 4058 Until this changes, it may be a good idea to add |
| 3564 <option>nob_adapt</option> to your x264encopts, if you expect | 4059 <option>nob_adapt</option> to your x264encopts, if you expect |
| 3565 fades to have a large effect in your particular video | 4060 fades to have a large effect in your particular video |
| 3566 clip. | 4061 clip. |
| 3567 </para></listitem> | 4062 </para> |
| 4063 </listitem> | |
| 4064 <listitem id="menc-feat-x264-encoding-options-speedvquality-threads"> | |
| 4065 <para> | |
| 4066 <emphasis role="bold">threads</emphasis>: | |
| 4067 This option allows to spawn threads to encode in parallel on multiple CPUs. | |
| 4068 You can manually select the number of threads to be created or, better, set | |
| 4069 <option>threads=auto</option> and let | |
| 4070 <systemitem class="library">x264</systemitem> detect how many CPUs are | |
| 4071 available and pick an appropriate number of threads. | |
| 4072 If you have a multi-processor machine, you should really consider using it | |
| 4073 as it can to increase encoding speed linearly with the number of CPU cores | |
| 4074 (about 94% per CPU core), with very little quality reduction (about 0.005dB | |
| 4075 for dual processor, about 0.01dB for a quad processor machine). | |
| 4076 </para> | |
| 4077 </listitem> | |
| 3568 </itemizedlist> | 4078 </itemizedlist> |
| 3569 </sect3> | 4079 </sect3> |
| 3570 | 4080 |
| 4081 | |
| 3571 <sect3 id="menc-feat-x264-encoding-options-misc-preferences"> | 4082 <sect3 id="menc-feat-x264-encoding-options-misc-preferences"> |
| 3572 <title>Options pertaining to miscellaneous preferences</title> | 4083 <title>Options pertaining to miscellaneous preferences</title> |
| 4084 | |
| 3573 <itemizedlist> | 4085 <itemizedlist> |
| 3574 <listitem><para> | 4086 <listitem> |
| 4087 <para> | |
| 3575 <emphasis role="bold">Two pass encoding</emphasis>: | 4088 <emphasis role="bold">Two pass encoding</emphasis>: |
| 3576 Above, it was suggested to always use two pass encoding, but there | 4089 Above, it was suggested to always use two pass encoding, but there |
| 3577 are still reasons for not using it. For instance, if you are capturing | 4090 are still reasons for not using it. For instance, if you are capturing |
| 3578 live TV and encoding in realtime, you are forced to use single-pass. | 4091 live TV and encoding in realtime, you are forced to use single-pass. |
| 3579 Also, one pass is obviously faster than two passes; if you use the | 4092 Also, one pass is obviously faster than two passes; if you use the |
| 3580 exact same set of options on both passes, two pass encoding is almost | 4093 exact same set of options on both passes, two pass encoding is almost |
| 3581 twice as slow. | 4094 twice as slow. |
| 3582 </para> | 4095 </para> |
| 3583 <para> | 4096 <para> |
| 3584 Still, there are very good reasons for using two pass encoding. For | 4097 Still, there are very good reasons for using two pass encoding. For |
| 3585 one thing, single pass ratecontrol is not psychic, and it often makes | 4098 one thing, single pass ratecontrol is not psychic, and it often makes |
| 3586 unreasonable choices because it cannot see the big picture. For example, | 4099 unreasonable choices because it cannot see the big picture. For example, |
| 3587 suppose you have a two minute long video consisting of two distinct | 4100 suppose you have a two minute long video consisting of two distinct |
| 3588 halves. The first half is a very high-motion scene lasting 60 seconds | 4101 halves. The first half is a very high-motion scene lasting 60 seconds |
| 3589 which, in isolation, requires about 2500kbps in order to look decent. | 4102 which, in isolation, requires about 2500kbps in order to look decent. |
| 3590 Immediately following it is a much less demanding 60-second scene | 4103 Immediately following it is a much less demanding 60-second scene |
| 3591 that looks good at 300kbps. Suppose you ask for 1400kbps on the theory | 4104 that looks good at 300kbps. Suppose you ask for 1400kbps on the theory |
| 3592 that this is enough to accomodate both scenes. Single pass ratecontrol | 4105 that this is enough to accommodate both scenes. Single pass ratecontrol |
| 3593 will make a couple of "mistakes" in such a case. First of all, it | 4106 will make a couple of "mistakes" in such a case. First of all, it |
| 3594 will target 1400kbps in both segments. The first segment may end up | 4107 will target 1400kbps in both segments. The first segment may end up |
| 3595 heavily overquantized, causing it to look unacceptably and unreasonably | 4108 heavily overquantized, causing it to look unacceptably and unreasonably |
| 3596 blocky. The second segment will be heavily underquantized; it may look | 4109 blocky. The second segment will be heavily underquantized; it may look |
| 3597 perfect, but the bitrate cost of that perfection will be completely | 4110 perfect, but the bitrate cost of that perfection will be completely |
| 3602 of the video. This "error period" of heavily over-quantized low motion | 4115 of the video. This "error period" of heavily over-quantized low motion |
| 3603 will look jarringly bad, and will actually use less than the 300kbps | 4116 will look jarringly bad, and will actually use less than the 300kbps |
| 3604 it would have taken to make it look decent. There are ways to | 4117 it would have taken to make it look decent. There are ways to |
| 3605 mitigate the pitfalls of single-pass encoding, but they may tend to | 4118 mitigate the pitfalls of single-pass encoding, but they may tend to |
| 3606 increase bitrate misprediction. | 4119 increase bitrate misprediction. |
| 3607 </para> | 4120 </para> |
| 3608 <para> | 4121 <para> |
| 3609 Multipass ratecontrol can offer huge advantages over a single pass. | 4122 Multipass ratecontrol can offer huge advantages over a single pass. |
| 3610 Using the statistics gathered from the first pass encode, the encoder | 4123 Using the statistics gathered from the first pass encode, the encoder |
| 3611 can estimate, with reasonable accuracy, the "cost" (in bits) of | 4124 can estimate, with reasonable accuracy, the "cost" (in bits) of |
| 3612 encoding any given frame, at any given quantizer. This allows for | 4125 encoding any given frame, at any given quantizer. This allows for |
| 3613 a much more rational, better planned allocation of bits between the | 4126 a much more rational, better planned allocation of bits between the |
| 3614 expensive (high-motion) and cheap (low-motion) scenes. See | 4127 expensive (high-motion) and cheap (low-motion) scenes. See |
| 3615 <option>qcomp</option> below for some ideas on how to tweak this | 4128 <option>qcomp</option> below for some ideas on how to tweak this |
| 3616 allocation to your liking. | 4129 allocation to your liking. |
| 3617 </para> | 4130 </para> |
| 3618 <para> | 4131 <para> |
| 3619 Moreover, two passes need not take twice as long as one pass. You can | 4132 Moreover, two passes need not take twice as long as one pass. You can |
| 3620 tweak the options in the first pass for higher speed and lower quality. | 4133 tweak the options in the first pass for higher speed and lower quality. |
| 3621 If you choose your options well, you can get a very fast first pass. | 4134 If you choose your options well, you can get a very fast first pass. |
| 3622 The resulting quality in the second pass will be slightly lower because size | 4135 The resulting quality in the second pass will be slightly lower because size |
| 3623 prediction is less accurate, but the quality difference is normally much | 4136 prediction is less accurate, but the quality difference is normally much |
| 3624 too small to be visible. Try, for example, adding | 4137 too small to be visible. Try, for example, adding |
| 3625 <option>subq=1:frameref=1</option> to the first pass | 4138 <option>subq=1:frameref=1</option> to the first pass |
| 3626 <option>x264encopts</option>. Then, on the second pass, use slower, | 4139 <option>x264encopts</option>. Then, on the second pass, use slower, |
| 3627 higher-quality options: | 4140 higher-quality options: |
| 3628 <option>subq=6:frameref=15:4x4mv:me=3</option> | 4141 <option>subq=6:frameref=15:partitions=all:me=umh</option> |
| 3629 </para></listitem> | 4142 </para> |
| 4143 </listitem> | |
| 3630 <listitem><para> | 4144 <listitem><para> |
| 3631 <emphasis role="bold">Three pass encoding</emphasis>? | 4145 <emphasis role="bold">Three pass encoding</emphasis>? |
| 3632 | |
| 3633 x264 offers the ability to make an arbitrary number of consecutive | 4146 x264 offers the ability to make an arbitrary number of consecutive |
| 3634 passes. If you specify <option>pass=1</option> on the first pass, | 4147 passes. If you specify <option>pass=1</option> on the first pass, |
| 3635 then use <option>pass=3</option> on a subsequent pass, the subsequent | 4148 then use <option>pass=3</option> on a subsequent pass, the subsequent |
| 3636 pass will both read the statistics from the previous pass, and write | 4149 pass will both read the statistics from the previous pass, and write |
| 3637 its own statistics. An additional pass following this one will have | 4150 its own statistics. An additional pass following this one will have |
| 3638 a very good base from which to make highly accurate predictions of | 4151 a very good base from which to make highly accurate predictions of |
| 3639 framesizes at a chosen quantizer. In practice, the overall quality | 4152 frame sizes at a chosen quantizer. In practice, the overall quality |
| 3640 gain from this is usually close to zero, and quite possibly a third | 4153 gain from this is usually close to zero, and quite possibly a third |
| 3641 pass will result in slightly worse global PSNR than the pass before | 4154 pass will result in slightly worse global PSNR than the pass before |
| 3642 it. In typical usage, three passes help if you get either bad bitrate | 4155 it. In typical usage, three passes help if you get either bad bitrate |
| 3643 prediction or bad looking scene transitions when using only two passes. | 4156 prediction or bad looking scene transitions when using only two passes. |
| 3644 This is somewhat likely to happen on extremely short clips. There are | 4157 This is somewhat likely to happen on extremely short clips. There are |
| 3645 also a few special cases in which three (or more) passes are handy | 4158 also a few special cases in which three (or more) passes are handy |
| 3646 for advanced users, but for brevity, this guide omits discussing those | 4159 for advanced users, but for brevity, this guide omits discussing those |
| 3647 special cases. | 4160 special cases. |
| 3648 | |
| 3649 </para></listitem> | 4161 </para></listitem> |
| 3650 <listitem><para> | 4162 <listitem><para> |
| 3651 <emphasis role="bold">qcomp</emphasis>: | 4163 <emphasis role="bold">qcomp</emphasis>: |
| 3652 <option>qcomp</option> trades off the number of bits allocated | 4164 <option>qcomp</option> trades off the number of bits allocated |
| 3653 to "expensive" high-motion versus "cheap" low-motion frames. At | 4165 to "expensive" high-motion versus "cheap" low-motion frames. At |
| 3675 and not about seekability, you can set it to much higher values | 4187 and not about seekability, you can set it to much higher values |
| 3676 (understanding that there are diminishing returns which may become | 4188 (understanding that there are diminishing returns which may become |
| 3677 vanishingly low, or even zero). The video stream will still have seekable | 4189 vanishingly low, or even zero). The video stream will still have seekable |
| 3678 points as long as there are some scene changes. | 4190 points as long as there are some scene changes. |
| 3679 </para></listitem> | 4191 </para></listitem> |
| 3680 <listitem><para> | 4192 <listitem> |
| 3681 <emphasis role="bold">deblockalpha, deblockbeta</emphasis>: | 4193 <para> |
| 4194 <emphasis role="bold">deblock</emphasis>: | |
| 3682 This topic is going to be a bit controversial. | 4195 This topic is going to be a bit controversial. |
| 3683 </para> | 4196 </para> |
| 3684 <para> | 4197 <para> |
| 3685 H.264 defines a simple deblocking procedure on I-blocks that uses | 4198 H.264 defines a simple deblocking procedure on I-blocks that uses |
| 3686 pre-set strengths and thresholds depending on the QP of the block | 4199 pre-set strengths and thresholds depending on the QP of the block |
| 3687 in question. | 4200 in question. |
| 3688 By default, high QP blocks are filtered heavily, and low QP blocks | 4201 By default, high QP blocks are filtered heavily, and low QP blocks |
| 3689 are not deblocked at all. | 4202 are not deblocked at all. |
| 3690 The pre-set strengths defined by the standard are well-chosen and | 4203 The pre-set strengths defined by the standard are well-chosen and |
| 3691 the odds are very good that they are PSNR-optimal for whatever | 4204 the odds are very good that they are PSNR-optimal for whatever |
| 3692 video you are trying to encode. | 4205 video you are trying to encode. |
| 3693 The <option>deblockalpha</option> and <option>deblockbeta</option> | 4206 The <option>deblock</option> allow you to specify offsets to the preset |
| 3694 parameters allow you to specify offsets to the preset deblocking | 4207 deblocking thresholds. |
| 3695 thresholds. | 4208 </para> |
| 3696 </para> | 4209 <para> |
| 3697 <para> | |
| 3698 Many people seem to think it is a good idea to lower the deblocking | 4210 Many people seem to think it is a good idea to lower the deblocking |
| 3699 filter strength by large amounts (say, -3). | 4211 filter strength by large amounts (say, -3). |
| 3700 This is however almost never a good idea, and in most cases, | 4212 This is however almost never a good idea, and in most cases, |
| 3701 people who are doing this do not understand very well how | 4213 people who are doing this do not understand very well how |
| 3702 deblocking works by default. | 4214 deblocking works by default. |
| 3703 </para> | 4215 </para> |
| 3704 <para> | 4216 <para> |
| 3705 The first and most important thing to know about the in-loop | 4217 The first and most important thing to know about the in-loop |
| 3706 deblocking filter is that the default thresholds are almost always | 4218 deblocking filter is that the default thresholds are almost always |
| 3707 PSNR-optimal. | 4219 PSNR-optimal. |
| 3708 In the rare cases that they are not optimal, the ideal offset is | 4220 In the rare cases that they are not optimal, the ideal offset is |
| 3709 plus or minus 1. | 4221 plus or minus 1. |
| 3710 Adjusting deblocking parameters by a larger amount is almost | 4222 Adjusting deblocking parameters by a larger amount is almost |
| 3711 guaranteed to hurt PSNR. | 4223 guaranteed to hurt PSNR. |
| 3712 Strengthening the filter will smear more details; weakening the | 4224 Strengthening the filter will smear more details; weakening the |
| 3713 filter will increase the appearance of blockiness. | 4225 filter will increase the appearance of blockiness. |
| 3714 </para> | 4226 </para> |
| 3715 <para> | 4227 <para> |
| 3716 It is definitely a bad idea to lower the deblocking thresholds if | 4228 It is definitely a bad idea to lower the deblocking thresholds if |
| 3717 your source is mainly low in spacial complexity (i.e., not a lot | 4229 your source is mainly low in spacial complexity (i.e., not a lot |
| 3718 of detail or noise). | 4230 of detail or noise). |
| 3719 The in-loop filter does a rather excellent job of concealing | 4231 The in-loop filter does a rather excellent job of concealing |
| 3720 the artifacts that occur. | 4232 the artifacts that occur. |
| 3727 When it comes to subjective quality, noise and detail are somewhat | 4239 When it comes to subjective quality, noise and detail are somewhat |
| 3728 interchangeable. | 4240 interchangeable. |
| 3729 By lowering the deblocking filter strength, you are most likely | 4241 By lowering the deblocking filter strength, you are most likely |
| 3730 increasing error by adding ringing artifacts, but the eye does | 4242 increasing error by adding ringing artifacts, but the eye does |
| 3731 not notice because it confuses the artifacts with detail. | 4243 not notice because it confuses the artifacts with detail. |
| 3732 </para> | 4244 </para> |
| 3733 | 4245 <para> |
| 3734 <para> | |
| 3735 This <emphasis role="bold">still</emphasis> does not justify | 4246 This <emphasis role="bold">still</emphasis> does not justify |
| 3736 lowering the deblocking filter strength, however. | 4247 lowering the deblocking filter strength, however. |
| 3737 You can generally get better quality noise from postprocessing. | 4248 You can generally get better quality noise from postprocessing. |
| 3738 If your H.264 encodes look too blurry or smeared, try playing with | 4249 If your H.264 encodes look too blurry or smeared, try playing with |
| 3739 <option>-vf noise</option> when you play your encoded movie. | 4250 <option>-vf noise</option> when you play your encoded movie. |
| 3740 <option>-vf noise=8a:4a</option> should conceal most mild | 4251 <option>-vf noise=8a:4a</option> should conceal most mild |
| 3741 artifacting. | 4252 artifacts. |
| 3742 It will almost certainly look better than the results you | 4253 It will almost certainly look better than the results you |
| 3743 would have gotten just by fiddling with the deblocking filter. | 4254 would have gotten just by fiddling with the deblocking filter. |
| 3744 </para></listitem> | 4255 </para> |
| 4256 </listitem> | |
| 3745 </itemizedlist> | 4257 </itemizedlist> |
| 3746 </sect3> | 4258 </sect3> |
| 3747 </sect2> | 4259 </sect2> |
| 3748 | 4260 |
| 4261 <!-- ********** --> | |
| 4262 | |
| 3749 <sect2 id="menc-feat-x264-example-settings"> | 4263 <sect2 id="menc-feat-x264-example-settings"> |
| 3750 <title>Encoding setting examples</title> | 4264 <title>Encoding setting examples</title> |
| 3751 | 4265 |
| 3752 <para> | 4266 <para> |
| 3753 The following settings are examples of different encoding | 4267 The following settings are examples of different encoding |
| 3754 option combinations that affect the speed vs quality tradeoff | 4268 option combinations that affect the speed vs quality tradeoff |
| 3755 at the same target bitrate. | 4269 at the same target bitrate. |
| 3756 </para> | 4270 </para> |
| 3757 | 4271 |
| 3758 <para> | 4272 <para> |
| 3759 All the encoding settings were tested on a 720x448 @30000/1001 fps | 4273 All the encoding settings were tested on a 720x448 @30000/1001 fps |
| 3760 video sample, the target bitrate was 900kbps, and the machine was an | 4274 video sample, the target bitrate was 900kbps, and the machine was an |
| 3761 AMD-64 3400+ at 2400 Mhz in 64 bits mode. | 4275 AMD-64 3400+ at 2400 MHz in 64 bits mode. |
| 3762 Each encoding setting features the measured encoding speed (in | 4276 Each encoding setting features the measured encoding speed (in |
| 3763 frames per second) and the PSNR loss (in dB) compared to the "very | 4277 frames per second) and the PSNR loss (in dB) compared to the "very |
| 3764 high quality" setting. | 4278 high quality" setting. |
| 3765 Please understand that depending on your source, your machine type | 4279 Please understand that depending on your source, your machine type |
| 3766 and development advancements, you may get very different results. | 4280 and development advancements, you may get very different results. |
| 3767 </para> | 4281 </para> |
| 3768 | 4282 |
| 3769 <para> | |
| 3770 <informaltable frame="all"> | 4283 <informaltable frame="all"> |
| 3771 <tgroup cols="4"> | 4284 <tgroup cols="4"> |
| 3772 <thead> | 4285 <thead> |
| 3773 <row><entry>Description</entry><entry>Encoding options</entry><entry>speed (in fps)</entry><entry>Relative PSNR loss (in dB)</entry></row> | 4286 <row> |
| 4287 <entry>Description</entry> | |
| 4288 <entry>Encoding options</entry> | |
| 4289 <entry>speed (in fps)</entry> | |
| 4290 <entry>Relative PSNR loss (in dB)</entry> | |
| 4291 </row> | |
| 3774 </thead> | 4292 </thead> |
| 3775 <tbody> | 4293 <tbody> |
| 3776 <row> | 4294 <row> |
| 3777 <entry>Very high quality</entry> | 4295 <entry>Very high quality</entry> |
| 3778 <entry><option>subq=6:4x4mv:8x8dct:me=3:frameref=5:bframes=3:b_pyramid:weight_b</option></entry> | 4296 <entry><option>subq=6:partitions=all:8x8dct:me=umh:frameref=5:bframes=3:b_pyramid:weight_b</option></entry> |
| 3779 <entry>6fps</entry> | 4297 <entry>6fps</entry> |
| 3780 <entry>0dB</entry> | 4298 <entry>0dB</entry> |
| 3781 </row> | 4299 </row> |
| 3782 <row> | 4300 <row> |
| 3783 <entry>High quality</entry> | 4301 <entry>High quality</entry> |
| 3784 <entry><option>subq=5:4x4mv:8x8dct:frameref=2:bframes=3:b_pyramid:weight_b</option></entry> | 4302 <entry><option>subq=5:8x8dct:frameref=2:bframes=3:b_pyramid:weight_b</option></entry> |
| 3785 <entry>13fps</entry> | 4303 <entry>13fps</entry> |
| 3786 <entry>-0.89dB</entry> | 4304 <entry>-0.89dB</entry> |
| 3787 </row> | 4305 </row> |
| 3788 <row> | 4306 <row> |
| 3789 <entry>Fast</entry> | 4307 <entry>Fast</entry> |
| 3792 <entry>-1.48dB</entry> | 4310 <entry>-1.48dB</entry> |
| 3793 </row> | 4311 </row> |
| 3794 </tbody> | 4312 </tbody> |
| 3795 </tgroup> | 4313 </tgroup> |
| 3796 </informaltable> | 4314 </informaltable> |
| 3797 </para> | |
| 3798 </sect2> | 4315 </sect2> |
| 3799 | |
| 3800 </sect1> | 4316 </sect1> |
| 3801 | 4317 |
| 4318 | |
| 4319 <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - --> | |
| 4320 | |
| 4321 | |
| 4322 <sect1 id="menc-feat-video-for-windows"> | |
| 4323 <title> | |
| 4324 Encoding with the <systemitem class="library">Video For Windows</systemitem> | |
| 4325 codec family | |
| 4326 </title> | |
| 4327 | |
| 4328 <para> | |
| 4329 Video for Windows provides simple encoding by means of binary video codecs. | |
| 4330 You can encode with the following codecs (if you have more, please tell us!) | |
| 4331 </para> | |
| 4332 | |
| 4333 <para> | |
| 4334 Note that support for this is very experimental and some codecs may not work | |
| 4335 correctly. Some codecs will only work in certain colorspaces, try | |
| 4336 <option>-vf format=bgr24</option> and <option>-vf format=yuy2</option> | |
| 4337 if a codec fails or gives wrong output. | |
| 4338 </para> | |
| 4339 | |
| 4340 <!-- ********** --> | |
| 4341 | |
| 4342 <sect2 id="menc-feat-enc-vfw-video-codecs"> | |
| 4343 <title>Video for Windows supported codecs</title> | |
| 4344 | |
| 4345 <para> | |
| 4346 <informaltable frame="all"> | |
| 4347 <tgroup cols="4"> | |
| 4348 <thead> | |
| 4349 <row> | |
| 4350 <entry>Video codec file name</entry> | |
| 4351 <entry>Description (FourCC)</entry> | |
| 4352 <entry>md5sum</entry> | |
| 4353 <entry>Comment</entry> | |
| 4354 </row> | |
| 4355 </thead> | |
| 4356 <tbody> | |
| 4357 <row> | |
| 4358 <entry>aslcodec_vfw.dll</entry> | |
| 4359 <entry>Alparysoft lossless codec vfw (ASLC)</entry> | |
| 4360 <entry>608af234a6ea4d90cdc7246af5f3f29a</entry> | |
| 4361 <entry></entry> | |
| 4362 </row> | |
| 4363 <row> | |
| 4364 <entry>avimszh.dll</entry> | |
| 4365 <entry>AVImszh (MSZH)</entry> | |
| 4366 <entry>253118fe1eedea04a95ed6e5f4c28878</entry> | |
| 4367 <entry>needs <option>-vf format</option></entry> | |
| 4368 </row> | |
| 4369 <row> | |
| 4370 <entry>avizlib.dll</entry> | |
| 4371 <entry>AVIzlib (ZLIB)</entry> | |
| 4372 <entry>2f1cc76bbcf6d77d40d0e23392fa8eda</entry> | |
| 4373 <entry></entry> | |
| 4374 </row> | |
| 4375 <row> | |
| 4376 <entry>divx.dll</entry> | |
| 4377 <entry>DivX4Windows-VFW</entry> | |
| 4378 <entry>acf35b2fc004a89c829531555d73f1e6</entry> | |
| 4379 <entry></entry> | |
| 4380 </row> | |
| 4381 <row> | |
| 4382 <entry>huffyuv.dll</entry> | |
| 4383 <entry>HuffYUV (lossless) (HFYU)</entry> | |
| 4384 <entry>b74695b50230be4a6ef2c4293a58ac3b</entry> | |
| 4385 <entry></entry> | |
| 4386 </row> | |
| 4387 <row> | |
| 4388 <entry>iccvid.dll</entry> | |
| 4389 <entry>Cinepak Video (cvid)</entry> | |
| 4390 <entry>cb3b7ee47ba7dbb3d23d34e274895133</entry> | |
| 4391 <entry></entry> | |
| 4392 </row> | |
| 4393 <row> | |
| 4394 <entry>icmw_32.dll</entry> | |
| 4395 <entry>Motion Wavelets (MWV1)</entry> | |
| 4396 <entry>c9618a8fc73ce219ba918e3e09e227f2</entry> | |
| 4397 <entry></entry> | |
| 4398 </row> | |
| 4399 <row> | |
| 4400 <entry>jp2avi.dll</entry> | |
| 4401 <entry>ImagePower MJPEG2000 (IPJ2)</entry> | |
| 4402 <entry>d860a11766da0d0ea064672c6833768b</entry> | |
| 4403 <entry><option>-vf flip</option></entry> | |
| 4404 </row> | |
| 4405 <row> | |
| 4406 <entry>m3jp2k32.dll</entry> | |
| 4407 <entry>Morgan MJPEG2000 (MJ2C)</entry> | |
| 4408 <entry>f3c174edcbaef7cb947d6357cdfde7ff</entry> | |
| 4409 <entry></entry> | |
| 4410 </row> | |
| 4411 <row> | |
| 4412 <entry>m3jpeg32.dll</entry> | |
| 4413 <entry>Morgan Motion JPEG Codec (MJPEG)</entry> | |
| 4414 <entry>1cd13fff5960aa2aae43790242c323b1</entry> | |
| 4415 <entry></entry> | |
| 4416 </row> | |
| 4417 <row> | |
| 4418 <entry>mpg4c32.dll</entry> | |
| 4419 <entry>Microsoft MPEG-4 v1/v2</entry> | |
| 4420 <entry>b5791ea23f33010d37ab8314681f1256</entry> | |
| 4421 <entry></entry> | |
| 4422 </row> | |
| 4423 <row> | |
| 4424 <entry>tsccvid.dll</entry> | |
| 4425 <entry>TechSmith Camtasia Screen Codec (TSCC)</entry> | |
| 4426 <entry>8230d8560c41d444f249802a2700d1d5</entry> | |
| 4427 <entry>shareware error on windows</entry> | |
| 4428 </row> | |
| 4429 <row> | |
| 4430 <entry>vp31vfw.dll</entry> | |
| 4431 <entry>On2 Open Source VP3 Codec (VP31)</entry> | |
| 4432 <entry>845f3590ea489e2e45e876ab107ee7d2</entry> | |
| 4433 <entry></entry> | |
| 4434 </row> | |
| 4435 <row> | |
| 4436 <entry>vp4vfw.dll</entry> | |
| 4437 <entry>On2 VP4 Personal Codec (VP40)</entry> | |
| 4438 <entry>fc5480a482ccc594c2898dcc4188b58f</entry> | |
| 4439 <entry></entry> | |
| 4440 </row> | |
| 4441 <row> | |
| 4442 <entry>vp6vfw.dll</entry> | |
| 4443 <entry>On2 VP6 Personal Codec (VP60)</entry> | |
| 4444 <entry>04d635a364243013898fd09484f913fb</entry> | |
| 4445 <entry></entry> | |
| 4446 </row> | |
| 4447 <row> | |
| 4448 <entry>vp7vfw.dll</entry> | |
| 4449 <entry>On2 VP7 Personal Codec (VP70)</entry> | |
| 4450 <entry>cb4cc3d4ea7c94a35f1d81c3d750bc8d</entry> | |
| 4451 <entry><option>-ffourcc VP70</option></entry> | |
| 4452 </row> | |
| 4453 <row> | |
| 4454 <entry>ViVD2.dll</entry> | |
| 4455 <entry>SoftMedia ViVD V2 codec VfW (GXVE)</entry> | |
| 4456 <entry>a7b4bf5cac630bb9262c3f80d8a773a1</entry> | |
| 4457 <entry></entry> | |
| 4458 </row> | |
| 4459 <row> | |
| 4460 <entry>msulvc06.DLL</entry> | |
| 4461 <entry>MSU Lossless codec (MSUD)</entry> | |
| 4462 <entry>294bf9288f2f127bb86f00bfcc9ccdda</entry> | |
| 4463 <entry> | |
| 4464 Decodable by <application>Window Media Player</application>, | |
| 4465 not <application>MPlayer</application> (yet). | |
| 4466 </entry> | |
| 4467 </row> | |
| 4468 <row> | |
| 4469 <entry>camcodec.dll</entry> | |
| 4470 <entry>CamStudio lossless video codec (CSCD)</entry> | |
| 4471 <entry>0efe97ce08bb0e40162ab15ef3b45615</entry> | |
| 4472 <entry>sf.net/projects/camstudio</entry> | |
| 4473 </row> | |
| 4474 </tbody> | |
| 4475 </tgroup> | |
| 4476 </informaltable> | |
| 4477 | |
| 4478 The first column contains the codec names that should be passed after the | |
| 4479 <literal>codec</literal> parameter, | |
| 4480 like: <option>-xvfwopts codec=divx.dll</option> | |
| 4481 The FourCC code used by each codec is given in the parentheses. | |
| 4482 </para> | |
| 4483 | |
| 4484 <informalexample> | |
| 4485 <para> | |
| 4486 An example to convert an ISO DVD trailer to a VP6 flash video file | |
| 4487 using compdata bitrate settings: | |
| 4488 <screen> | |
| 4489 mencoder -dvd-device <replaceable>zeiram.iso</replaceable> dvd://7 -o <replaceable>trailer.flv</replaceable> \ | |
| 4490 -ovc vfw -xvfwopts codec=vp6vfw.dll:compdata=onepass.mcf -oac mp3lame \ | |
| 4491 -lameopts cbr:br=64 -af lavcresample=22050 -vf yadif,scale=320:240,flip \ | |
| 4492 -of lavf | |
| 4493 </screen> | |
| 4494 </para> | |
| 4495 </informalexample> | |
| 4496 </sect2> | |
| 4497 | |
| 4498 <sect2 id="menc-feat-video-for-windows-bitrate-settings"> | |
| 4499 <title>Using vfw2menc to create a codec settings file.</title> | |
| 4500 | |
| 4501 <para> | |
| 4502 To encode with the Video for Windows codecs, you will need to set bitrate | |
| 4503 and other options. This is known to work on x86 on both *NIX and Windows. | |
| 4504 </para> | |
| 4505 <para> | |
| 4506 First you must build the <application>vfw2menc</application> program. | |
| 4507 It is located in the <filename class="directory">TOOLS</filename> subdirectory | |
| 4508 of the MPlayer source tree. | |
| 4509 To build on Linux, this can be done using <application>Wine</application>: | |
| 4510 <screen>winegcc vfw2menc.c -o vfw2menc -lwinmm -lole32</screen> | |
| 4511 | |
| 4512 To build on Windows in <application>MinGW</application> or | |
| 4513 <application>Cygwin</application> use: | |
| 4514 <screen>gcc vfw2menc.c -o vfw2menc.exe -lwinmm -lole32</screen> | |
| 4515 | |
| 4516 To build on <application>MSVC</application> you will need getopt. | |
| 4517 Getopt can be found in the original <application>vfw2menc</application> | |
| 4518 archive available at: | |
| 4519 The <ulink url="http://oss.netfarm.it/mplayer-win32.php">MPlayer on win32</ulink> project. | |
| 4520 </para> | |
| 4521 <informalexample> | |
| 4522 <para> | |
| 4523 Below is an example with the VP6 codec. | |
| 4524 <screen> | |
| 4525 vfw2menc -f VP62 -d vp6vfw.dll -s firstpass.mcf | |
| 4526 </screen> | |
| 4527 This will open the VP6 codec dialog window. | |
| 4528 Repeat this step for the second pass | |
| 4529 and use <option>-s <replaceable>secondpass.mcf</replaceable></option>. | |
| 4530 </para> | |
| 4531 </informalexample> | |
| 4532 <para> | |
| 4533 Windows users can use | |
| 4534 <option>-xvfwopts codec=vp6vfw.dll:compdata=dialog</option> to have | |
| 4535 the codec dialog display before encoding starts. | |
| 4536 </para> | |
| 4537 </sect2> | |
| 4538 </sect1> | |
| 4539 | |
| 4540 | |
| 4541 <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - --> | |
| 4542 | |
| 4543 | |
| 4544 <sect1 id="menc-feat-quicktime-7"> | |
| 4545 <title>Using <application>MEncoder</application> to create | |
| 4546 <application>QuickTime</application>-compatible files</title> | |
| 4547 | |
| 4548 | |
| 4549 <sect2 id="menc-feat-quicktime-7-why-use-it"> | |
| 4550 <title>Why would one want to produce <application>QuickTime</application>-compatible Files?</title> | |
| 4551 | |
| 4552 <para> | |
| 4553 There are several reasons why producing | |
| 4554 <application>QuickTime</application>-compatible files can be desirable. | |
| 4555 </para> | |
| 4556 <itemizedlist> | |
| 4557 <listitem><para> | |
| 4558 You want any computer illiterate to be able to watch your encode on | |
| 4559 any major platform (Windows, Mac OS X, Unices …). | |
| 4560 </para></listitem> | |
| 4561 <listitem><para> | |
| 4562 <application>QuickTime</application> is able to take advantage of more | |
| 4563 hardware and software acceleration features of Mac OS X than | |
| 4564 platform-independent players like <application>MPlayer</application> | |
| 4565 or <application>VLC</application>. | |
| 4566 That means that your encodes have a chance to be played smoothly by older | |
| 4567 G4-powered machines. | |
| 4568 </para></listitem> | |
| 4569 <listitem><para> | |
| 4570 <application>QuickTime</application> 7 supports the next-generation codec H.264, | |
| 4571 which yields significantly better picture quality than previous codec | |
| 4572 generations (MPEG-2, MPEG-4 …). | |
| 4573 </para></listitem> | |
| 4574 </itemizedlist> | |
| 4575 </sect2> | |
| 4576 | |
| 4577 <sect2 id="menc-feat-quicktime-7-constraints"> | |
| 4578 <title><application>QuickTime</application> 7 limitations</title> | |
| 4579 | |
| 4580 <para> | |
| 4581 <application>QuickTime</application> 7 supports H.264 video and AAC audio, | |
| 4582 but it does not support them muxed in the AVI container format. | |
| 4583 However, you can use <application>MEncoder</application> to encode | |
| 4584 the video and audio, and then use an external program such as | |
| 4585 <application>mp4creator</application> (part of the | |
| 4586 <ulink url="http://mpeg4ip.sourceforge.net/">MPEG4IP suite</ulink>) | |
| 4587 to remux the video and audio tracks into an MP4 container. | |
| 4588 </para> | |
| 4589 | |
| 4590 <para> | |
| 4591 <application>QuickTime</application>'s support for H.264 is limited, | |
| 4592 so you will need to drop some advanced features. | |
| 4593 If you encode your video with features that | |
| 4594 <application>QuickTime</application> 7 does not support, | |
| 4595 <application>QuickTime</application>-based players will show you a pretty | |
| 4596 white screen instead of your expected video. | |
| 4597 </para> | |
| 4598 | |
| 4599 <itemizedlist> | |
| 4600 <listitem><para> | |
| 4601 <emphasis role="bold">B-frames</emphasis>: | |
| 4602 <application>QuickTime</application> 7 supports a maximum of 1 B-frame, i.e. | |
| 4603 <option>-x264encopts bframes=1</option>. This means that | |
| 4604 <option>b_pyramid</option> and <option>weight_b</option> will have no | |
| 4605 effect, since they require <option>bframes</option> to be greater than 1. | |
| 4606 </para></listitem> | |
| 4607 <listitem><para> | |
| 4608 <emphasis role="bold">Macroblocks</emphasis>: | |
| 4609 <application>QuickTime</application> 7 does not support 8x8 DCT macroblocks. | |
| 4610 This option (<option>8x8dct</option>) is off by default, so just be sure | |
| 4611 not to explicitly enable it. This also means that the <option>i8x8</option> | |
| 4612 option will have no effect, since it requires <option>8x8dct</option>. | |
| 4613 </para></listitem> | |
| 4614 <listitem><para> | |
| 4615 <emphasis role="bold">Aspect ratio</emphasis>: | |
| 4616 <application>QuickTime</application> 7 does not support SAR (sample | |
| 4617 aspect ratio) information in MPEG-4 files; it assumes that SAR=1. Read | |
| 4618 <link linkend="menc-feat-quicktime-7-scale">the section on scaling</link> | |
| 4619 for a workaround. | |
| 4620 </para></listitem> | |
| 4621 </itemizedlist> | |
| 4622 | |
| 4623 </sect2> | |
| 4624 | |
| 4625 <sect2 id="menc-feat-quicktime-7-crop"> | |
| 4626 <title>Cropping</title> | |
| 4627 <para> | |
| 4628 Suppose you want to rip your freshly bought copy of "The Chronicles of | |
| 4629 Narnia". Your DVD is region 1, | |
| 4630 which means it is NTSC. The example below would still apply to PAL, | |
| 4631 except you would omit <option>-ofps 24000/1001</option> and use slightly | |
| 4632 different <option>crop</option> and <option>scale</option> dimensions. | |
| 4633 </para> | |
| 4634 | |
| 4635 <para> | |
| 4636 After running <option>mplayer dvd://1</option>, you follow the process | |
| 4637 detailed in the section <link linkend="menc-feat-telecine">How to deal | |
| 4638 with telecine and interlacing in NTSC DVDs</link> and discover that it is | |
| 4639 24000/1001 fps progressive video. This simplifies the process somewhat, | |
| 4640 since you do not need to use an inverse telecine filter such as | |
| 4641 <option>pullup</option> or a deinterlacing filter such as | |
| 4642 <option>yadif</option>. | |
| 4643 </para> | |
| 4644 | |
| 4645 <para> | |
| 4646 Next, you need to crop out the black bars from the top and bottom of the | |
| 4647 video, as detailed in <link linkend="menc-feat-dvd-mpeg4-example-crop">this</link> | |
| 4648 previous section. | |
| 4649 </para> | |
| 4650 | |
| 4651 </sect2> | |
| 4652 | |
| 4653 <sect2 id="menc-feat-quicktime-7-scale"> | |
| 4654 <title>Scaling</title> | |
| 4655 | |
| 4656 <para> | |
| 4657 The next step is truly heartbreaking. | |
| 4658 <application>QuickTime</application> 7 does not support MPEG-4 videos | |
| 4659 with a sample aspect ratio other than 1, so you will need to upscale | |
| 4660 (which wastes a lot of disk space) or downscale (which loses some | |
| 4661 details of the source) the video to square pixels. | |
| 4662 Either way you do it, this is highly inefficient, but simply cannot | |
| 4663 be avoided if you want your video to be playable by | |
| 4664 <application>QuickTime</application> 7. | |
| 4665 <application>MEncoder</application> can apply the appropriate upscaling | |
| 4666 or downscaling by specifying respectively <option>-vf scale=-10:-1</option> | |
| 4667 or <option>-vf scale=-1:-10</option>. | |
| 4668 This will scale your video to the correct width for the cropped height, | |
| 4669 rounded to the closest multiple of 16 for optimal compression. | |
| 4670 Remember that if you are cropping, you should crop first, then scale: | |
| 4671 | |
| 4672 <screen>-vf crop=720:352:0:62,scale=-10:-1</screen> | |
| 4673 </para> | |
| 4674 | |
| 4675 </sect2> | |
| 4676 | |
| 4677 <sect2 id="menc-feat-quicktime-7-avsync"> | |
| 4678 <title>A/V sync</title> | |
| 4679 | |
| 4680 <para> | |
| 4681 Because you will be remuxing into a different container, you should | |
| 4682 always use the <option>harddup</option> option to ensure that duplicated | |
| 4683 frames are actually duplicated in the video output. Without this option, | |
| 4684 <application>MEncoder</application> will simply put a marker in the video | |
| 4685 stream that a frame was duplicated, and rely on the client software to | |
| 4686 show the same frame twice. Unfortunately, this "soft duplication" does | |
| 4687 not survive remuxing, so the audio would slowly lose sync with the video. | |
| 4688 </para> | |
| 4689 | |
| 4690 <para> | |
| 4691 The final filter chain looks like this: | |
| 4692 <screen>-vf crop=720:352:0:62,scale=-10:-1,harddup</screen> | |
| 4693 </para> | |
| 4694 | |
| 4695 </sect2> | |
| 4696 | |
| 4697 <sect2 id="menc-feat-quicktime-7-bitrate"> | |
| 4698 <title>Bitrate</title> | |
| 4699 | |
| 4700 <para> | |
| 4701 As always, the selection of bitrate is a matter of the technical properties | |
| 4702 of the source, as explained | |
| 4703 <link linkend="menc-feat-dvd-mpeg4-resolution-bitrate">here</link>, as | |
| 4704 well as a matter of taste. | |
| 4705 This movie has a fair bit of action and lots of detail, but H.264 video | |
| 4706 looks good at much lower bitrates than XviD or other MPEG-4 codecs. | |
| 4707 After much experimentation, the author of this guide chose to encode | |
| 4708 this movie at 900kbps, and thought that it looked very good. | |
| 4709 You may decrease bitrate if you need to save more space, or increase | |
| 4710 it if you need to improve quality. | |
| 4711 </para> | |
| 4712 | |
| 4713 </sect2> | |
| 4714 | |
| 4715 <sect2 id="menc-feat-quicktime-7-example"> | |
| 4716 <title>Encoding example</title> | |
| 4717 | |
| 4718 <para> | |
| 4719 You are now ready to encode the video. Since you care about | |
| 4720 quality, of course you will be doing a two-pass encode. To shave off | |
| 4721 some encoding time, you can specify the <option>turbo</option> option | |
| 4722 on the first pass; this reduces <option>subq</option> and | |
| 4723 <option>frameref</option> to 1. To save some disk space, you can | |
| 4724 use the <option>ss</option> option to strip off the first few seconds | |
| 4725 of the video. (I found that this particular movie has 32 seconds of | |
| 4726 credits and logos.) <option>bframes</option> can be 0 or 1. | |
| 4727 The other options are documented in <link | |
| 4728 linkend="menc-feat-x264-encoding-options-speedvquality">Encoding with | |
| 4729 the <systemitem class="library">x264</systemitem> codec</link> and | |
| 4730 the man page. | |
| 4731 | |
| 4732 <screen>mencoder dvd://1 -o /dev/null -ss 32 -ovc x264 \ | |
| 4733 -x264encopts pass=1:turbo:bitrate=900:bframes=1:\ | |
| 4734 me=umh:partitions=all:trellis=1:qp_step=4:qcomp=0.7:direct_pred=auto:keyint=300 \ | |
| 4735 -vf crop=720:352:0:62,scale=-10:-1,harddup \ | |
| 4736 -oac faac -faacopts br=192:mpeg=4:object=2 -channels 2 -srate 48000 \ | |
| 4737 -ofps 24000/1001</screen> | |
| 4738 | |
| 4739 If you have a multi-processor machine, don't miss the opportunity to | |
| 4740 dramatically speed-up encoding by enabling | |
| 4741 <link linkend="menc-feat-x264-encoding-options-speedvquality-threads"> | |
| 4742 <systemitem class="library">x264</systemitem>'s multi-threading mode</link> | |
| 4743 by adding <option>threads=auto</option> to your <option>x264encopts</option> | |
| 4744 command-line. | |
| 4745 </para> | |
| 4746 | |
| 4747 <para> | |
| 4748 The second pass is the same, except that you specify the output file | |
| 4749 and set <option>pass=2</option>. | |
| 4750 | |
| 4751 <screen>mencoder dvd://1 <emphasis role="bold">-o narnia.avi</emphasis> -ss 32 -ovc x264 \ | |
| 4752 -x264encopts <emphasis role="bold">pass=2</emphasis>:turbo:bitrate=900:frameref=5:bframes=1:\ | |
| 4753 me=umh:partitions=all:trellis=1:qp_step=4:qcomp=0.7:direct_pred=auto:keyint=300 \ | |
| 4754 -vf crop=720:352:0:62,scale=-10:-1,harddup \ | |
| 4755 -oac faac -faacopts br=192:mpeg=4:object=2 -channels 2 -srate 48000 \ | |
| 4756 -ofps 24000/1001</screen> | |
| 4757 </para> | |
| 4758 | |
| 4759 <para> | |
| 4760 The resulting AVI should play perfectly in | |
| 4761 <application>MPlayer</application>, but of course | |
| 4762 <application>QuickTime</application> can not play it because it does | |
| 4763 not support H.264 muxed in AVI. | |
| 4764 So the next step is to remux the video into an MP4 container. | |
| 4765 </para> | |
| 4766 </sect2> | |
| 4767 | |
| 4768 <sect2 id="menc-feat-quicktime-7-remux"> | |
| 4769 <title>Remuxing as MP4</title> | |
| 4770 | |
| 4771 <para> | |
| 4772 There are several ways to remux AVI files to MP4. You can use | |
| 4773 <application>mp4creator</application>, which is part of the | |
| 4774 <ulink url="http://mpeg4ip.sourceforge.net/">MPEG4IP suite</ulink>. | |
| 4775 </para> | |
| 4776 | |
| 4777 <para> | |
| 4778 First, demux the AVI into separate audio and video streams using | |
| 4779 <application>MPlayer</application>. | |
| 4780 | |
| 4781 <screen>mplayer narnia.avi -dumpaudio -dumpfile narnia.aac | |
| 4782 mplayer narnia.avi -dumpvideo -dumpfile narnia.h264</screen> | |
| 4783 | |
| 4784 The file names are important; <application>mp4creator</application> | |
| 4785 requires that AAC audio streams be named <systemitem>.aac</systemitem> | |
| 4786 and H.264 video streams be named <systemitem>.h264</systemitem>. | |
| 4787 </para> | |
| 4788 | |
| 4789 <para> | |
| 4790 Now use <application>mp4creator</application> to create a new | |
| 4791 MP4 file out of the audio and video streams. | |
| 4792 | |
| 4793 <screen>mp4creator -create=narnia.aac narnia.mp4 | |
| 4794 mp4creator -create=narnia.h264 -rate=23.976 narnia.mp4</screen> | |
| 4795 | |
| 4796 Unlike the encoding step, you must specify the framerate as a | |
| 4797 decimal (such as 23.976), not a fraction (such as 24000/1001). | |
| 4798 </para> | |
| 4799 | |
| 4800 <para> | |
| 4801 This <systemitem>narnia.mp4</systemitem> file should now be playable | |
| 4802 with any <application>QuickTime</application> 7 application, such as | |
| 4803 <application>QuickTime Player</application> or | |
| 4804 <application>iTunes</application>. If you are planning to view the | |
| 4805 video in a web browser with the <application>QuickTime</application> | |
| 4806 plugin, you should also hint the movie so that the | |
| 4807 <application>QuickTime</application> plugin can start playing it | |
| 4808 while it is still downloading. <application>mp4creator</application> | |
| 4809 can create these hint tracks: | |
| 4810 | |
| 4811 <screen>mp4creator -hint=1 narnia.mp4 | |
| 4812 mp4creator -hint=2 narnia.mp4 | |
| 4813 mp4creator -optimize narnia.mp4</screen> | |
| 4814 | |
| 4815 You can check the final result to ensure that the hint tracks were | |
| 4816 created successfully: | |
| 4817 | |
| 4818 <screen>mp4creator -list narnia.mp4</screen> | |
| 4819 | |
| 4820 You should see a list of tracks: 1 audio, 1 video, and 2 hint tracks. | |
| 4821 | |
| 4822 <screen>Track Type Info | |
| 4823 1 audio MPEG-4 AAC LC, 8548.714 secs, 190 kbps, 48000 Hz | |
| 4824 2 video H264 Main@5.1, 8549.132 secs, 899 kbps, 848x352 @ 23.976001 fps | |
| 4825 3 hint Payload mpeg4-generic for track 1 | |
| 4826 4 hint Payload H264 for track 2 | |
| 4827 </screen> | |
| 4828 </para> | |
| 4829 | |
| 4830 </sect2> | |
| 4831 | |
| 4832 <sect2 id="menc-feat-quicktime-7-metadata"> | |
| 4833 <title>Adding metadata tags</title> | |
| 4834 | |
| 4835 <para> | |
| 4836 If you want to add tags to your video that show up in iTunes, you can use | |
| 4837 <ulink url="http://atomicparsley.sourceforge.net/">AtomicParsley</ulink>. | |
| 4838 | |
| 4839 <screen>AtomicParsley narnia.mp4 --metaEnema --title "The Chronicles of Narnia" --year 2005 --stik Movie --freefree --overWrite</screen> | |
| 4840 | |
| 4841 The <option>--metaEnema</option> option removes any existing metadata | |
| 4842 (<application>mp4creator</application> inserts its name in the | |
| 4843 "encoding tool" tag), and <option>--freefree</option> reclaims the | |
| 4844 space from the deleted metadata. | |
| 4845 The <option>--stik</option> option sets the type of video (such as Movie | |
| 4846 or TV Show), which iTunes uses to group related video files. | |
| 4847 The <option>--overWrite</option> option overwrites the original file; | |
| 4848 without it, <application>AtomicParsley</application> creates a new | |
| 4849 auto-named file in the same directory and leaves the original file | |
| 4850 untouched. | |
| 4851 </para> | |
| 4852 | |
| 4853 </sect2> | |
| 4854 | |
| 4855 </sect1> | |
| 4856 | |
| 4857 | |
| 4858 <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - --> | |
| 4859 | |
| 4860 | |
| 3802 <sect1 id="menc-feat-vcd-dvd"> | 4861 <sect1 id="menc-feat-vcd-dvd"> |
| 3803 <title>Using MEncoder to create VCD/SVCD/DVD-compliant files.</title> | 4862 <title>Using <application>MEncoder</application> |
| 4863 to create VCD/SVCD/DVD-compliant files</title> | |
| 3804 | 4864 |
| 3805 <sect2 id="menc-feat-vcd-dvd-constraints"> | 4865 <sect2 id="menc-feat-vcd-dvd-constraints"> |
| 3806 <title>Format Constraints</title> | 4866 <title>Format Constraints</title> |
| 3807 <para> | 4867 |
| 3808 <application>MEncoder</application> is capable of creating VCD, SCVD | 4868 <para> |
| 3809 and DVD format MPEG files using the | 4869 <application>MEncoder</application> is capable of creating VCD, SCVD |
| 3810 <systemitem class="library">libavcodec</systemitem> library. | 4870 and DVD format MPEG files using the |
| 3811 These files can then be used in conjunction with | 4871 <systemitem class="library">libavcodec</systemitem> library. |
| 3812 <ulink url="http://www.gnu.org/software/vcdimager/vcdimager.html">vcdimager</ulink> | 4872 These files can then be used in conjunction with |
| 3813 or | 4873 <ulink url="http://www.gnu.org/software/vcdimager/vcdimager.html">vcdimager</ulink> |
| 3814 <ulink url="http://dvdauthor.sourceforge.net/">dvdauthor</ulink> | 4874 or |
| 3815 to create discs that will play on a standard set-top player. | 4875 <ulink url="http://dvdauthor.sourceforge.net/">dvdauthor</ulink> |
| 3816 </para> | 4876 to create discs that will play on a standard set-top player. |
| 3817 | 4877 </para> |
| 3818 <para> | 4878 |
| 3819 The DVD, SVCD, and VCD formats are subject to heavy constraints. | 4879 <para> |
| 3820 Only a small selection of encoded picture sizes and aspect ratios are | 4880 The DVD, SVCD, and VCD formats are subject to heavy constraints. |
| 3821 available. | 4881 Only a small selection of encoded picture sizes and aspect ratios are |
| 3822 If your movie does not already meet these requirements, you may have | 4882 available. |
| 3823 to scale,crop or add black borders to the picture to make it | 4883 If your movie does not already meet these requirements, you may have |
| 3824 compliant. | 4884 to scale, crop or add black borders to the picture to make it |
| 3825 </para> | 4885 compliant. |
| 4886 </para> | |
| 4887 | |
| 3826 | 4888 |
| 3827 <sect3 id="menc-feat-vcd-dvd-constraints-resolution"> | 4889 <sect3 id="menc-feat-vcd-dvd-constraints-resolution"> |
| 3828 <title>Format Constraints</title> | 4890 <title>Format Constraints</title> |
| 3829 | 4891 |
| 3830 <informaltable frame="all"> | 4892 <informaltable frame="all"> |
| 3831 <tgroup cols="9"> | 4893 <tgroup cols="9"> |
| 3832 <thead> | 4894 <thead> |
| 3833 <row> | 4895 <row> |
| 3834 <entry>Format</entry> | 4896 <entry>Format</entry> |
| 3835 <entry>Resolution</entry> | 4897 <entry>Resolution</entry> |
| 3836 <entry>V. Codec</entry> | 4898 <entry>V. Codec</entry> |
| 3837 <entry>V. Bitrate</entry> | 4899 <entry>V. Bitrate</entry> |
| 3838 <entry>Sample Rate</entry> | 4900 <entry>Sample Rate</entry> |
| 3839 <entry>A. Codec</entry> | 4901 <entry>A. Codec</entry> |
| 3840 <entry>A. Bitrate</entry> | 4902 <entry>A. Bitrate</entry> |
| 3841 <entry>FPS</entry> | 4903 <entry>FPS</entry> |
| 3842 <entry>Aspect</entry> | 4904 <entry>Aspect</entry> |
| 3843 </row> | 4905 </row> |
| 3844 </thead> | 4906 </thead> |
| 3845 <tbody> | 4907 <tbody> |
| 3846 <row> | 4908 <row> |
| 3847 <entry>NTSC DVD</entry> | 4909 <entry>NTSC DVD</entry> |
| 3848 <entry>720x480, 704x480, 352x480, 352x240</entry> | 4910 <entry>720x480, 704x480, 352x480, 352x240</entry> |
| 3849 <entry>MPEG-2</entry> | 4911 <entry>MPEG-2</entry> |
| 3850 <entry>9800 kbps</entry> | 4912 <entry>9800 kbps</entry> |
| 3851 <entry>48000 Hz</entry> | 4913 <entry>48000 Hz</entry> |
| 3852 <entry>AC3,PCM</entry> | 4914 <entry>AC-3,PCM</entry> |
| 3853 <entry>1536 kbps (max)</entry> | 4915 <entry>1536 kbps (max)</entry> |
| 3854 <entry>30000/1001, 24000/1001</entry> | 4916 <entry>30000/1001, 24000/1001</entry> |
| 3855 <entry>4:3, 16:9 (only for 720x480)</entry> | 4917 <entry>4:3, 16:9 (only for 720x480)</entry> |
| 3856 </row> | 4918 </row> |
| 3857 <row> | 4919 <row> |
| 3858 <entry>NTSC DVD</entry> | 4920 <entry>NTSC DVD</entry> |
| 3859 <entry>352x240<footnote id='fn-rare-resolutions'><para> | 4921 <entry>352x240<footnote id='fn-rare-resolutions'><para> |
| 3860 These resolutions are rarely used for DVDs because | 4922 These resolutions are rarely used for DVDs because |
| 3861 they are fairly low quality.</para></footnote></entry> | 4923 they are fairly low quality.</para></footnote></entry> |
| 3862 <entry>MPEG-1</entry> | 4924 <entry>MPEG-1</entry> |
| 3863 <entry>1856 kbps</entry> | 4925 <entry>1856 kbps</entry> |
| 3864 <entry>48000 Hz</entry> | 4926 <entry>48000 Hz</entry> |
| 3865 <entry>AC3,PCM</entry> | 4927 <entry>AC-3,PCM</entry> |
| 3866 <entry>1536 kbps (max)</entry> | 4928 <entry>1536 kbps (max)</entry> |
| 3867 <entry>30000/1001, 24000/1001</entry> | 4929 <entry>30000/1001, 24000/1001</entry> |
| 3868 <entry>4:3, 16:9</entry> | 4930 <entry>4:3, 16:9</entry> |
| 3869 </row> | 4931 </row> |
| 3870 <row> | 4932 <row> |
| 3871 <entry>NTSC SVCD</entry> | 4933 <entry>NTSC SVCD</entry> |
| 3872 <entry>480x480</entry> | 4934 <entry>480x480</entry> |
| 3873 <entry>MPEG-2</entry> | 4935 <entry>MPEG-2</entry> |
| 3874 <entry>2600 kbps</entry> | 4936 <entry>2600 kbps</entry> |
| 3875 <entry>44100 Hz</entry> | 4937 <entry>44100 Hz</entry> |
| 3876 <entry>MP2</entry> | 4938 <entry>MP2</entry> |
| 3877 <entry>384 kbps (max)</entry> | 4939 <entry>384 kbps (max)</entry> |
| 3878 <entry>30000/1001</entry> | 4940 <entry>30000/1001</entry> |
| 3879 <entry>4:3</entry> | 4941 <entry>4:3</entry> |
| 3880 </row> | 4942 </row> |
| 3881 <row> | 4943 <row> |
| 3882 <entry>NTSC VCD</entry> | 4944 <entry>NTSC VCD</entry> |
| 3883 <entry>352x240</entry> | 4945 <entry>352x240</entry> |
| 3884 <entry>MPEG-1</entry> | 4946 <entry>MPEG-1</entry> |
| 3885 <entry>1150 kbps</entry> | 4947 <entry>1150 kbps</entry> |
| 3886 <entry>44100 Hz</entry> | 4948 <entry>44100 Hz</entry> |
| 3887 <entry>MP2</entry> | 4949 <entry>MP2</entry> |
| 3888 <entry>224 kbps</entry> | 4950 <entry>224 kbps</entry> |
| 3889 <entry>24000/1001, 30000/1001</entry> | 4951 <entry>24000/1001, 30000/1001</entry> |
| 3890 <entry>4:3</entry> | 4952 <entry>4:3</entry> |
| 3891 </row> | 4953 </row> |
| 3892 <row> | 4954 <row> |
| 3893 <entry>PAL DVD</entry> | 4955 <entry>PAL DVD</entry> |
| 3894 <entry>720x576, 704x576, 352x576, 352x288</entry> | 4956 <entry>720x576, 704x576, 352x576, 352x288</entry> |
| 3895 <entry>MPEG-2</entry> | 4957 <entry>MPEG-2</entry> |
| 3896 <entry>9800 kbps</entry> | 4958 <entry>9800 kbps</entry> |
| 3897 <entry>48000 Hz</entry> | 4959 <entry>48000 Hz</entry> |
| 3898 <entry>MP2,AC3,PCM</entry> | 4960 <entry>MP2,AC-3,PCM</entry> |
| 3899 <entry>1536 kbps (max)</entry> | 4961 <entry>1536 kbps (max)</entry> |
| 3900 <entry>25</entry> | 4962 <entry>25</entry> |
| 3901 <entry>4:3, 16:9 (only for 720x576)</entry> | 4963 <entry>4:3, 16:9 (only for 720x576)</entry> |
| 3902 </row> | 4964 </row> |
| 3903 <row> | 4965 <row> |
| 3904 <entry>PAL DVD</entry> | 4966 <entry>PAL DVD</entry> |
| 3905 <entry>352x288<footnoteref linkend='fn-rare-resolutions'/></entry> | 4967 <entry>352x288<footnoteref linkend='fn-rare-resolutions'/></entry> |
| 3906 <entry>MPEG-1</entry> | 4968 <entry>MPEG-1</entry> |
| 3907 <entry>1856 kbps</entry> | 4969 <entry>1856 kbps</entry> |
| 3908 <entry>48000 Hz</entry> | 4970 <entry>48000 Hz</entry> |
| 3909 <entry>MP2,AC3,PCM</entry> | 4971 <entry>MP2,AC-3,PCM</entry> |
| 3910 <entry>1536 kbps (max)</entry> | 4972 <entry>1536 kbps (max)</entry> |
| 3911 <entry>25</entry> | 4973 <entry>25</entry> |
| 3912 <entry>4:3, 16:9</entry> | 4974 <entry>4:3, 16:9</entry> |
| 3913 </row> | 4975 </row> |
| 3914 <row> | 4976 <row> |
| 3915 <entry>PAL SVCD</entry> | 4977 <entry>PAL SVCD</entry> |
| 3916 <entry>480x576</entry> | 4978 <entry>480x576</entry> |
| 3917 <entry>MPEG-2</entry> | 4979 <entry>MPEG-2</entry> |
| 3918 <entry>2600 kbps</entry> | 4980 <entry>2600 kbps</entry> |
| 3919 <entry>44100 Hz</entry> | 4981 <entry>44100 Hz</entry> |
| 3920 <entry>MP2</entry> | 4982 <entry>MP2</entry> |
| 3921 <entry>384 kbps (max)</entry> | 4983 <entry>384 kbps (max)</entry> |
| 3922 <entry>25</entry> | 4984 <entry>25</entry> |
| 3923 <entry>4:3</entry> | 4985 <entry>4:3</entry> |
| 3924 </row> | 4986 </row> |
| 3925 <row> | 4987 <row> |
| 3926 <entry>PAL VCD</entry> | 4988 <entry>PAL VCD</entry> |
| 3927 <entry>352x288</entry> | 4989 <entry>352x288</entry> |
| 3928 <entry>MPEG-1</entry> | 4990 <entry>MPEG-1</entry> |
| 3929 <entry>1152 kbps</entry> | 4991 <entry>1152 kbps</entry> |
| 3930 <entry>44100 Hz</entry> | 4992 <entry>44100 Hz</entry> |
| 3931 <entry>MP2</entry> | 4993 <entry>MP2</entry> |
| 3932 <entry>224 kbps</entry> | 4994 <entry>224 kbps</entry> |
| 3933 <entry>25</entry> | 4995 <entry>25</entry> |
| 3934 <entry>4:3</entry> | 4996 <entry>4:3</entry> |
| 3935 </row> | 4997 </row> |
| 3936 </tbody> | 4998 </tbody> |
| 3937 </tgroup> | 4999 </tgroup> |
| 3938 </informaltable> | 5000 </informaltable> |
| 3939 | 5001 |
| 3940 <para> | 5002 <para> |
| 3941 If your movie has 2.35:1 aspect (most recent action movies), you will | 5003 If your movie has 2.35:1 aspect (most recent action movies), you will |
| 3942 have to add black borders or crop the movie down to 16:9 to make a DVD | 5004 have to add black borders or crop the movie down to 16:9 to make a DVD or VCD. |
| 3943 or VCD. | 5005 If you add black borders, try to align them at 16-pixel boundaries in |
| 3944 If you add black borders, try to align them at 16-pixel boundaries in | 5006 order to minimize the impact on encoding performance. |
| 3945 order to minimize the impact on encoding performance. | 5007 Thankfully DVD has sufficiently excessive bitrate that you do not have |
| 3946 Thankfully DVD has sufficiently excessive bitrate that you do not have | 5008 to worry too much about encoding efficiency, but SVCD and VCD are |
| 3947 to worry too much about encoding efficiency, but SVCD and VCD are | 5009 highly bitrate-starved and require effort to obtain acceptable quality. |
| 3948 highly bitrate-starved and require effort to obtain acceptable quality. | |
| 3949 </para> | 5010 </para> |
| 3950 </sect3> | 5011 </sect3> |
| 5012 | |
| 3951 | 5013 |
| 3952 <sect3 id="menc-feat-vcd-dvd-constraints-gop"> | 5014 <sect3 id="menc-feat-vcd-dvd-constraints-gop"> |
| 3953 <title>GOP Size Constraints</title> | 5015 <title>GOP Size Constraints</title> |
| 3954 <para> | 5016 |
| 3955 DVD, VCD, and SVCD also constrain you to relatively low | 5017 <para> |
| 3956 GOP (Group of Pictures) sizes. | 5018 DVD, VCD, and SVCD also constrain you to relatively low |
| 3957 For 30 fps material the largest allowed GOP size is 18. | 5019 GOP (Group of Pictures) sizes. |
| 3958 For 25 or 24 fps, the maximum is 15. | 5020 For 30 fps material the largest allowed GOP size is 18. |
| 3959 The GOP size is set using the <option>keyint</option> option. | 5021 For 25 or 24 fps, the maximum is 15. |
| 5022 The GOP size is set using the <option>keyint</option> option. | |
| 3960 </para> | 5023 </para> |
| 3961 </sect3> | 5024 </sect3> |
| 5025 | |
| 3962 | 5026 |
| 3963 <sect3 id="menc-feat-vcd-dvd-constraints-bitrate"> | 5027 <sect3 id="menc-feat-vcd-dvd-constraints-bitrate"> |
| 3964 <title>Bitrate Constraints</title> | 5028 <title>Bitrate Constraints</title> |
| 3965 <para> | 5029 |
| 3966 VCD video is required to be CBR at 1152 kbps. | 5030 <para> |
| 3967 This highly limiting constraint also comes along with an extremly low vbv | 5031 VCD video is required to be CBR at 1152 kbps. |
| 3968 buffer size of 327 kilobits. | 5032 This highly limiting constraint also comes along with an extremely low vbv |
| 3969 SVCD allows varying video bitrates up to 2500 kbps, and a somewhat less | 5033 buffer size of 327 kilobits. |
| 3970 restrictive vbv buffer size of 917 kilobits is allowed. | 5034 SVCD allows varying video bitrates up to 2500 kbps, and a somewhat less |
| 3971 DVD video bitrates may range anywhere up to 9800 kbps (though typical | 5035 restrictive vbv buffer size of 917 kilobits is allowed. |
| 3972 bitrates are about half that), and the vbv buffer size is 1835 kilobits. | 5036 DVD video bitrates may range anywhere up to 9800 kbps (though typical |
| 5037 bitrates are about half that), and the vbv buffer size is 1835 kilobits. | |
| 3973 </para> | 5038 </para> |
| 3974 </sect3> | 5039 </sect3> |
| 3975 </sect2> | 5040 </sect2> |
| 3976 | 5041 |
| 5042 <!-- ********** --> | |
| 5043 | |
| 3977 <sect2 id="menc-feat-vcd-dvd-output"> | 5044 <sect2 id="menc-feat-vcd-dvd-output"> |
| 3978 <title>Output Options</title> | 5045 <title>Output Options</title> |
| 3979 <para> | 5046 |
| 3980 <application>MEncoder</application> has options to control the output | 5047 <para> |
| 3981 format. | 5048 <application>MEncoder</application> has options to control the output |
| 3982 Using these options we can instruct it to create the correct type of | 5049 format. |
| 3983 file. | 5050 Using these options we can instruct it to create the correct type of |
| 3984 </para> | 5051 file. |
| 3985 | 5052 </para> |
| 3986 <para> | 5053 |
| 3987 The options for VCD and SVCD are called xvcd and xsvcd, because they | 5054 <para> |
| 3988 are extended formats. | 5055 The options for VCD and SVCD are called xvcd and xsvcd, because they |
| 3989 They are not strictly compliant, mainly because the output does not | 5056 are extended formats. |
| 3990 contain scan offsets. | 5057 They are not strictly compliant, mainly because the output does not |
| 3991 If you need to generate an SVCD image, you should pass the output file | 5058 contain scan offsets. |
| 3992 to | 5059 If you need to generate an SVCD image, you should pass the output file to |
| 3993 <ulink url="http://www.gnu.org/software/vcdimager/vcdimager.html">vcdimager</ulink>. | 5060 <ulink url="http://www.gnu.org/software/vcdimager/vcdimager.html">vcdimager</ulink>. |
| 3994 </para> | 5061 </para> |
| 3995 | 5062 |
| 3996 <para> | 5063 <para> |
| 3997 VCD: | 5064 VCD: |
| 3998 <screen> | 5065 <screen>-of mpeg -mpegopts format=xvcd</screen> |
| 3999 -of mpeg -mpegopts format=xvcd | 5066 </para> |
| 4000 </screen> | 5067 |
| 4001 </para> | 5068 <para> |
| 4002 | 5069 SVCD: |
| 4003 <para> | 5070 <screen>-of mpeg -mpegopts format=xsvcd</screen> |
| 4004 SVCD: | 5071 </para> |
| 4005 <screen> | 5072 |
| 4006 -of mpeg -mpegopts format=xsvcd | 5073 <para> |
| 4007 </screen> | 5074 DVD (with timestamps on every frame, if possible): |
| 4008 </para> | 5075 <screen>-of mpeg -mpegopts format=dvd:tsaf</screen> |
| 4009 | 5076 </para> |
| 4010 <para> | 5077 |
| 4011 DVD: | 5078 <para> |
| 4012 <screen> | 5079 DVD with NTSC Pullup: |
| 4013 -of mpeg -mpegopts format=dvd | 5080 <screen>-of mpeg -mpegopts format=dvd:tsaf:telecine -ofps 24000/1001</screen> |
| 4014 </screen> | 5081 This allows 24000/1001 fps progressive content to be encoded at 30000/1001 |
| 4015 </para> | 5082 fps whilst maintaining DVD-compliance. |
| 4016 | 5083 </para> |
| 4017 <para> | 5084 |
| 4018 DVD with NTSC Pullup: | |
| 4019 <screen> | |
| 4020 -of mpeg -mpegopts format=dvd:telecine -ofps 24000/1001 | |
| 4021 </screen> | |
| 4022 This allows 24000/1001 fps progressive content to be encoded at 30000/1001 | |
| 4023 fps whilst maintaing DVD-compliance. | |
| 4024 </para> | |
| 4025 | 5085 |
| 4026 <sect3 id="menc-feat-vcd-dvd-output-aspect"> | 5086 <sect3 id="menc-feat-vcd-dvd-output-aspect"> |
| 4027 <title>Aspect Ratio</title> | 5087 <title>Aspect Ratio</title> |
| 4028 <para> | 5088 |
| 4029 The aspect argument of <option>-lavcopts</option> is used to encode | 5089 <para> |
| 4030 the aspect ratio of the file. | 5090 The aspect argument of <option>-lavcopts</option> is used to encode |
| 4031 During playback the aspect ratio is used to restore the video to the | 5091 the aspect ratio of the file. |
| 4032 correct size. | 5092 During playback the aspect ratio is used to restore the video to the |
| 4033 </para> | 5093 correct size. |
| 4034 | 5094 </para> |
| 4035 <para> | 5095 |
| 4036 16:9 or "Widescreen" | 5096 <para> |
| 4037 <screen> | 5097 16:9 or "Widescreen" |
| 4038 -lavcopts aspect=16/9 | 5098 <screen>-lavcopts aspect=16/9</screen> |
| 4039 </screen> | 5099 </para> |
| 4040 </para> | 5100 |
| 4041 | 5101 <para> |
| 4042 <para> | 5102 4:3 or "Fullscreen" |
| 4043 4:3 or "Fullscreen" | 5103 <screen>-lavcopts aspect=4/3</screen> |
| 4044 <screen> | 5104 </para> |
| 4045 -lavcopts aspect=4/3 | 5105 |
| 4046 </screen> | 5106 <para> |
| 4047 </para> | 5107 2.35:1 or "Cinemascope" NTSC |
| 4048 | 5108 <screen>-vf scale=720:368,expand=720:480 -lavcopts aspect=16/9</screen> |
| 4049 <para> | 5109 To calculate the correct scaling size, use the expanded NTSC width of |
| 4050 2.35:1 or "Cinemascope" NTSC | 5110 854/2.35 = 368 |
| 4051 <screen> | 5111 </para> |
| 4052 -vf scale=720:368,expand=720:480 -lavcopts aspect=16/9 | 5112 |
| 4053 </screen> | 5113 <para> |
| 4054 To calculate the correct scaling size, use the expanded NTSC width of | 5114 2.35:1 or "Cinemascope" PAL |
| 4055 854/2.35 = 368 | 5115 <screen>-vf scale=720:432,expand=720:576 -lavcopts aspect=16/9</screen> |
| 4056 </para> | 5116 To calculate the correct scaling size, use the expanded PAL width of |
| 4057 | 5117 1024/2.35 = 432 |
| 4058 <para> | 5118 </para> |
| 4059 2.35:1 or "Cinemascope" PAL | |
| 4060 <screen> | |
| 4061 -vf scale="720:432,expand=720:576 -lavcopts aspect=16/9 | |
| 4062 </screen> | |
| 4063 To calculate the correct scaling size, use the expanded PAL width of | |
| 4064 1024/2.35 = 432 | |
| 4065 </para> | |
| 4066 | |
| 4067 </sect3> | 5119 </sect3> |
| 5120 | |
| 5121 | |
| 5122 <sect3 id="menc-feat-vcd-dvd-a-v-sync"> | |
| 5123 <title>Maintaining A/V sync</title> | |
| 5124 | |
| 5125 <para> | |
| 5126 In order to maintain audio/video synchronization throughout the encode, | |
| 5127 <application>MEncoder</application> has to drop or duplicate frames. | |
| 5128 This works rather well when muxing into an AVI file, but is almost | |
| 5129 guaranteed to fail to maintain A/V sync with other muxers such as MPEG. | |
| 5130 This is why it is necessary to append the | |
| 5131 <option>harddup</option> video filter at the end of the filter chain | |
| 5132 to avoid this kind of problem. | |
| 5133 You can find more technical information about <option>harddup</option> | |
| 5134 in the section | |
| 5135 <link linkend="menc-feat-dvd-mpeg4-muxing-filter-issues">Improving muxing and A/V sync reliability</link> | |
| 5136 or in the manual page. | |
| 5137 </para> | |
| 5138 </sect3> | |
| 5139 | |
| 4068 | 5140 |
| 4069 <sect3 id="menc-feat-vcd-dvd-output-srate"> | 5141 <sect3 id="menc-feat-vcd-dvd-output-srate"> |
| 4070 <title>Sample Rate Conversion</title> | 5142 <title>Sample Rate Conversion</title> |
| 4071 <para> | 5143 |
| 4072 If the audio sample rate in the original file is not the same as | 5144 <para> |
| 4073 required by the target format, sample rate conversion is required. | 5145 If the audio sample rate in the original file is not the same as |
| 4074 This is achieved using the <option>-srate</option> option and | 5146 required by the target format, sample rate conversion is required. |
| 4075 the <option>-af lavcresample</option> audio filter together. | 5147 This is achieved using the <option>-srate</option> option and |
| 4076 </para> | 5148 the <option>-af lavcresample</option> audio filter together. |
| 4077 <para> | 5149 </para> |
| 4078 DVD: | 5150 |
| 4079 <screen> | 5151 <para> |
| 4080 -srate 48000 -af lavcresample=48000 | 5152 DVD: |
| 4081 </screen> | 5153 <screen>-srate 48000 -af lavcresample=48000</screen> |
| 4082 </para> | 5154 </para> |
| 4083 <para> | 5155 |
| 4084 VCD and SVCD: | 5156 <para> |
| 4085 <screen> | 5157 VCD and SVCD: |
| 4086 -srate 44100 -af lavcresample=44100 | 5158 <screen>-srate 44100 -af lavcresample=44100</screen> |
| 4087 </screen> | 5159 </para> |
| 4088 </para> | |
| 4089 </sect3> | 5160 </sect3> |
| 4090 </sect2> | 5161 </sect2> |
| 4091 | 5162 |
| 5163 <!-- ********** --> | |
| 5164 | |
| 4092 <sect2 id="menc-feat-vcd-dvd-lavc"> | 5165 <sect2 id="menc-feat-vcd-dvd-lavc"> |
| 4093 <title>Using libavcodec for VCD/SVCD/DVD Encoding</title> | 5166 <title>Using libavcodec for VCD/SVCD/DVD Encoding</title> |
| 4094 | 5167 |
| 4095 <sect3 id="menc-feat-vcd-dvd-lavc-intro"> | 5168 <sect3 id="menc-feat-vcd-dvd-lavc-intro"> |
| 4096 <title>Introduction</title> | 5169 <title>Introduction</title> |
| 4097 <para> | 5170 |
| 4098 <systemitem class="library">libavcodec</systemitem> can be used to | 5171 <para> |
| 4099 create VCD/SVCD/DVD compliant video by using the appropriate options. | 5172 <systemitem class="library">libavcodec</systemitem> can be used to |
| 5173 create VCD/SVCD/DVD compliant video by using the appropriate options. | |
| 4100 </para> | 5174 </para> |
| 4101 </sect3> | 5175 </sect3> |
| 5176 | |
| 4102 | 5177 |
| 4103 <sect3 id="menc-feat-vcd-dvd-lavc-options"> | 5178 <sect3 id="menc-feat-vcd-dvd-lavc-options"> |
| 4104 <title>lavcopts</title> | 5179 <title>lavcopts</title> |
| 4105 <para> | 5180 |
| 4106 This is a list of fields in <option>-lavcopts</option> that you may | 5181 <para> |
| 4107 be required to change in order to make a complaint movie for VCD, SVCD, | 5182 This is a list of fields in <option>-lavcopts</option> that you may |
| 4108 or DVD: | 5183 be required to change in order to make a complaint movie for VCD, SVCD, |
| 5184 or DVD: | |
| 4109 </para> | 5185 </para> |
| 4110 | 5186 |
| 4111 <itemizedlist> | 5187 <itemizedlist> |
| 4112 <listitem><para> | 5188 <listitem><para> |
| 4113 <emphasis role="bold">acodec</emphasis>: | 5189 <emphasis role="bold">acodec</emphasis>: |
| 4116 PCM audio may also be used for DVD, but this is mostly a big waste of | 5192 PCM audio may also be used for DVD, but this is mostly a big waste of |
| 4117 space. | 5193 space. |
| 4118 Note that MP3 audio is not compliant for any of these formats, but | 5194 Note that MP3 audio is not compliant for any of these formats, but |
| 4119 players often have no problem playing it anyway. | 5195 players often have no problem playing it anyway. |
| 4120 </para></listitem> | 5196 </para></listitem> |
| 4121 | |
| 4122 <listitem><para> | 5197 <listitem><para> |
| 4123 <emphasis role="bold">abitrate</emphasis>: | 5198 <emphasis role="bold">abitrate</emphasis>: |
| 4124 224 for VCD; up to 384 for SVCD; up to 1536 for DVD, but commonly | 5199 224 for VCD; up to 384 for SVCD; up to 1536 for DVD, but commonly |
| 4125 used values range from 192 kbps for stereo to 384 kbps for 5.1 channel | 5200 used values range from 192 kbps for stereo to 384 kbps for 5.1 channel |
| 4126 sound. | 5201 sound. |
| 4127 </para></listitem> | 5202 </para></listitem> |
| 4128 | |
| 4129 <listitem><para> | 5203 <listitem><para> |
| 4130 <emphasis role="bold">vcodec</emphasis>: | 5204 <emphasis role="bold">vcodec</emphasis>: |
| 4131 <option>mpeg1video</option> for VCD; | 5205 <option>mpeg1video</option> for VCD; |
| 4132 <option>mpeg2video</option> for SVCD; | 5206 <option>mpeg2video</option> for SVCD; |
| 4133 <option>mpeg2video</option> is usually used for DVD but you may also use | 5207 <option>mpeg2video</option> is usually used for DVD but you may also use |
| 4134 <option>mpeg1video</option> for CIF resolutions. | 5208 <option>mpeg1video</option> for CIF resolutions. |
| 4135 </para></listitem> | 5209 </para></listitem> |
| 4136 | |
| 4137 <listitem><para> | 5210 <listitem><para> |
| 4138 <emphasis role="bold">keyint</emphasis>: | 5211 <emphasis role="bold">keyint</emphasis>: |
| 4139 Used to set the GOP size. | 5212 Used to set the GOP size. |
| 4140 18 for 30fps material, or 15 for 25/24 fps material. | 5213 18 for 30fps material, or 15 for 25/24 fps material. |
| 4141 Commercial producers seem to prefer keyframe intervals of 12. | 5214 Commercial producers seem to prefer keyframe intervals of 12. |
| 4142 It is possible to make this much larger and still retain compatibility | 5215 It is possible to make this much larger and still retain compatibility |
| 4143 with most players. | 5216 with most players. |
| 4144 A <option>keyint</option> of 25 should never cause any problems. | 5217 A <option>keyint</option> of 25 should never cause any problems. |
| 4145 </para></listitem> | 5218 </para></listitem> |
| 4146 | |
| 4147 <listitem><para> | 5219 <listitem><para> |
| 4148 <emphasis role="bold">vrc_buf_size</emphasis>: | 5220 <emphasis role="bold">vrc_buf_size</emphasis>: |
| 4149 327 for VCD, 917 for SVCD, and 1835 for DVD. | 5221 327 for VCD, 917 for SVCD, and 1835 for DVD. |
| 4150 </para></listitem> | 5222 </para></listitem> |
| 4151 | |
| 4152 <listitem><para> | 5223 <listitem><para> |
| 4153 <emphasis role="bold">vrc_minrate</emphasis>: | 5224 <emphasis role="bold">vrc_minrate</emphasis>: |
| 4154 1152, for VCD. May be left alone for SVCD and DVD. | 5225 1152, for VCD. May be left alone for SVCD and DVD. |
| 4155 </para></listitem> | 5226 </para></listitem> |
| 4156 | |
| 4157 <listitem><para> | 5227 <listitem><para> |
| 4158 <emphasis role="bold">vrc_maxrate</emphasis>: | 5228 <emphasis role="bold">vrc_maxrate</emphasis>: |
| 4159 1152 for VCD; 2500 for SVCD; 9800 for DVD. | 5229 1152 for VCD; 2500 for SVCD; 9800 for DVD. |
| 4160 For SVCD and DVD, you might wish to use lower values depending on your | 5230 For SVCD and DVD, you might wish to use lower values depending on your |
| 4161 own personal preferences and requirements. | 5231 own personal preferences and requirements. |
| 4162 </para></listitem> | 5232 </para></listitem> |
| 4163 | |
| 4164 <listitem><para> | 5233 <listitem><para> |
| 4165 <emphasis role="bold">vbitrate</emphasis>: | 5234 <emphasis role="bold">vbitrate</emphasis>: |
| 4166 1152 for VCD; | 5235 1152 for VCD; |
| 4167 up to 2500 for SVCD; | 5236 up to 2500 for SVCD; |
| 4168 up to 9800 for DVD. | 5237 up to 9800 for DVD. |
| 4173 The resulting video quality would probably be quite bad. | 5242 The resulting video quality would probably be quite bad. |
| 4174 If you are trying to squeeze out the maximum possible quality on a DVD, | 5243 If you are trying to squeeze out the maximum possible quality on a DVD, |
| 4175 use vbitrate=9800, but be warned that this could constrain you to less | 5244 use vbitrate=9800, but be warned that this could constrain you to less |
| 4176 than an hour of video on a single-layer DVD. | 5245 than an hour of video on a single-layer DVD. |
| 4177 </para></listitem> | 5246 </para></listitem> |
| 5247 <listitem><para> | |
| 5248 <emphasis role="bold">vstrict</emphasis>: | |
| 5249 <option>vstrict</option>=0 should be used to create DVDs. | |
| 5250 Without this option, <application>MEncoder</application> creates a | |
| 5251 stream that cannot be correctly decoded by some standalone DVD | |
| 5252 players. | |
| 5253 </para></listitem> | |
| 4178 </itemizedlist> | 5254 </itemizedlist> |
| 4179 </sect3> | 5255 </sect3> |
| 4180 | 5256 |
| 5257 | |
| 4181 <sect3 id="menc-feat-vcd-dvd-lavc-examples"> | 5258 <sect3 id="menc-feat-vcd-dvd-lavc-examples"> |
| 4182 <title>Examples</title> | 5259 <title>Examples</title> |
| 4183 <para> | 5260 |
| 4184 This is a typical minimum set of <option>-lavcopts</option> for | 5261 <para> |
| 4185 encoding video: | 5262 This is a typical minimum set of <option>-lavcopts</option> for |
| 4186 </para> | 5263 encoding video: |
| 4187 <para> | 5264 </para> |
| 4188 VCD: | 5265 <para> |
| 4189 <screen> | 5266 VCD: |
| 4190 -lavcopts vcodec=mpeg1video:vrc_buf_size=327:vrc_minrate=1152:\ | 5267 <screen> |
| 4191 vrc_maxrate=1152:vbitrate=1152:keyint=15:acodec=mp2 | 5268 -lavcopts vcodec=mpeg1video:vrc_buf_size=327:vrc_minrate=1152:\ |
| 4192 </screen> | 5269 vrc_maxrate=1152:vbitrate=1152:keyint=15:acodec=mp2 |
| 4193 </para> | 5270 </screen> |
| 4194 | 5271 </para> |
| 4195 <para> | 5272 |
| 4196 SVCD: | 5273 <para> |
| 4197 <screen> | 5274 SVCD: |
| 4198 -lavcopts vcodec=mpeg2video:vrc_buf_size=917:vrc_maxrate=2500:vbitrate=1800:\ | 5275 <screen> |
| 4199 keyint=15:acodec=mp2 | 5276 -lavcopts vcodec=mpeg2video:vrc_buf_size=917:vrc_maxrate=2500:vbitrate=1800:\ |
| 4200 </screen> | 5277 keyint=15:acodec=mp2 |
| 4201 </para> | 5278 </screen> |
| 4202 | 5279 </para> |
| 4203 <para> | 5280 |
| 4204 DVD: | 5281 <para> |
| 4205 <screen> | 5282 DVD: |
| 4206 -lavcopts vcodec=mpeg2video:vrc_buf_size=1835:vrc_maxrate=9800:vbitrate=5000:\ | 5283 <screen> |
| 4207 keyint=15:acodec=ac3 | 5284 -lavcopts vcodec=mpeg2video:vrc_buf_size=1835:vrc_maxrate=9800:vbitrate=5000:\ |
| 4208 </screen> | 5285 keyint=15:vstrict=0:acodec=ac3 |
| 4209 </para> | 5286 </screen> |
| 4210 | 5287 </para> |
| 4211 </sect3> | 5288 </sect3> |
| 5289 | |
| 4212 | 5290 |
| 4213 <sect3 id="menc-feat-vcd-dvd-lavc-advanced"> | 5291 <sect3 id="menc-feat-vcd-dvd-lavc-advanced"> |
| 4214 <title>Advanced Options</title> | 5292 <title>Advanced Options</title> |
| 4215 <para> | 5293 |
| 4216 For higher quality encoding, you may also wish to add quality-enhancing | 5294 <para> |
| 4217 options to lavcopts, such as <option>trell</option>, | 5295 For higher quality encoding, you may also wish to add quality-enhancing |
| 4218 <option>mbd=2</option>, and others. | 5296 options to lavcopts, such as <option>trell</option>, |
| 4219 Note that <option>qpel</option> and <option>v4mv</option>, while often | 5297 <option>mbd=2</option>, and others. |
| 4220 useful with MPEG-4, are not usable with MPEG-1 or MPEG-2. | 5298 Note that <option>qpel</option> and <option>v4mv</option>, while often |
| 4221 Also, if you are trying to make a very high quality DVD encode, it may | 5299 useful with MPEG-4, are not usable with MPEG-1 or MPEG-2. |
| 4222 be useful to add <option>dc=10</option> to lavcopts. | 5300 Also, if you are trying to make a very high quality DVD encode, it may |
| 4223 Doing so may help reduce the appearance of blocks in flat-colored areas. | 5301 be useful to add <option>dc=10</option> to lavcopts. |
| 4224 Putting it all together, this is an example of a set of lavcopts for a | 5302 Doing so may help reduce the appearance of blocks in flat-colored areas. |
| 4225 higher quality DVD: | 5303 Putting it all together, this is an example of a set of lavcopts for a |
| 4226 </para> | 5304 higher quality DVD: |
| 4227 | 5305 </para> |
| 4228 <para> | 5306 |
| 4229 <screen> | 5307 <para> |
| 4230 -lavcopts vcodec=mpeg2video:vrc_buf_size=1835:vrc_maxrate=9800:vbitrate=8000:\ | 5308 <screen> |
| 4231 keyint=15:trell:mbd=2:precmp=2:subcmp=2:cmp=2:dia=-10:predia=-10:cbp:mv0:\ | 5309 -lavcopts vcodec=mpeg2video:vrc_buf_size=1835:vrc_maxrate=9800:vbitrate=8000:\ |
| 4232 vqmin=1:lmin=1:dc=10 | 5310 keyint=15:trell:mbd=2:precmp=2:subcmp=2:cmp=2:dia=-10:predia=-10:cbp:mv0:\ |
| 4233 </screen> | 5311 vqmin=1:lmin=1:dc=10:vstrict=0 |
| 4234 </para> | 5312 </screen> |
| 4235 | 5313 </para> |
| 4236 </sect3> | 5314 </sect3> |
| 4237 </sect2> | 5315 </sect2> |
| 4238 | 5316 |
| 5317 <!-- ********** --> | |
| 5318 | |
| 4239 <sect2 id="menc-feat-vcd-dvd-audio"> | 5319 <sect2 id="menc-feat-vcd-dvd-audio"> |
| 4240 <title>Encoding Audio</title> | 5320 <title>Encoding Audio</title> |
| 4241 <para> | 5321 |
| 4242 VCD and SVCD support MPEG-1 layer II audio, using one of | 5322 <para> |
| 4243 <systemitem class="library">toolame</systemitem>, | 5323 VCD and SVCD support MPEG-1 layer II audio, using one of |
| 4244 <systemitem class="library">twolame</systemitem>, | 5324 <systemitem class="library">toolame</systemitem>, |
| 4245 or <systemitem class="library">libavcodec</systemitem>'s MP2 encoder. | 5325 <systemitem class="library">twolame</systemitem>, |
| 4246 The libavcodec MP2 is far from being as good as the other two libraries, | 5326 or <systemitem class="library">libavcodec</systemitem>'s MP2 encoder. |
| 4247 however it should always be available to use. | 5327 The libavcodec MP2 is far from being as good as the other two libraries, |
| 4248 VCD only supports constant bitrate audio (CBR) whereas SVCD supports | 5328 however it should always be available to use. |
| 4249 variable bitrate (VBR), too. | 5329 VCD only supports constant bitrate audio (CBR) whereas SVCD supports |
| 4250 Be careful when using VBR because some bad standalone players might not | 5330 variable bitrate (VBR), too. |
| 4251 support it too well. | 5331 Be careful when using VBR because some bad standalone players might not |
| 4252 </para> | 5332 support it too well. |
| 4253 | 5333 </para> |
| 4254 <para> | 5334 |
| 4255 For DVD audio, <systemitem class="library">libavcodec</systemitem>'s | 5335 <para> |
| 4256 AC3 codec is used. | 5336 For DVD audio, <systemitem class="library">libavcodec</systemitem>'s |
| 4257 </para> | 5337 AC-3 codec is used. |
| 5338 </para> | |
| 5339 | |
| 4258 | 5340 |
| 4259 <sect3 id="menc-feat-vcd-dvd-audio-toolame"> | 5341 <sect3 id="menc-feat-vcd-dvd-audio-toolame"> |
| 4260 <title>toolame</title> | 5342 <title>toolame</title> |
| 4261 <para> | 5343 |
| 4262 For VCD and SVCD: | 5344 <para> |
| 4263 <screen> | 5345 For VCD and SVCD: |
| 4264 -oac toolame -toolameopts br=224 | 5346 <screen>-oac toolame -toolameopts br=224</screen> |
| 4265 </screen> | |
| 4266 </para> | 5347 </para> |
| 4267 </sect3> | 5348 </sect3> |
| 5349 | |
| 4268 | 5350 |
| 4269 <sect3 id="menc-feat-vcd-dvd-audio-twolame"> | 5351 <sect3 id="menc-feat-vcd-dvd-audio-twolame"> |
| 4270 <title>twolame</title> | 5352 <title>twolame</title> |
| 4271 <para> | 5353 |
| 4272 For VCD and SVCD: | 5354 <para> |
| 4273 <screen> | 5355 For VCD and SVCD: |
| 4274 -oac twolame -twolameopts br=224 | 5356 <screen>-oac twolame -twolameopts br=224</screen> |
| 4275 </screen> | |
| 4276 </para> | 5357 </para> |
| 4277 </sect3> | 5358 </sect3> |
| 5359 | |
| 4278 | 5360 |
| 4279 <sect3 id="menc-feat-vcd-dvd-audio-lavc"> | 5361 <sect3 id="menc-feat-vcd-dvd-audio-lavc"> |
| 4280 <title>libavcodec</title> | 5362 <title>libavcodec</title> |
| 4281 <para> | 5363 |
| 4282 For DVD with 2 channel sound: | 5364 <para> |
| 4283 <screen> | 5365 For DVD with 2 channel sound: |
| 4284 -oac lavc -lavcopts acodec=ac3:abitrate=192 | 5366 <screen>-oac lavc -lavcopts acodec=ac3:abitrate=192</screen> |
| 4285 </screen> | 5367 </para> |
| 4286 </para> | 5368 |
| 4287 <para> | 5369 <para> |
| 4288 For DVD with 5.1 channel sound: | 5370 For DVD with 5.1 channel sound: |
| 4289 <screen> | 5371 <screen>-channels 6 -oac lavc -lavcopts acodec=ac3:abitrate=384</screen> |
| 4290 -channels 6 -oac lavc -lavcopts acodec=ac3:abitrate=384 | 5372 </para> |
| 4291 </screen> | 5373 |
| 4292 </para> | 5374 <para> |
| 4293 <para> | 5375 For VCD and SVCD: |
| 4294 For VCD and SVCD: | 5376 <screen>-oac lavc -lavcopts acodec=mp2:abitrate=224</screen> |
| 4295 <screen> | |
| 4296 -oac lavc -lavcopts acodec=mp2:abitrate=224 | |
| 4297 </screen> | |
| 4298 </para> | 5377 </para> |
| 4299 </sect3> | 5378 </sect3> |
| 4300 | |
| 4301 </sect2> | 5379 </sect2> |
| 5380 | |
| 5381 <!-- ********** --> | |
| 4302 | 5382 |
| 4303 <sect2 id="menc-feat-vcd-dvd-all"> | 5383 <sect2 id="menc-feat-vcd-dvd-all"> |
| 4304 <title>Putting it all Together</title> | 5384 <title>Putting it all Together</title> |
| 4305 <para> | 5385 |
| 4306 This section shows some complete commands for creating VCD/SVCD/DVD | 5386 <para> |
| 4307 compliant videos. | 5387 This section shows some complete commands for creating VCD/SVCD/DVD |
| 4308 </para> | 5388 compliant videos. |
| 5389 </para> | |
| 5390 | |
| 4309 | 5391 |
| 4310 <sect3 id="menc-feat-vcd-dvd-all-pal-dvd"> | 5392 <sect3 id="menc-feat-vcd-dvd-all-pal-dvd"> |
| 4311 <title>PAL DVD</title> | 5393 <title>PAL DVD</title> |
| 4312 <para> | 5394 |
| 4313 <screen> | 5395 <para> |
| 4314 mencoder -oac lavc -ovc lavc -of mpeg -mpegopts format=dvd -vf scale=720:576,\ | 5396 <screen> |
| 4315 harddup -srate 48000 -af lavcresample=48000 -lavcopts vcodec=mpeg2video:\ | 5397 mencoder -oac lavc -ovc lavc -of mpeg -mpegopts format=dvd:tsaf \ |
| 4316 vrc_buf_size=1835:vrc_maxrate=9800:vbitrate=5000:keyint=15:acodec=ac3:\ | 5398 -vf scale=720:576,harddup -srate 48000 -af lavcresample=48000 \ |
| 4317 abitrate=192:aspect=16/9 -ofps 25 \ | 5399 -lavcopts vcodec=mpeg2video:vrc_buf_size=1835:vrc_maxrate=9800:vbitrate=5000:\ |
| 5400 keyint=15:vstrict=0:acodec=ac3:abitrate=192:aspect=16/9 -ofps 25 \ | |
| 4318 -o <replaceable>movie.mpg</replaceable> <replaceable>movie.avi</replaceable> | 5401 -o <replaceable>movie.mpg</replaceable> <replaceable>movie.avi</replaceable> |
| 4319 </screen> | 5402 </screen> |
| 4320 </para> | 5403 </para> |
| 4321 </sect3> | 5404 </sect3> |
| 5405 | |
| 4322 | 5406 |
| 4323 <sect3 id="menc-feat-vcd-dvd-all-ntsc-dvd"> | 5407 <sect3 id="menc-feat-vcd-dvd-all-ntsc-dvd"> |
| 4324 <title>NTSC DVD</title> | 5408 <title>NTSC DVD</title> |
| 4325 <para> | 5409 |
| 4326 <screen> | 5410 <para> |
| 4327 mencoder -oac lavc -ovc lavc -of mpeg -mpegopts format=dvd -vf scale=720:480,\ | 5411 <screen> |
| 4328 harddup -srate 48000 -af lavcresample=48000 -lavcopts vcodec=mpeg2video:\ | 5412 mencoder -oac lavc -ovc lavc -of mpeg -mpegopts format=dvd:tsaf \ |
| 4329 vrc_buf_size=1835:vrc_maxrate=9800:vbitrate=5000:keyint=18:acodec=ac3:\ | 5413 -vf scale=720:480,harddup -srate 48000 -af lavcresample=48000 \ |
| 4330 abitrate=192:aspect=16/9 -ofps 30000/1001 \ | 5414 -lavcopts vcodec=mpeg2video:vrc_buf_size=1835:vrc_maxrate=9800:vbitrate=5000:\ |
| 5415 keyint=18:vstrict=0:acodec=ac3:abitrate=192:aspect=16/9 -ofps 30000/1001 \ | |
| 4331 -o <replaceable>movie.mpg</replaceable> <replaceable>movie.avi</replaceable> | 5416 -o <replaceable>movie.mpg</replaceable> <replaceable>movie.avi</replaceable> |
| 4332 </screen> | 5417 </screen> |
| 4333 </para> | 5418 </para> |
| 4334 </sect3> | 5419 </sect3> |
| 4335 | 5420 |
| 5421 | |
| 4336 <sect3 id="menc-feat-vcd-dvd-all-pal-ac3-copy"> | 5422 <sect3 id="menc-feat-vcd-dvd-all-pal-ac3-copy"> |
| 4337 <title>PAL AVI Containing AC3 Audio to DVD</title> | 5423 <title>PAL AVI Containing AC-3 Audio to DVD</title> |
| 4338 <para> | 5424 |
| 4339 If the source already has AC3 audio, use -oac copy instead of re-encoding it. | 5425 <para> |
| 4340 <screen> | 5426 If the source already has AC-3 audio, use -oac copy instead of re-encoding it. |
| 4341 mencoder -oac copy -ovc lavc -of mpeg -mpegopts format=dvd -vf scale=720:576,\ | 5427 <screen> |
| 4342 harddup -lavcopts vcodec=mpeg2video:vrc_buf_size=1835:vrc_maxrate=9800:\ | 5428 mencoder -oac copy -ovc lavc -of mpeg -mpegopts format=dvd:tsaf \ |
| 4343 vbitrate=5000:keyint=15:aspect=16/9 -ofps 25 \ | 5429 -vf scale=720:576,harddup -ofps 25 \ |
| 5430 -lavcopts vcodec=mpeg2video:vrc_buf_size=1835:vrc_maxrate=9800:vbitrate=5000:\ | |
| 5431 keyint=15:vstrict=0:aspect=16/9 -o <replaceable>movie.mpg</replaceable> <replaceable>movie.avi</replaceable> | |
| 5432 </screen> | |
| 5433 </para> | |
| 5434 </sect3> | |
| 5435 | |
| 5436 | |
| 5437 <sect3 id="menc-feat-vcd-dvd-all-ntsc-ac3-copy"> | |
| 5438 <title>NTSC AVI Containing AC-3 Audio to DVD</title> | |
| 5439 | |
| 5440 <para> | |
| 5441 If the source already has AC-3 audio, and is NTSC @ 24000/1001 fps: | |
| 5442 <screen> | |
| 5443 mencoder -oac copy -ovc lavc -of mpeg -mpegopts format=dvd:tsaf:telecine \ | |
| 5444 -vf scale=720:480,harddup -lavcopts vcodec=mpeg2video:vrc_buf_size=1835:\ | |
| 5445 vrc_maxrate=9800:vbitrate=5000:keyint=15:vstrict=0:aspect=16/9 -ofps 24000/1001 \ | |
| 4344 -o <replaceable>movie.mpg</replaceable> <replaceable>movie.avi</replaceable> | 5446 -o <replaceable>movie.mpg</replaceable> <replaceable>movie.avi</replaceable> |
| 4345 </screen> | 5447 </screen> |
| 4346 </para> | 5448 </para> |
| 4347 </sect3> | 5449 </sect3> |
| 4348 | 5450 |
| 4349 <sect3 id="menc-feat-vcd-dvd-all-ntsc-ac3-copy"> | |
| 4350 <title>NTSC AVI Containing AC3 Audio to DVD</title> | |
| 4351 <para> | |
| 4352 If the source already has AC3 audio, and is NTSC @ 24000/1001 fps: | |
| 4353 <screen> | |
| 4354 mencoder -oac copy -ovc lavc -of mpeg -mpegopts format=dvd:telecine \ | |
| 4355 -vf scale=720:480,harddup -lavcopts vcodec=mpeg2video:vrc_buf_size=1835:\ | |
| 4356 vrc_maxrate=9800:vbitrate=5000:keyint=15:aspect=16/9 -ofps 24000/1001 \ | |
| 4357 -o <replaceable>movie.mpg</replaceable> <replaceable>movie.avi</replaceable> | |
| 4358 </screen> | |
| 4359 </para> | |
| 4360 </sect3> | |
| 4361 | 5451 |
| 4362 <sect3 id="menc-feat-vcd-dvd-all-pal-svcd"> | 5452 <sect3 id="menc-feat-vcd-dvd-all-pal-svcd"> |
| 4363 <title>PAL SVCD</title> | 5453 <title>PAL SVCD</title> |
| 4364 <para> | 5454 |
| 4365 <screen> | 5455 <para> |
| 4366 mencoder -oac lavc -ovc lavc -of mpeg -mpegopts format=xsvcd -vf \ | 5456 <screen> |
| 4367 scale=480:576,harddup -srate 44100 -af lavcresample=44100 -lavcopts \ | 5457 mencoder -oac lavc -ovc lavc -of mpeg -mpegopts format=xsvcd -vf \ |
| 4368 vcodec=mpeg2video:mbd=2:keyint=15:vrc_buf_size=917:vrc_minrate=600:\ | 5458 scale=480:576,harddup -srate 44100 -af lavcresample=44100 -lavcopts \ |
| 4369 vbitrate=2500:vrc_maxrate=2500:acodec=mp2:abitrate=224 -ofps 25 \ | 5459 vcodec=mpeg2video:mbd=2:keyint=15:vrc_buf_size=917:vrc_minrate=600:\ |
| 4370 -o <replaceable>movie.mpg</replaceable> <replaceable>movie.avi</replaceable> | 5460 vbitrate=2500:vrc_maxrate=2500:acodec=mp2:abitrate=224:aspect=16/9 -ofps 25 \ |
| 5461 -o <replaceable>movie.mpg</replaceable> <replaceable>movie.avi</replaceable> | |
| 4371 </screen> | 5462 </screen> |
| 4372 </para> | 5463 </para> |
| 4373 </sect3> | 5464 </sect3> |
| 5465 | |
| 4374 | 5466 |
| 4375 <sect3 id="menc-feat-vcd-dvd-all-ntsc-svcd"> | 5467 <sect3 id="menc-feat-vcd-dvd-all-ntsc-svcd"> |
| 4376 <title>NTSC SVCD</title> | 5468 <title>NTSC SVCD</title> |
| 4377 <para> | 5469 |
| 4378 <screen> | 5470 <para> |
| 4379 mencoder -oac lavc -ovc lavc -of mpeg -mpegopts format=xsvcd -vf \ | 5471 <screen> |
| 4380 scale=480:480,harddup -srate 44100 -af lavcresample=44100 -lavcopts \ | 5472 mencoder -oac lavc -ovc lavc -of mpeg -mpegopts format=xsvcd -vf \ |
| 4381 vcodec=mpeg2video:mbd=2:keyint=18:vrc_buf_size=917:vrc_minrate=600:\ | 5473 scale=480:480,harddup -srate 44100 -af lavcresample=44100 -lavcopts \ |
| 4382 vbitrate=2500:vrc_maxrate=2500:acodec=mp2:abitrate=224 -ofps 30000/1001 \ | 5474 vcodec=mpeg2video:mbd=2:keyint=18:vrc_buf_size=917:vrc_minrate=600:\ |
| 4383 -o <replaceable>movie.mpg</replaceable> <replaceable>movie.avi</replaceable> | 5475 vbitrate=2500:vrc_maxrate=2500:acodec=mp2:abitrate=224:aspect=16/9 -ofps 30000/1001 \ |
| 4384 </screen> | 5476 -o <replaceable>movie.mpg</replaceable> <replaceable>movie.avi</replaceable> |
| 5477 </screen> | |
| 4385 </para> | 5478 </para> |
| 4386 </sect3> | 5479 </sect3> |
| 5480 | |
| 4387 | 5481 |
| 4388 <sect3 id="menc-feat-vcd-dvd-all-pal-vcd"> | 5482 <sect3 id="menc-feat-vcd-dvd-all-pal-vcd"> |
| 4389 <title>PAL VCD</title> | 5483 <title>PAL VCD</title> |
| 4390 <para> | 5484 |
| 4391 <screen> | 5485 <para> |
| 4392 mencoder -oac lavc -ovc lavc -of mpeg -mpegopts format=xvcd -vf \ | 5486 <screen> |
| 4393 scale=352:288,harddup -srate 44100 -af lavcresample=44100 -lavcopts \ | 5487 mencoder -oac lavc -ovc lavc -of mpeg -mpegopts format=xvcd -vf \ |
| 4394 vcodec=mpeg1video:keyint=15:vrc_buf_size=327:vrc_minrate=1152:vbitrate=1152:\ | 5488 scale=352:288,harddup -srate 44100 -af lavcresample=44100 -lavcopts \ |
| 4395 vrc_maxrate=1152:acodec=mp2:abitrate=224 -ofps 25 \ | 5489 vcodec=mpeg1video:keyint=15:vrc_buf_size=327:vrc_minrate=1152:\ |
| 4396 -o <replaceable>movie.mpg</replaceable> <replaceable>movie.avi</replaceable> | 5490 vbitrate=1152:vrc_maxrate=1152:acodec=mp2:abitrate=224:aspect=16/9 -ofps 25 \ |
| 4397 </screen> | 5491 -o <replaceable>movie.mpg</replaceable> <replaceable>movie.avi</replaceable> |
| 5492 </screen> | |
| 4398 </para> | 5493 </para> |
| 4399 </sect3> | 5494 </sect3> |
| 5495 | |
| 4400 | 5496 |
| 4401 <sect3 id="menc-feat-vcd-dvd-all-ntsc-vcd"> | 5497 <sect3 id="menc-feat-vcd-dvd-all-ntsc-vcd"> |
| 4402 <title>NTSC VCD</title> | 5498 <title>NTSC VCD</title> |
| 4403 <para> | 5499 |
| 4404 <screen> | 5500 <para> |
| 4405 mencoder -oac lavc -ovc lavc -of mpeg -mpegopts format=xvcd -vf \ | 5501 <screen> |
| 4406 scale=352:240,harddup -srate 44100 -af lavcresample=44100 -lavcopts \ | 5502 mencoder -oac lavc -ovc lavc -of mpeg -mpegopts format=xvcd -vf \ |
| 4407 vcodec=mpeg1video:keyint=18:vrc_buf_size=327:vrc_minrate=1152:vbitrate=1152:\ | 5503 scale=352:240,harddup -srate 44100 -af lavcresample=44100 -lavcopts \ |
| 4408 vrc_maxrate=1152:acodec=mp2:abitrate=224 -ofps 30000/1001 \ | 5504 vcodec=mpeg1video:keyint=18:vrc_buf_size=327:vrc_minrate=1152:\ |
| 4409 -o <replaceable>movie.mpg</replaceable> <replaceable>movie.avi</replaceable> | 5505 vbitrate=1152:vrc_maxrate=1152:acodec=mp2:abitrate=224:aspect=16/9 -ofps 30000/1001 \ |
| 4410 </screen> | 5506 -o <replaceable>movie.mpg</replaceable> <replaceable>movie.avi</replaceable> |
| 5507 </screen> | |
| 4411 </para> | 5508 </para> |
| 4412 </sect3> | 5509 </sect3> |
| 4413 | |
| 4414 </sect2> | 5510 </sect2> |
| 4415 | |
| 4416 </sect1> | 5511 </sect1> |
| 4417 | |
| 4418 </chapter> | 5512 </chapter> |
