From 9d781a117a4f7218a5815254703c4023699f6ace Mon Sep 17 00:00:00 2001 From: torinthiel Date: Tue, 11 Nov 2008 13:57:29 +0000 Subject: Partial sync to 27843 git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@27903 b3059339-0415-0410-9bf9-f77b7e298cf2 --- DOCS/xml/pl/encoding-guide.xml | 5078 ++++++++++++++++++++++++---------------- 1 file changed, 3086 insertions(+), 1992 deletions(-) (limited to 'DOCS') diff --git a/DOCS/xml/pl/encoding-guide.xml b/DOCS/xml/pl/encoding-guide.xml index 8b0a6d5c58..cbb7c07f4f 100644 --- a/DOCS/xml/pl/encoding-guide.xml +++ b/DOCS/xml/pl/encoding-guide.xml @@ -1,5 +1,5 @@ - + @@ -30,7 +30,7 @@ Ciężko jest pokazać książkowy przepis na tworzenie ripu DVD bardzo wysokiej jakości. Trzeba wziąć pod uwagę kilka czynników, i powinieneś rozumieć - szczegóły albo masz dużą szansę że nie będziesz zadowolony z wyników. + szczegóły procesu, albo jest duża szansa że nie będziesz zadowolony z wyników. Poniżej zbadamy niektóre problemy i pokażemy przykład. Zakładamy że używasz libavcodec do kodowania obrazu, chociaż ta sama teoria działą też przy innych kodekach. @@ -46,12 +46,15 @@ Ciebie mądre decyzje. + + Przygotowanie do kodowania: Identyfikowanie materiału źródłowego i framerate + - Zanim w ogóle zaczniesz myśleć o kodowaniu filmu, musisz podjąć kilka - początkowych kroków. + Zanim w ogóle zaczniesz myśleć o kodowaniu filmu, musisz przejść kilka + wstępnych kroków. @@ -61,14 +64,14 @@ i framerate satelitarnej), będzie w jednym z dwóch formatów: NTSC w Ameryce Północnej i Japonii, PAL w Europie itp. Trzeba sobie jednak zdawać sprawę z tego, że jest to tylko format do - prezentacji w telewizji, i często ne jest + prezentacji w telewizji, i często nie jest oryginalnym formatem filmu. Doświadczenie pokazuje że filmy NTSC są trudniejsze do kodowania, ponieważ jest więcej elementów do zidentyfikowania w źródle. Żeby zrobić odpowienie kodowanie musisz znać oryginalny format filmu. Nieuwzględnienie tego skutkuje wieloma wadami wynikowego pliku, na przykład brzydkie artefakty przeplotu i powtórzone albo zagubione klatki. - Poza tym że są pbrzydkie, artefakty są też szkodliwe dla kodowania: + Poza tym że są brzydkie, artefakty są też szkodliwe dla kodowania: Dostaniesz gorszą jakość na jednostkę bitrate. @@ -87,18 +90,18 @@ i framerate Film PAL: Nagrywany kamerą video PAL z prędkością 50 pól na sekundę. Pole składa się tylko z parzystych albo nieparzystych linii klatki. - Telewizja była projektowana by odświerzać je naprzemiennie, jako tania forma - analogowej kompresji. + Telewizja była projektowana by odświerzać je naprzemiennie, w charakterze + taniej formy analogowej kompresji. Ludzkie oko podobno kompensuje ten efekt, ale jeśli zrozumiesz przeplot nauczysz się go widzieć też w telewizji i nigdy już nie będziesz z niej - zadowolony. + ZADOWOLONY. Dwa pola nie dają pełnej klatki, ponieważ są uchwycone co 1/50 sekundy, więc nie pasują do siebie, chyba że nie ma ruchu. Film NTSC: Nagrany kamerą NTSC z prędkością - 6000/1001 pól na sekundę, albo 60 pól na sekundę w erze przedkolorowej. + 60000/1001 pól na sekundę, albo 60 pól na sekundę w erze przedkolorowej. Poza tym podobny do PAL. @@ -116,6 +119,7 @@ i framerate + Identyfikowanie materiału źródłowego @@ -131,8 +135,8 @@ i framerate na klatkach a inne na polach. Zawsze gdy film jest przygotowywany do wyświetlania w telewizji jest przekształcany na format oparty na polach. - Rozliczne metody którymi się tego dokonuje są wspólnie nazywane "pulldown", - a niesławne "3:2 telecine" z NTSC jest jednym z jego rodzajów. + Rozliczne metody którymi się tego dokonuje są wspólnie nazywane "telecine", + a niesławne "3:2 pulldown" z NTSC jest jednym z jego rodzajów. Jeżeli oryginał nie był też oparty na polach (z tą samą prędkością), dostajesz film w innym formacie niż oryginał. @@ -164,19 +168,20 @@ i framerate NTSC 2:2 pulldown: Używane do pokazywania materiałów 30fps na NTSC. - Przyjemne, dokładnie jak pulldown 2:2 PAL. + Przyjemne, tak jak pulldown 2:2 PAL. Są też metody konwersji między filmami PAL i NTSC, ale ten temat wykracza poza zakres tego podręcznika. - Jeśli natkniesz się na taki film, i chcesz go zakodować, to największe - szanse masz odnajdując kopię w oryginalnym formacie. + Jeśli natkniesz się na taki film i chcesz go zakodować, to największe + szanse masz robiąc kopię w oryginalnym formacie. Konwersja między tymi dwoma formatami jest wysoce destrukcyjna i nie może - zostać czysto odwrócona, więc kodowanie będzie o wiele gorszej jakości jeśli + zostać ładnie odwrócona, więc kodowanie będzie o wiele gorszej jakości jeśli jest robione z przekonwertowanego źródła. + Gdy film jest zapisywany na DVD, kolejne pary pól są zapisywane jako klatka, pomimo tego że nie są przezaczone do wyświetlania razem. @@ -194,6 +199,7 @@ i framerate telecine" (hard-telecine), gdzie pola są faktycznie powtórzone w zakodowanym MPEG-2. + Procedury radzenia sobie z takimi przypadkami będą omówione w dalszej części przewodnika. @@ -205,7 +211,7 @@ i framerate Regiony NTSC: Jeśli MPlayer wyświetla w trakcie oglądania filmu - że framerate zostało zmienione na 24000/1001, i nigdy nie powraca, to jest + że framerate zostało zmienione na 24000/1001 i nigdy nie powraca, to jest to prawie na pewno progresywny materiał na którym zastosowano "miękkie telecine". @@ -253,13 +259,16 @@ i framerate -speed albo odtwarzać klatka po klatce. Spróbuj użyć opcji 0.2 żeby oglądać film bardzo wolno, albo naciskaj wielokrotnie klawisz "." żeby - wyświetlać jedną klatkę na raz. Może to pomóc zidentyfikować wzorzec jeśli + wyświetlać klatka po klatce. + Może to pomóc zidentyfikować wzorzec jeśli nie możesz go dostrzec przy pełnej prędkości. + + Stały kwantyzator a tryb wieloprzebiegowy @@ -286,8 +295,7 @@ i framerate na bitrate w przyszłych scenach, więc nie mogą na długo przekraczać wymaganego bitrate. Bardziej zaawansowane tryby, takie jak kodowanie wieloprzebiegowe, potrafią - wziąć pod uwagę statystyki z poprzednich przebiegów; to naprawia wyżej - wymieniony problem. + wziąć pod uwagę statystyki z poprzednich przebiegów, co naprawia ten problem. Uwaga: @@ -295,7 +303,7 @@ i framerate Większość kodeków obsługujących kodowanie ABR obsługuje tylko kodowanie dwuprzebiegowe, podczas gdy niektóre inne, na przykład x264 albo - XviD potrafią wykonywać wiele + Xvid potrafią wykonywać wiele przebiegów, z lekką poprawą jakości po każdym przebiegu. Jednak ta poprawa nie jest zauważalna ani mierzalna po około 4tym przebiegu. Dlatego też, w tej części, tryb dwuprzebiegowy i wieloprzebiegowy będą @@ -326,7 +334,7 @@ i framerate kwantyzatora, to prawie na pewno niszczysz film. Żeby tego uniknąć, powinieneś pewnie zmniejszyć rozdzielczość filmu, metodą opisaną dalej. - Ogólnie, jeśli troszczysz się o jakość, powinieneś unikać CBR. + Ogólnie, jeśli zależy Ci na jakości, powinieneś unikać CBR. @@ -345,8 +353,8 @@ i framerate niezależnie od tego czy makroblok tego wymaga czy nie. To znaczy że można by było zastosować do makrobloku wyższy kwantyzator bez utraty postrzegalnej jakości. Dlaczego marnować bity na niepotrzebnie niski kwantyzator? - Mikroprocesor ma tyle cykli ile jest czasu, ale jest tylko pewna ilość bitów - na twardym dysku. + Mikroprocesor ma tyle cykli ile jest czasu, ale jest tylko ograniczona ilość + bitów na twardym dysku. @@ -371,7 +379,7 @@ i framerate Ponieważ jesteś już przekonany że prawidłowym wyborem są dwa przebiegi, prawdziwym pytaniem jest jakiego bitrate użyć. Nie ma jednej odpowiedzi. - Idealnie chcesz wybrać bitrate będący najbliżej równowagi między jakością + Idealnie chcesz wybrać bitrate będący najlepszym kompromisem między jakością a wielkością pliku. To się zmienia w zależności od filmu. @@ -391,153 +399,149 @@ i framerate więc powinieneś ściągnąć go najpierw. Możesz wyliczyć bitrate z następującego równania: - bitrate = (wielkość_docelowa_w_MBajtach - wielkość_dźwięku_w_MB) + bitrate = (wielkość_docelowa_w_MBajtach - wielkość_dźwięku_w_MBajtach) * 1024 * 1024 / długość_w_sekundach * 8 / 1000 - Na przykład by wcisność dwugodzinny film na płytkę 702MB, z 60MB ścieżki + Na przykład by wcisnąć dwugodzinny film na płytkę 702MB, z 60MB ścieżki dźwiękowej, bitrate video musi być: (702 - 60) * 1024 * 1024 / (120*60) * 8 / 1000 = 740kbps - + -Constraints for efficient encoding +Ograniczenia efektywnego kodowania - Due to the nature of MPEG-type compression, there are various - constraints you should follow for maximal quality. - MPEG splits the video up into 16x16 squares called macroblocks, - each composed of 4 8x8 blocks of luma (intensity) information and two - half-resolution 8x8 chroma (color) blocks (one for red-cyan axis and - the other for the blue-yellow axis). - Even if your movie width and height are not multiples of 16, the - encoder will use enough 16x16 macroblocks to cover the whole picture - area, and the extra space will go to waste. - So in the interests of maximizing quality at a fixed filesize, it is - a bad idea to use dimensions that are not multiples of 16. +Ze względu na naturę kodowania typu MPEG istnieją różne ograniczenia których +warto się trzymać żeby osiągnąć najlepszą jakość. +MPEG dzieli obraz na kwadraty 16x16 pikseli nazywane makroblokami, +każdy z nich składa się z 4 bloków 8x8 informacji o jasności (luminancja, luma) +i dwóch 8x8 z połową rozdzielczości (jeden na składową czerwono-morską, drugi +na niebiesko-żółtą). +Nawet jeśli wysokość i szerokość filmu nie są wielokrotnościami 16, +koder użyje tyle makrobloków żeby przykryć cały obszar obrazu, +dodatkowa przestrzeń zostanie zmarnowana. +Zatem w interesie zwiększenai jakości przy utrzymaniu wielkości pliku kiepskim +pomysłem jest używanie wymiarów które nie są wielokrotnością 16. - Most DVDs also have some degree of black borders at the edges. Leaving - these in place can hurt quality in several ways. +Większość DVD ma też jakieś czarne ramki na brzegach. +Zostawienie ich tam mocno zaszkodzi jakości +na kilka sposobów. - - MPEG-type compression is also highly dependent on frequency domain - transformations, in particular the Discrete Cosine Transform (DCT), - which is similar to the Fourier transform. This sort of encoding is - efficient for representing patterns and smooth transitions, but it - has a hard time with sharp edges. In order to encode them it must - use many more bits, or else an artifact known as ringing will - appear. - + + Kompresje typu MPEG są zależne od transformat przestrzeni częstotliwości, + a dokładniej Dyskretnej Transformaty Cosinusowej (DCT), która jest podobna do + transformaty Fouriera. + Ten sposób kodowania jest efektywny przy wzorach i gładkich przejściach, ale + kiepsko sobie radzi z ostrymi krawędziami. + Żeby je zakoować, musi używać o wiele większej liczby bitów, albo wystąpią + artefakty znane jako pierścienie. + - - The frequency transform (DCT) takes place separately on each - macroblock (actually each block), so this problem only applies when - the sharp edge is inside a block. If your black borders begin - exactly at multiple-of-16 pixel boundaries, this is not a problem. - However, the black borders on DVDs rarely come nicely aligned, so - in practice you will always need to crop to avoid this penalty. - + + Transformacja częstotliwości (DCT) jest stosowana osobno do każdego + makrobloku (tak na prawdę do każdego bloku), więc ten problem istnieje tylko + gdy ostra krawędź jest wewnątrz bloku. + Jeśli czarna ramka zaczyna się dokładnie na krawędzi 16-pikselowego bloku, + nie stwarza problemów. + Jednakże, rzadko kiedy takie ramki są ładnie wyrównane, więc zazwyczaj będzie + trzeba przyciąć obraz żeby tego uniknąć. + - In addition to frequency domain transforms, MPEG-type compression uses - motion vectors to represent the change from one frame to the next. - Motion vectors naturally work much less efficiently for new content - coming in from the edges of the picture, because it is not present in - the previous frame. As long as the picture extends all the way to the - edge of the encoded region, motion vectors have no problem with - content moving out the edges of the picture. However, in the presence - of black borders, there can be trouble: +Poza transformatami przestrzeni częstotliwości, kompresje typu MPEG używają +wektorów ruchu, by reprezentować zmiany między sąsiednimi klatkami. +Oczywiście wektory ruchu są mniej efektywne w stosunku do nowej treści +przychodzącej z brzegów obrazka, ponieważ nie było jej na poprzedniej klatce. +Jeśli obraz rozciąga się do krawędzi zakodowanego regionu, +wektory ruchu radzą sobie z treścią wychodzącą poza krawędzie. +Jednak jeśli są ramki, mogą być kłopoty: - - For each macroblock, MPEG-type compression stores a vector - identifying which part of the previous frame should be copied into - this macroblock as a base for predicting the next frame. Only the - remaining differences need to be encoded. If a macroblock spans the - edge of the picture and contains part of the black border, then - motion vectors from other parts of the picture will overwrite the - black border. This means that lots of bits must be spent either - re-blackening the border that was overwritten, or (more likely) a - motion vector will not be used at all and all the changes in this - macroblock will have to be coded explicitly. Either way, encoding - efficiency is greatly reduced. - + + Dla każdego makrobloku, kompresja typu MPEG przechowuje wektor opisujący + która część poprzedniej klatki powinna być skopiowana do tego makrobloku jako + podstawa do przewidzenia następnej klatki. + Zakodowane wtedy muszą być tylko różnice. + Jeśli makroblok zawiera fragment ramki, to wektory ruchu z pozostałych cześci + obrazu zamażą obramowanie. + Oznacza to że dużo bitów będzie zużytych albo na jej powtórne zaczernienie + albo (co bardziej prawdopodobne), wektor ruchu w ogóle nie będzie użyty + i wszystkie zmiany w tym makrobloku będzie trzeba zakodować bezpośrednio. + W obu przypadkach, bardzo cierpi na tym efektywność kodowania. + - - Again, this problem only applies if black borders do not line up on - multiple-of-16 boundaries. - + + Powtórnie, ten problem występuje tylko jeśli ramki nie są na krawędziach + 16-pikselowych bloków. + - - Finally, suppose we have a macroblock in the interior of the - picture, and an object is moving into this block from near the edge - of the image. MPEG-type coding cannot say "copy the part that is - inside the picture but not the black border." So the black border - will get copied inside too, and lots of bits will have to be spent - encoding the part of the picture that is supposed to be there. - + + W końcu, przypuśćmy że mamy makroblok wewnątrz obrazu i obiekt dostaje się do + niego z okolic krawędzi. + Kodowanie typu MPEG nie potrafi powiedzieć "skopiuj część która jeest + wewnątrz obraka, ale nie czarne obramowanie." Dlatego obramowanie też + zostanie skopiowane i trzeba będzie zużyć sporo bitów żeby zakodować fragment + obrazu który powinien tam być. + - - If the picture runs all the way to the edge of the encoded area, - MPEG has special optimizations to repeatedly copy the pixels at the - edge of the picture when a motion vector comes from outside the - encoded area. This feature becomes useless when the movie has black - borders. Unlike problems 1 and 2, aligning the borders at multiples - of 16 does not help here. - + + Jeśli obraz sięga do krawędzi zakodowanego obszaru, MPEG ma specjalne + optymalizacje do wielokrotnego kopiowania ostatniego rzędu pikseli jeśli + wektor ruchu przychodzi z poza zakodoanego obszaru. + Staje się to bezużyteczne gry obraz ma czarne obramowanie. + W odróżnieniu od problemów 1 i 2 tutaj nic nie pomoże ustawienie obramowania + w odpowiednim miejscu. + - - - Despite the borders being entirely black and never changing, there - is at least a minimal amount of overhead involved in having more - macroblocks. - - + + Mimo tego, że obramowanie jest całkowicie czarne i nigdy się nie zmienia, + zawsze jest pewien narzut związany z większą ilością makrobloków. + - For all of these reasons, it is recommended to fully crop black - borders. Further, if there is an area of noise/distortion at the edge - of the picture, cropping this will improve encoding efficiency as - well. Videophile purists who want to preserve the original as close as - possible may object to this cropping, but unless you plan to encode at - constant quantizer, the quality you gain from cropping will - considerably exceed the amount of information lost at the edges. +Ze wszystkich tych powodów zalecane jest całkowite wycięcie czarnych obramowań. +Dodatkowo, jeśli przy krawędziach jest obszar zakłóceń/zniekształceń, obcięcie +go również poprawi efektywność kodowania. +Puryści, którzy chcą możliwie dokładnie zachować oryginał mogą się sprzeciwiać, +ale jeśli nie planujesz używać stałego kwantyzatora to jakość uzyskana dzięki +skadrowaniu znacząco przewyższy utratę informacji przy brzegach. + -Cropping and Scaling +Kadrowanie i skalowanie - Recall from the previous section that the final picture size you - encode should be a multiple of 16 (in both width and height). - This can be achieved by cropping, scaling, or a combination of both. +Przypomnijmy z poprzedniej części że ostateczna wielkość (wysokość i szerokość) +obrazu do kodowania powinna być wielokrotnością 16. +Można to osiągnąć kadrowaniem, skalowaniem albo kombinacją obydwu. - When cropping, there are a few guidelines that must be followed to - avoid damaging your movie. - The normal YUV format, 4:2:0, stores chroma (color) information - subsampled, i.e. chroma is only sampled half as often in each - direction as luma (intensity) information. - Observe this diagram, where L indicates luma sampling points and C - chroma. +Przy kadrowaniu, jest kilka reguł których musimy przestrzegać by uniknąć +uszkodzenia filmu. +Zwykły format YUV, 4:2:0, przechowuje wartości koloru podpróbkowane, czyli +kolor jest próbkowany o połowę rzadziej w każdym kierunku niż jasność. +Spójrzmy na diagram, na którym L oznacza punkty próbkowania jasności (luma) +a C koloru (chroma). @@ -614,18 +618,17 @@ i framerate - As you can see, rows and columns of the image naturally come in pairs. - Thus your crop offsets and dimensions must be - even numbers. - If they are not, the chroma will no longer line up correctly with the - luma. - In theory, it is possible to crop with odd offsets, but it requires - resampling the chroma which is potentially a lossy operation and not - supported by the crop filter. +Jak widać, wiersze i kolumny obrazu w sposób naturalny łączą się w pary. +Dlatego przesunięcia i wymiary kadrowania muszą być +liczbami parzystymi. +Jeśli nie są, barwa nie będzie już dobrze dopasowana do jasności. +Teoretycznie możliwe jest kadrowanie z nieparzystym przesunięciem, ale wymaga +to przepróbkowania kolorów, co jest potencjalnie stratną operacją nie +obsługiwaną przez filtr kadrowania. - Further, interlaced video is sampled as follows: +Dalej, film z przeplotem jest kodowany jak poniżej: @@ -658,8 +661,8 @@ i framerate - Top field - Bottom field + Górne pole + Dolne pole L @@ -866,371 +869,391 @@ i framerate - As you can see, the pattern does not repeat until after 4 lines. - So for interlaced video, your y-offset and height for cropping must - be multiples of 4. +Jak widać, wzór powtarza się dopiero po 4 liniach. +Dlatego przy filmie z przeplotem, pionowa współrzędna i wysokość kadrowania +muszą być wielokrotnościami 4. - Native DVD resolution is 720x480 for NTSC, and 720x576 for PAL, but - there is an aspect flag that specifies whether it is full-screen (4:3) or - wide-screen (16:9). Many (if not most) widescreen DVDs are not strictly - 16:9, and will be either 1.85:1 or 2.35:1 (cinescope). This means that - there will be black bands in the video that will need to be cropped out. +Podstawową rozdzielczością DVD jest 720x480 dla NTSC i 720x576 dla PAL, ale +jest też flaga proporcji, która określa czy obraz jest ekranowy (4:3) czy +panoramiczny (16:9). +Wiele (jeśli nie większość) panoramicznych DVD nie jest dokładnie 16:9 tylko +raczej 1,85:1 lub 2,35:1 (cinescope). +Oznacza to że będzie czarne obramowanie na filmie, które trzeba usunąć. - MPlayer provides a crop detection filter that - will determine the crop rectangle (). - Run MPlayer with - and it will print out the crop - settings to remove the borders. - You should let the movie run long enough that the whole picture - area is used, in order to get accurate crop values. +MPlayer dostarcza filtr wykrywania kadrowania +(), który określi prostokąt kadrowania. +Uruchom MPlayera z opcją a wydrukuje on ustawienia kadrowania potrzebne do usunięcia +obramowania. +Powinieneś puścić film wystarczająco długo żeby został użyty cały obszar +obrazu, inaczej wartości będą niedokładne. - Then, test the values you get with MPlayer, - using the command line which was printed by - , and adjust the rectangle as needed. - The filter can help by allowing you to - interactively position the crop rectangle over your movie. - Remember to follow the above divisibility guidelines so that you - do not misalign the chroma planes. +Potem przetestuj otrzymane wartości z użyciem +MPlayera, przekazując opcje podane przez + i dostosowując prostokąt według potrzeb. +Filtr może w tym pomóc, pozwalając na interaktywne +ustawienie prostokąta kadrowania na filmie. +Pamiętaj, by trzymać się powyższych reguł podzielności, żeby nie przestawić +płaszczyzny koloru. - In certain cases, scaling may be undesirable. - Scaling in the vertical direction is difficult with interlaced - video, and if you wish to preserve the interlacing, you should - usually refrain from scaling. - If you will not be scaling but you still want to use multiple-of-16 - dimensions, you will have to overcrop. - Do not undercrop, since black borders are very bad for encoding! +W pewnych przypadkach skalowanie może być niepożądane. +Skalowanie w kierunku pionowym jest trudne przy filmie z przeplotem, a jeśli +chcesz zachować przeplot, zazwyczaj powinieneś się wstrzymać od skalowania. +Jeśl nie chcesz skalować, ale nadal chcesz używać wymiarów będących wielokrotnościami 16 to musisz przekadrować. +NIe należy niedokadrowywać, bo obramowania są bardzo szkodliwe przy kodowaniu! - Because MPEG-4 uses 16x16 macroblocks, you will want to make sure that each - dimension of the video you are encoding is a multiple of 16 or else you - will be degrading quality, especially at lower bitrates. You can do this - by rounding the width and height of the crop rectangle down to the nearest - multiple of 16. - As stated earlier, when cropping, you will want to increase the Y offset by - half the difference of the old and the new height so that the resulting - video is taken from the center of the frame. And because of the way DVD - video is sampled, make sure the offset is an even number. (In fact, as a - rule, never use odd values for any parameter when you are cropping and - scaling video.) If you are not comfortable throwing a few extra pixels - away, you might prefer instead to scale the video instead. We will look - at this in our example below. - You can actually let the filter do all of the - above for you, as it has an optional parameter that - is equal to 16 by default. +Ponieważ MPEG-4 używa makrobloków 16x16, powinieneś się upewnić, +że każdy wymiar kodowanego filmu jest wielokrotnością 16, inaczej +degradujemy jakość, zwłaszcza przy niższych bitrate. +Można tego dokonać zaokrąglając wysokość i szerokość prostokąta kadrowania do +najbliższej wielokrotności 16. +Jak powiedziano wcześniej, trzeba zwiększyć przesunięcie +pionowe o połowę różnicy między starą a nową wysokością, +żeby wynikowy film był brany ze środka klatki. +A ze względu na sposób w jaki próbkowane jest DVD, upewnij się że przesunięcie +jest parzyste (w zasadzie, stosuj się do reguły, żeby nigdy nie używać +nieparzystych wartości przy przycinaniu i skalowaniu obrazu). +Jeśli nie czujesz się dobrze odrzucając dodatkowe piksele, +może wolisz przeskalować video. +Przyjżymy się temu w przykładzie poniżej. +Możesz też pozwolić filtrowi zrobić to wszystko za +Ciebie, jako że ma on opcjonalny parametr +(zaokrąglenie), domyślnie równy 16. - Also, be careful about "half black" pixels at the edges. Make sure you - crop these out too, or else you will be wasting bits there that - are better spent elsewhere. +Uważaj też na "poł-czarne" piksele na przegach. Też je wykadruj, albo będziesz +na nie marnował bity któ?e przydadzą się gdzie indziej. - After all is said and done, you will probably end up with video whose pixels - are not quite 1.85:1 or 2.35:1, but rather something close to that. You - could calculate the new aspect ratio manually, but - MEncoder offers an option for libavcodec called - that will do this for you. Absolutely do not scale this video up in order to - square the pixels unless you like to waste your hard disk space. Scaling - should be done on playback, and the player will use the aspect stored in - the AVI to determine the correct resolution. - Unfortunately, not all players enforce this auto-scaling information, - therefore you may still want to rescale. +Po tym wszystkim prawdopodobnie dostaniesz film który nie ma dokładnie +proporcji 1,85:1 ani 2,35:1 tylko coś podobnego. +Mógłbyś samemu policzyć nowe proporcje, ale MEncoder +ma pocję do libavcodec nazywaną + która zrobi to za Ciebie. +Nie powinieneś przeskalowywać video żeby wyrównać piksele, chyba że chcesz +marnować miejsce na dysku. +Skalowanie powinno być robione przy odtwarzaniu, a odtwarzacz używa informacji +o proporcjach zapisanych w AVI żeby określić prawidłową rozdzielczość. +Niestety, nie wszystkie odtwarzacze uznają te informacje, +dlatego mimo wszystko możesz chcieć przeskalować. + -Choosing resolution and bitrate - - - If you will not be encoding in constant quantizer mode, you need to - select a bitrate. - The concept of bitrate is quite simple. - It is the (average) number of bits that will be consumed to store your - movie, per second. - Normally bitrate is measured in kilobits (1000 bits) per second. - The size of your movie on disk is the bitrate times the length of the - movie in time, plus a small amount of "overhead" (see the section on - the AVI container - for instance). - Other parameters such as scaling, cropping, etc. will - not alter the file size unless you - change the bitrate as well!. - - - Bitrate does not scale proportionally - to resolution. - That is to say, a 320x240 file at 200 kbit/sec will not be the same - quality as the same movie at 640x480 and 800 kbit/sec! - There are two reasons for this: +Dobieranie rozdzielczości i bitrate + + +Jeśli nie kodujesz w trybie stałego kwantyzatora, musisz wybrać bitrate. +Jest to dość prosta rzecz – to (średnia) ilość bitów jaka będzie +używana do zakodowania jednej sekundy filmu. +Zazwyczaj bitrate mierzy się w kilobitach (1000 bitów) na sekundę. +Wielkość filmu na dysku to bitrate razy długość filmu, +plus drobne "dodatki" (patrz na przykład sekcja o +kontenerze AVI +). +Pozostałe parametry, takie jak skalowanie, kadrowanie itp. +nie zmienią wielkości pliku jeśli nie +zmienisz też bitrate! + + + +Bitrate nie skaluje się proporcjonalnie do +rozdzielczości. +To znaczy, film 320x240 w 200 kbit/s nie będzie tej samej jakości co ten sam +film w 640x480 i 800 kbit/s! +Są ku temu dwie przyczyny: - - Perceptual: You notice MPEG - artifacts more if they are scaled up bigger! - Artifacts appear on the scale of blocks (8x8). - Your eye will not see errors in 4800 small blocks as easily as it - sees errors in 1200 large blocks (assuming you will be scaling both - to fullscreen). - - - Theoretical: When you scale down - an image but still use the same size (8x8) blocks for the frequency - space transform, you move more data to the high frequency bands. - Roughly speaking, each pixel contains more of the detail than it - did before. - So even though your scaled-down picture contains 1/4 the information - in the spacial directions, it could still contain a large portion - of the information in the frequency domain (assuming that the high - frequencies were underutilized in the original 640x480 image). - - - - - Past guides have recommended choosing a bitrate and resolution based - on a "bits per pixel" approach, but this is usually not valid due to - the above reasons. - A better estimate seems to be that bitrates scale proportional to the - square root of resolution, so that 320x240 and 400 kbit/sec would be - comparable to 640x480 at 800 kbit/sec. - However this has not been verified with theoretical or empirical - rigor. - Further, given that movies vary greatly with regard to noise, detail, - degree of motion, etc., it is futile to make general recommendations - for bits per length-of-diagonal (the analog of bits per pixel, - using the square root). - - - So far we have discussed the difficulty of choosing a bitrate and - resolution. + + Wizualna: Łatwiej zauważyć artefakty MPEG + jeśli są bardziej powiększone! + Artefakty powstają na poziomie bloków (8x8). + Ludzkie oko trudniej dostrzega błędy w 4800 małych blokach niż w 1200 dużych + (zakładając że skalujesz na pełny ekran). + + + Teoretyczna: Kiedy zmniejszasz obraz ale + nadal używasz tych samych bloków 8x8 do transformacji przestrzeni + częstotliwości. masz więcej danych w pasmach wyższych częstotliwości. + W pewien sposób każdy piksel ma więcej szczegółów niż poprzednio. + Dlatego, mimo że przeskalowany obraz zawiera 1/4 informacji jeśli chodzi + o wielkość, to nadal może zawierać większość informacji w przestrzeni + częstotliwości (zakładając że wysokie częstotliwości były mało używane + w oryginalnym filmie 640x480). + + + + + +Poprzednie podręczniki zalecały dobranie bitrate i rozdzielczości w sposób +bazujący na podejściu "bity na piksel", ale z powyższych powodów zazwyczaj nie +jest to prawidłowe. +Lepszym przybliżeniem zdaje się skalowanie bitrate proporcjonalnie do +pierwiastka kwadratowego z rozdzielczości, czyli film 320x240 i 400 kbit/s +powinien być podobny do 640x480 i 800 kbit/s. +Nie zostało to jednak zweryfikowane ani teoretycznie ani empirycznie. +Dodatkowo, ponieważ filmy są bardzo zróżnicowane jeśli chodzi o szum, +szczegóły, ilość ruchu itp. bezsensowne jest podawanie ogólnych zaleceń na bity +na przekątą (analogia bitów na piksel używająca pierwiastka). + + +Omówiliśmy więc problemy z wyborem bitrate i rozdzielczości. -Computing the resolution +Obliczanie rozdzielczości + - First, you should compute the encoded aspect ratio: - ARc = (Wc x (ARa / PRdvd )) / Hc +Następne kroki przeprowadzą Cię przez obliczenie rozdzielczości dla Twojego +filmu bez zniekształcania go za bardzo, biorąc pod uwagę kilka typów informacji +o źródłowym filmie. +Najpierw powinieneś policzyć zakodowane proporcje: +ARc = (Wc x (ARa / PRdvd )) / Hc + -where: +gdzie: - Wc and Hc are the width and height of the cropped video, + Hc i Wc to wysokość i szerokość skadrowanego filmu. - ARa is the displayed aspect ratio, which usually is 4/3 or 16/9, + ARa do wyświetlane proporcje, zazwyczaj 4/3 lub 16/9. - PRdvd is the pixel ratio of the DVD which is equal to 1.25=(720/576) for PAL - DVDs and 1.5=(720/480) for NTSC DVDs, + PRdvd to proporcje na DVD równe 1,25=(720*576) dla DVD PAL i 1,5=(720/480) dla + VD NTSC. - Then, you can compute the X and Y resolution, according to a certain - Compression Quality (CQ) factor: - ResY = INT(SQRT( 1000*Bitrate/25/ARc/CQ )/16) * 16 - and - ResX = INT( ResY * ARc / 16) * 16 +Potem możesz policzyć rozdzielczość X i Y, zgodnie z dobranym wskażnikiem +Jakości Kompresji (Compression Quality, CQ): +RozY = INT(Pierw( 1000*Bitrate/25/ARc/CQ )/16) * 16 +i +RozX = INT( ResY * ARc / 16) * 16, +gdzie INT oznacza zaokrąglenie do liczby całkowitej. - Okay, but what is the CQ? - The CQ represents the number of bits per pixel and per frame of the encode. - Roughly speaking, the greater the CQ, the less the likelihood to see - encoding artifacts. - However, if you have a target size for your movie (1 or 2 CDs for instance), - there is a limited total number of bits that you can spend; therefore it is - necessary to find a good tradeoff between compressibility and quality. +Dobrze, ale co to jest CQ? +CQ reprezentuje ilość bitów na piksel i klatkę kodowania. +Z grubsza biorąc, im większe CQ tym mniejsza szansa na zobaczenie artefaktów +kodowania. +Jednakże, jeśli masz docelową wielkość filmu (na przykład 1 lub 2 płyty CD), +masz ograniczoną ilość bitów do zużycia; dlatego musisz znaleźć równowagę +między poziomem kompresji i jakością. - The CQ depends both on the bitrate and the movie resolution. - In order to raise the CQ, typically you would downscale the movie given that the - bitrate is computed in function of the target size and the length of the - movie, which are constant. - A CQ below 0.18 usually ends up in a very blocky picture, because there - are not enough bits to code the information of each macroblock (MPEG4, like - many other codecs, groups pixels by blocks of several pixels to compress the - image; if there are not enough bits, the edges of those blocks are - visible). - It is therefore wise to take a CQ ranging from 0.20 to 0.22 for a 1 CD rip, - and 0.26-0.28 for 2 CDs. +CQ zależy od bitrate, efektywności kodeka video i rozdzielczości filmu. +Żeby podnieść CQ zazwyczej zmniejszysz film, ponieważ bitrate jest funkcją docelowej wielkości i długości filmu, które są stałe. +Przy użyciu kodeków MPEG-4 ASP, takich jak +Xvid i +libavcodec, CQ niższe niż 0,18 +zazwyczaj daje kiepski obraz, ponieważ nie ma dość bitów by zakodować +informacje z każdego makrobloku. +(MPEG4, jak wiele innych kodeków, grupuje piksele w bloki żeby +skompresować obraz. Jeśli nie ma dość bitów widać krawędzie tych bloków.) +Dlatego też mądrze jest wybrać CQ w zakresie 0,20 do 0,22 na film jednopłytkowy +i 0,26-0,28 na dwupłytkowy przy standardowych opcjach kodowania. +Bardziej zaawansowane opcje kodowania, takie jak te podane tutaj dla +libavcodec +i +Xvid +powinny umożliwić otrzymanie takiej samej jakości z CQ w zakresie 0,18 do 0,20 +na 1 CD i 0,24 do 0,26 na 2 CD. +Z kodekami MPEG-4 AVC, takimi jak +x264, możesz używać CQ w zakresie +0,14 do 0,16 przy standardowych opcjach +a powinno się też udać zejść do 0,10 do 0,12 z +zaawansowanymi opcjami kodowania x264. - Please take note that the CQ is just an indicative figure, as depending on - the encoded content, a CQ of 0.18 may look just fine for a Bergman, contrary - to a movie such as The Matrix, which contains many high-motion scenes. - On the other hand, it is worthless to raise CQ higher than 0.30 as you would - be wasting bits without any noticeable quality gain. +Pamiętajmy, że CQ jest tylko przydatnym odnośnikiem, zależnym od kodowanego +filmu. CQ równe ,018 może wyglądać dobrze przy Bergmanie, w przeciwieństwie do +filmu takiego jak Martix, który zaawiera wiele bardzo ruchliwych scen. +Z drugiej strony, bezsensowne jest podnoszenie CQ powyżej 0,30 jako że marnuje się bity bez zauważalnej poprawy jakości. +Pamiętajmy też że, jak było wspomniane wcześniej, filmy w niższej +rozdzielczości potrzebują większego CQ (w porównaniu do na przykład +rozdzielczości DVD) żeby dobrze wyglądać. - + + + Filtering - Learning how to use MEncoder's video filters - is essential to producing good encodes. - All video processing is performed through the filters -- cropping, - scaling, color adjustment, noise removal, sharpening, deinterlacing, - telecine, inverse telecine, and deblocking, just to name a few. - Along with the vast number of supported input formats, the variety of - filters available in MEncoder is one of its - main advantages over other similar programs. +Learning how to use MEncoder's video filters +is essential to producing good encodes. +All video processing is performed through the filters -- cropping, +scaling, color adjustment, noise removal, sharpening, deinterlacing, +telecine, inverse telecine, and deblocking, just to name a few. +Along with the vast number of supported input formats, the variety of +filters available in MEncoder is one of its +main advantages over other similar programs. - Filters are loaded in a chain using the -vf option: +Filters are loaded in a chain using the -vf option: - -vf filter1=options,filter2=options,... +-vf filter1=options,filter2=options,... - Most filters take several numeric options separated by colons, but - the syntax for options varies from filter to filter, so read the man - page for details on the filters you wish to use. +Most filters take several numeric options separated by colons, but +the syntax for options varies from filter to filter, so read the man +page for details on the filters you wish to use. - Filters operate on the video in the order they are loaded. - For example, the following chain: +Filters operate on the video in the order they are loaded. +For example, the following chain: - -vf crop=688:464:12:4,scale=640:464 +-vf crop=688:464:12:4,scale=640:464 - will first crop the 688x464 region of the picture with upper-left - corner at (12,4), and then scale the result down to 640x464. +will first crop the 688x464 region of the picture with upper-left +corner at (12,4), and then scale the result down to 640x464. - Certain filters need to be loaded at or near the beginning of the - filter chain, in order to take advantage of information from the - video decoder that will be lost or invalidated by other filters. - The principal examples are (postprocessing, only - when it is performing deblock or dering operations), - (another postprocessor to remove MPEG artifacts), - (inverse telecine), and - (for converting soft telecine to hard - telecine). +Certain filters need to be loaded at or near the beginning of the +filter chain, in order to take advantage of information from the +video decoder that will be lost or invalidated by other filters. +The principal examples are (postprocessing, only +when it is performing deblock or dering operations), + (another postprocessor to remove MPEG artifacts), + (inverse telecine), and + (for converting soft telecine to hard telecine). - In general, you want to do as little filtering as possible to the movie - in order to remain close to the original DVD source. Cropping is often - necessary (as described above), but avoid to scale the video. Although - scaling down is sometimes preferred to using higher quantizers, we want - to avoid both these things: remember that we decided from the start to - trade bits for quality. +In general, you want to do as little filtering as possible to the movie +in order to remain close to the original DVD source. Cropping is often +necessary (as described above), but avoid to scale the video. Although +scaling down is sometimes preferred to using higher quantizers, we want +to avoid both these things: remember that we decided from the start to +trade bits for quality. - Also, do not adjust gamma, contrast, brightness, etc. What looks good - on your display may not look good on others. These adjustments should - be done on playback only. +Also, do not adjust gamma, contrast, brightness, etc. What looks good +on your display may not look good on others. These adjustments should +be done on playback only. - One thing you might want to do, however, is pass the video through a - very light denoise filter, such as . - Again, it is a matter of putting those bits to better use: why waste them - encoding noise when you can just add that noise back in during playback? - Increasing the parameters for will further - improve compressibility, but if you increase the values too much, you - risk degrading the image visibily. The suggested values above - () are quite conservative; you should feel free to - experiment with higher values and observe the results for yourself. +One thing you might want to do, however, is pass the video through a +very light denoise filter, such as . +Again, it is a matter of putting those bits to better use: why waste them +encoding noise when you can just add that noise back in during playback? +Increasing the parameters for will further +improve compressibility, but if you increase the values too much, you +risk degrading the image visibly. The suggested values above +() are quite conservative; you should feel free to +experiment with higher values and observe the results for yourself. - + Interlacing and Telecine - Almost all movies are shot at 24 fps. Because NTSC is 30000/1001 fps, some - processing must be done to this 24 fps video to make it run at the correct - NTSC framerate. The process is called 3:2 pulldown, commonly referred to - as telecine (because pulldown is often applied during the telecine - process), and, naively described, it works by slowing the film down to - 24000/1001 fps, and repeating every fourth frame. +Almost all movies are shot at 24 fps. Because NTSC is 30000/1001 fps, some +processing must be done to this 24 fps video to make it run at the correct +NTSC framerate. The process is called 3:2 pulldown, commonly referred to +as telecine (because pulldown is often applied during the telecine +process), and, naively described, it works by slowing the film down to +24000/1001 fps, and repeating every fourth frame. - No special processing, however, is done to the video for PAL DVDs, which - run at 25 fps. (Technically, PAL can be telecined, called 2:2 pulldown, - but this does not become an issue in practice.) The 24 fps film is simply - played back at 25 fps. The result is that the movie runs slightly faster, - but unless you are an alien, you probably will not notice the difference. - Most PAL DVDs have pitch-corrected audio, so when they are played back at - 25 fps things will sound right, even though the audio track (and hence the - whole movie) has a running time that is 4% less than NTSC DVDs. +No special processing, however, is done to the video for PAL DVDs, which +run at 25 fps. (Technically, PAL can be telecined, called 2:2 pulldown, +but this does not become an issue in practice.) The 24 fps film is simply +played back at 25 fps. The result is that the movie runs slightly faster, +but unless you are an alien, you probably will not notice the difference. +Most PAL DVDs have pitch-corrected audio, so when they are played back at +25 fps things will sound right, even though the audio track (and hence the +whole movie) has a running time that is 4% less than NTSC DVDs. - Because the video in a PAL DVD has not been altered, you need not worry - much about framerate. The source is 25 fps, and your rip will be 25 - fps. However, if you are ripping an NTSC DVD movie, you may need to - apply inverse telecine. +Because the video in a PAL DVD has not been altered, you need not worry +much about framerate. The source is 25 fps, and your rip will be 25 +fps. However, if you are ripping an NTSC DVD movie, you may need to +apply inverse telecine. - For movies shot at 24 fps, the video on the NTSC DVD is either telecined - 30000/1001, or else it is progressive 24000/1001 fps and intended to be telecined - on-the-fly by a DVD player. On the other hand, TV series are usually - only interlaced, not telecined. This is not a hard rule: some TV series - are interlaced (such as Buffy the Vampire Slayer) whereas some are a - mixture of progressive and interlaced (such as Angel, or 24). +For movies shot at 24 fps, the video on the NTSC DVD is either telecined +30000/1001, or else it is progressive 24000/1001 fps and intended to be +telecined on-the-fly by a DVD player. On the other hand, TV series are usually +only interlaced, not telecined. This is not a hard rule: some TV series +are interlaced (such as Buffy the Vampire Slayer) whereas some are a +mixture of progressive and interlaced (such as Angel, or 24). - It is highly recommended that you read the section on - How to deal with telecine and interlacing in NTSC DVDs - to learn how to handle the different possibilities. +It is highly recommended that you read the section on +How to deal with telecine and interlacing in NTSC DVDs +to learn how to handle the different possibilities. - However, if you are mostly just ripping movies, likely you are either - dealing with 24 fps progressive or telecined video, in which case you can - use the filter . +However, if you are mostly just ripping movies, likely you are either +dealing with 24 fps progressive or telecined video, in which case you can +use the filter . - + + Encoding interlaced video - If the movie you want to encode is interlaced (NTSC video or - PAL video), you will need to choose whether you want to - deinterlace or not. - While deinterlacing will make your movie usable on progressive - scan displays such a computer monitors and projectors, it comes - at a cost: The fieldrate of 50 or 60000/1001 fields per second - is halved to 25 or 30000/1001 frames per second, and roughly half of - the information in your movie will be lost during scenes with - significant motion. +If the movie you want to encode is interlaced (NTSC video or +PAL video), you will need to choose whether you want to +deinterlace or not. +While deinterlacing will make your movie usable on progressive +scan displays such a computer monitors and projectors, it comes +at a cost: The fieldrate of 50 or 60000/1001 fields per second +is halved to 25 or 30000/1001 frames per second, and roughly half of +the information in your movie will be lost during scenes with +significant motion. - Therefore, if you are encoding for high quality archival purposes, - it is recommended not to deinterlace. - You can always deinterlace the movie at playback time when - displaying it on progressive scan devices, and future players will - be able to deinterlace to full fieldrate, interpolating 50 or - 60000/1001 entire frames per second from the interlaced video. +Therefore, if you are encoding for high quality archival purposes, +it is recommended not to deinterlace. +You can always deinterlace the movie at playback time when +displaying it on progressive scan devices. +The power of currently available computers forces players to use a +deinterlacing filter, which results in a slight degradation in +image quality. +But future players will be able to mimic the interlaced display of +a TV, deinterlacing to full fieldrate and interpolating 50 or +60000/1001 entire frames per second from the interlaced video. @@ -1253,19 +1276,19 @@ Special care must be taken when working with interlaced video: With these things in mind, here is our first example: - - mencoder capture.avi -mc 0 -oac lavc -ovc lavc -lavcopts \ - vcodec=mpeg2video:vbitrate=6000:ilme:ildct:acodec=mp2:abitrate=224 +mencoder capture.avi -mc 0 -oac lavc -ovc lavc -lavcopts \ + vcodec=mpeg2video:vbitrate=6000:ilme:ildct:acodec=mp2:abitrate=224 - Note the and options. + Notes on Audio/Video synchronization + MEncoder's audio/video synchronization algorithms were designed with the intention of recovering files with @@ -1280,6 +1303,7 @@ the option, or put this in your you are only working with good sources (DVD, TV capture, high quality MPEG-4 rips, etc) and not broken ASF/RM/MOV files. + If you want to further guard against strange frame skips and duplication, you can use both and @@ -1290,9 +1314,11 @@ unpredictably add or drop frames, or if your input file has variable framerate! Therefore, using is not in general recommended. + -The so-called "three-pass" audio encoding which MEncoder -supports has been reported to cause A/V desync. +The so-called "three-pass" audio encoding which +MEncoder supports has been reported to cause A/V +desync. This will definitely happen if it is used in conjunction with certain filters, therefore, it is now recommended not to use three-pass audio mode. @@ -1301,6 +1327,7 @@ users who understand when it is safe to use and when it is not. If you have never heard of three-pass mode before, forget that we even mentioned it! + There have also been reports of A/V desync when encoding from stdin with MEncoder. @@ -1308,642 +1335,799 @@ Do not do this! Always use a file or CD/DVD/etc device as input. + + + +Choosing the video codec + + +Which video codec is best to choose depends on several factors, +like size, quality, streamability, usability and popularity, some of +which widely depend on personal taste and technical constraints. + + + + + Compression efficiency: + It is quite easy to understand that most newer-generation codecs are + made to increase quality and compression. + Therefore, the authors of this guide and many other people suggest that + you cannot go wrong + + Be careful, however: Decoding DVD-resolution MPEG-4 AVC videos + requires a fast machine (i.e. a Pentium 4 over 1.5GHz or a Pentium M + over 1GHz). + + when choosing MPEG-4 AVC codecs like + x264 instead of MPEG-4 ASP codecs + such as libavcodec MPEG-4 or + Xvid. + (Advanced codec developers may be interested in reading Michael + Niedermayer's opinion on + "why MPEG4-ASP sucks".) + Likewise, you should get better quality using MPEG-4 ASP than you + would with MPEG-2 codecs. + + + + However, newer codecs which are in heavy development can suffer from + bugs which have not yet been noticed and which can ruin an encode. + This is simply the tradeoff for using bleeding-edge technology. + + + + What is more, beginning to use a new codec requires that you spend some + time becoming familiar with its options, so that you know what + to adjust to achieve a desired picture quality. + + + + + Hardware compatibility: + It usually takes a long time for standalone video players to begin to + include support for the latest video codecs. + As a result, most only support MPEG-1 (like VCD, XVCD and KVCD), MPEG-2 + (like DVD, SVCD and KVCD) and MPEG-4 ASP (like DivX, + libavcodec's LMP4 and + Xvid) + (Beware: Usually, not all MPEG-4 ASP features are supported). + Please refer to the technical specs of your player (if they are available), + or google around for more information. + + + + + Best quality per encoding time: + Codecs that have been around for some time (such as + libavcodec MPEG-4 and + Xvid) are usually heavily + optimized with all kinds of smart algorithms and SIMD assembly code. + That is why they tend to yield the best quality per encoding time ratio. + However, they may have some very advanced options that, if enabled, + will make the encode really slow for marginal gains. + + + + If you are after blazing speed you should stick around the default + settings of the video codec (although you should still try the other + options which are mentioned in other sections of this guide). + + + + You may also consider choosing a codec which can do multi-threaded + processing, though this is only useful for users of machines with + several CPUs. + libavcodec MPEG-4 does + allow that, but speed gains are limited, and there is a slight + negative effect on picture quality. + Xvid's multi-threaded encoding, + activated by the option, can be used to + boost encoding speed — by about 40-60% in typical cases — + with little if any picture degradation. + x264 also allows multi-threaded + encoding, which currently speeds up encoding by 94% per CPU core while + lowering PSNR between 0.005dB and 0.01dB on a typical setup. + + + + + + Personal taste: + This is where it gets almost irrational: For the same reason that some + hung on to DivX 3 for years when newer codecs were already doing wonders, + some folks will prefer Xvid + or libavcodec MPEG-4 over + x264. + + + You should make your own judgement; do not take advice from people who + swear by one codec. + Take a few sample clips from raw sources and compare different + encoding options and codecs to find one that suits you best. + The best codec is the one you master, and the one that looks + best to your eyes on your display + + The same encode may not look the same on someone else's monitor or + when played back by a different decoder, so future-proof your encodes by + playing them back on different setups. + ! + + + + + +Please refer to the section +selecting codecs and container formats +to get a list of supported codecs. + + + + + Audio - Audio is a much simpler problem to solve: if you care about quality, just - leave it as is. - Even AC3 5.1 streams are at most 448Kbit/s, and they are worth every bit. - You might be tempted to transcode the audio to high quality Vorbis, but - just because you do not have an A/V receiver for AC3 pass-through today - does not mean you will not have one tomorrow. Future-proof your DVD rips by - preserving the AC3 stream. - You can keep the AC3 stream either by copying it directly into the video - stream during the encoding. - You can also extract the AC3 stream in order to mux it into containers such - as NUT or Matroska. - mplayer source_file.vob -aid 129 -dumpaudio -dumpfile sound.ac3 - will dump into the file sound.ac3 the - audio track number 129 from the file - source_file.vob (NB: DVD VOB files - usually use a different audio numbering, - which means that the VOB audio track 129 is the 2nd audio track of the file). - - - - But sometimes you truly have no choice but to further compress the - sound so that more bits can be spent on the video. - Most people choose to compress audio with either MP3 or Vorbis audio - codecs. - While the latter is a very space-efficient codec, MP3 is better supported - by hardware players, although this trend is changing. - - - - Do not use when encoding - a file with audio, even if you will be encoding and muxing audio - separately later. - Though it may work in ideal cases, using is - likely to hide some problems in your encoding command line setting. - In other words, having a soundtrack during your encode assures you that, - provided you do not see messages such as - Too many audio packets in the buffer, you will be able - to get proper sync. - - - - You need to have MEncoder process the sound. - You can for example copy the orignal soundtrack during the encode with - or convert it to a "light" 4 kHz mono WAV - PCM with . - Otherwise, in some cases, it will generate a video file that will not sync - with the audio. - Such