Mercurial > mplayer.hg
comparison DOCS/xml/en/encoding-guide.xml @ 16383:3cc0d81806bf
In order to make sure A/V sync is preserved, MEncoder really has to be fed with an audio track.
Added a paragraph that explains why, and nuked all the occurences of "-nosound".
author | gpoirier |
---|---|
date | Sun, 04 Sep 2005 12:21:47 +0000 |
parents | f71d1d8468df |
children | afe6be7b2d48 |
comparison
equal
deleted
inserted
replaced
16382:5dcfda676742 | 16383:3cc0d81806bf |
---|---|
1293 <para> | 1293 <para> |
1294 <application>MEncoder</application>'s audio/video synchronization | 1294 <application>MEncoder</application>'s audio/video synchronization |
1295 algorithms were designed with the intention of recovering files with | 1295 algorithms were designed with the intention of recovering files with |
1296 broken sync. | 1296 broken sync. |
1297 However, in some cases they can cause unnecessary skipping and duplication of | 1297 However, in some cases they can cause unnecessary skipping and duplication of |
1298 frames, and possibly slight A/V desync, when used with proper input. | 1298 frames, and possibly slight A/V desync, when used with proper input |
1299 (off course, A/V sync issues apply only if you process or copy the | |
1300 audio track while transcoding the video, which is strongly encouraged). | |
1299 Therefore, you may have to switch to basic A/V sync with | 1301 Therefore, you may have to switch to basic A/V sync with |
1300 the <option>-mc 0</option> option, or put this in your | 1302 the <option>-mc 0</option> option, or put this in your |
1301 <systemitem>~/.mplayer/mencoder</systemitem> config file, as long as | 1303 <systemitem>~/.mplayer/mencoder</systemitem> config file, as long as |
1302 you are only working with good sources (DVD, TV capture, high quality | 1304 you are only working with good sources (DVD, TV capture, high quality |
1303 MPEG-4 rips, etc) and not broken ASF/RM/MOV files. | 1305 MPEG-4 rips, etc) and not broken ASF/RM/MOV files. |
1358 sound so that more bits can be spent on the video. | 1360 sound so that more bits can be spent on the video. |
1359 Most people choose to compress audio with either MP3 or Vorbis audio | 1361 Most people choose to compress audio with either MP3 or Vorbis audio |
1360 codecs. | 1362 codecs. |
1361 While the latter is a very space-efficient codec, MP3 is better supported | 1363 While the latter is a very space-efficient codec, MP3 is better supported |
1362 by hardware players, although this trend is changing. | 1364 by hardware players, although this trend is changing. |
1365 </para> | |
1366 | |
1367 <para> | |
1368 Do <emphasis>not</emphasis> use <option>-nosound</option> when encoding | |
1369 a file with audio, even if you will be encoding and muxing audio | |
1370 separately later. | |
1371 Though it may work in ideal cases, using <option>-nosound</option> is | |
1372 likely to hide some problems in your encoding command line setting. | |
1373 In other words, having a soundtrack during your encode assures you that, | |
1374 provided you don't messages such as | |
1375 <quote>Too many audio packets in the buffer</quote>, you will be able | |
1376 to get proper sync. | |
1377 </para> | |
1378 | |
1379 <para> | |
1380 You need to have <application>MEncoder</application> process the sound. | |
1381 You can for example copy the orignal soundtrack during the encode with | |
1382 <option>-oac copy</option> or convert it to a "light" 4 kHz mono WAV | |
1383 PCM with <option>-oac pcm -channels 1 -srate 4000</option>. | |
1384 otherwise, in some cases, it will generate a video file that won't sync | |
1385 with the audio. | |
1386 Such cases are when the number of video frames in the source file do | |
1387 not match up to the total length of audio frames or whenever there | |
1388 are discontinuities/splices where there are missing or extra audio frames. | |
1389 The correct way to handle this kind of problem is to insert silence or | |
1390 cut audio at these points. | |
1391 However <application>MPlayer</application> cannot do that, so if you | |
1392 demux the AC3 and encode it with a separate app (or dump it to PCM with | |
1393 <application>MPlayer</application>), the splices will be left incorrect | |
1394 and the only way to correct them is to drop/dup video frames at the | |
1395 splice. | |
1396 As long as <application>MEncoder</application> sees the audio when it's | |
1397 encoding the video, it can do this dropping/duping (which is usually ok | |
1398 since it takes place at full black/scenechange, but if | |
1399 <application>MEncoder</application> can't see the audio, it will just | |
1400 process all frames as-is and they won't fit the final audio stream when | |
1401 you for example merge your audio and video track into a Matroska file. | |
1363 </para> | 1402 </para> |
1364 | 1403 |
1365 <para> | 1404 <para> |
1366 First of all, you will have to convert the DVD sound into a WAV file that the | 1405 First of all, you will have to convert the DVD sound into a WAV file that the |
1367 audio codec can use as input. | 1406 audio codec can use as input. |
1820 <option>-ofps 24000/1001</option>. Otherwise, <application>MEncoder</application> | 1859 <option>-ofps 24000/1001</option>. Otherwise, <application>MEncoder</application> |
1821 will try to encode at 30000/1001 fps and will duplicate frames. | 1860 will try to encode at 30000/1001 fps and will duplicate frames. |
1822 </para> | 1861 </para> |
1823 | 1862 |
1824 <para> | 1863 <para> |
1825 <screen>mencoder dvd://1 -nosound -ovc lavc -ofps 24000/1001</screen> | 1864 <screen>mencoder dvd://1 -avc copy -ovc lavc -ofps 24000/1001</screen> |
1826 </para> | 1865 </para> |
1827 | 1866 |
1828 <para> | 1867 <para> |
1829 It is often the case, however, that a video that looks progressive | 1868 It is often the case, however, that a video that looks progressive |
1830 actually has very short parts of telecine mixed in. Unless you are | 1869 actually has very short parts of telecine mixed in. Unless you are |
1869 using <option>mbd=2</option> is strongly recommended | 1908 using <option>mbd=2</option> is strongly recommended |
1870 <link linkend="menc-feat-telecine-footnotes">[2] </link> because it | 1909 <link linkend="menc-feat-telecine-footnotes">[2] </link> because it |
1871 will encode macroblocks as non-interlaced in places where there is | 1910 will encode macroblocks as non-interlaced in places where there is |
1872 no motion. Note that <option>-ofps</option> is NOT needed here. | 1911 no motion. Note that <option>-ofps</option> is NOT needed here. |
1873 | 1912 |
1874 <screen>mencoder dvd://1 -nosound -ovc lavc -lavcopts ildct:ilme:mbd=2</screen> | 1913 <screen>mencoder dvd://1 -avc copy -ovc lavc -lavcopts ildct:ilme:mbd=2</screen> |
1875 </para></listitem> | 1914 </para></listitem> |
1876 <listitem><para> | 1915 <listitem><para> |
1877 Use a deinterlacing filter before encoding. There are several of | 1916 Use a deinterlacing filter before encoding. There are several of |
1878 these filters available to choose from, each with its own advantages | 1917 these filters available to choose from, each with its own advantages |
1879 and disadvantages. Consult <option>mplayer -pphelp</option> to see | 1918 and disadvantages. Consult <option>mplayer -pphelp</option> to see |
1883 various filters. Again, the framerate is not changing, so no | 1922 various filters. Again, the framerate is not changing, so no |
1884 <option>-ofps</option>. Also, deinterlacing should be done after | 1923 <option>-ofps</option>. Also, deinterlacing should be done after |
1885 cropping <link linkend="menc-feat-telecine-footnotes">[1]</link> and | 1924 cropping <link linkend="menc-feat-telecine-footnotes">[1]</link> and |
1886 before scaling. | 1925 before scaling. |
1887 | 1926 |
1888 <screen>mencoder dvd://1 -nosound -vf pp=lb -ovc lavc</screen> | 1927 <screen>mencoder dvd://1 -avc copy -vf pp=lb -ovc lavc</screen> |
1889 </para></listitem> | 1928 </para></listitem> |
1890 <listitem><para> | 1929 <listitem><para> |
1891 Unfortunately, this option is buggy with | 1930 Unfortunately, this option is buggy with |
1892 <application>MEncoder</application>; it ought to work well with | 1931 <application>MEncoder</application>; it ought to work well with |
1893 <application>MEncoder G2</application>, but that is not here yet. You | 1932 <application>MEncoder G2</application>, but that is not here yet. You |
1908 <option>tfields</option> you | 1947 <option>tfields</option> you |
1909 <emphasis role="bold">have to</emphasis> specify both | 1948 <emphasis role="bold">have to</emphasis> specify both |
1910 <option>-fps</option> and <option>-ofps</option> to be twice the | 1949 <option>-fps</option> and <option>-ofps</option> to be twice the |
1911 framerate of your original source. | 1950 framerate of your original source. |
1912 | 1951 |
1913 <screen>mencoder dvd://1 -nosound -vf tfields=2 -ovc lavc -fps 60000/1001 -ofps 60000/1001</screen> | 1952 <screen>mencoder dvd://1 -avc copy -vf tfields=2 -ovc lavc -fps 60000/1001 -ofps 60000/1001</screen> |
1914 </para></listitem> | 1953 </para></listitem> |
1915 <listitem><para> | 1954 <listitem><para> |
1916 If you plan on downscaling dramatically, you can extract and encode | 1955 If you plan on downscaling dramatically, you can extract and encode |
1917 only one of the two fields. Of course, you will lose half the vertical | 1956 only one of the two fields. Of course, you will lose half the vertical |
1918 resolution, but if you plan on downscaling to at most 1/2 of the | 1957 resolution, but if you plan on downscaling to at most 1/2 of the |
1920 progressive 30000/1001 frames per second file. The procedure is to use | 1959 progressive 30000/1001 frames per second file. The procedure is to use |
1921 <option>-vf field</option>, then crop | 1960 <option>-vf field</option>, then crop |
1922 <link linkend="menc-feat-telecine-footnotes">[1]</link> and scale | 1961 <link linkend="menc-feat-telecine-footnotes">[1]</link> and scale |
1923 appropriately. Remember that you will have to adjust the scale to | 1962 appropriately. Remember that you will have to adjust the scale to |
1924 compensate for the vertical resolution being halved. | 1963 compensate for the vertical resolution being halved. |
1925 <screen>mencoder dvd://1 -nosound -vf field=0 -ovc lavc</screen> | 1964 <screen>mencoder dvd://1 -avc copy -vf field=0 -ovc lavc</screen> |
1926 </para></listitem> | 1965 </para></listitem> |
1927 </orderedlist> | 1966 </orderedlist> |
1928 </sect3> | 1967 </sect3> |
1929 | 1968 |
1930 <sect3 id="menc-feat-telecine-encode-mixedpt"> | 1969 <sect3 id="menc-feat-telecine-encode-mixedpt"> |
1951 else <application>MEncoder</application> will crash. | 1990 else <application>MEncoder</application> will crash. |
1952 <option>pullup</option> is, however, the cleanest and most | 1991 <option>pullup</option> is, however, the cleanest and most |
1953 accurate method available for encoding both telecine and | 1992 accurate method available for encoding both telecine and |
1954 "mixed progressive and telecine". | 1993 "mixed progressive and telecine". |
1955 | 1994 |
1956 <screen>mencoder dvd://1 -nosound -vf pullup,softskip -ovc lavc -ofps 24000/1001</screen> | 1995 <screen>mencoder dvd://1 -avc copy -vf pullup,softskip -ovc lavc -ofps 24000/1001</screen> |
1957 </para> | 1996 </para> |
1958 | 1997 |
1959 | 1998 |
1960 </listitem> | 1999 </listitem> |
1961 <listitem><para> | 2000 <listitem><para> |
1966 a video and makes the entire file telecined. If we follow | 2005 a video and makes the entire file telecined. If we follow |
1967 softpulldown with either <option>detc</option> or | 2006 softpulldown with either <option>detc</option> or |
1968 <option>ivtc</option>, the final result will be entirely | 2007 <option>ivtc</option>, the final result will be entirely |
1969 progressive. <option>-ofps 24000/1001</option> is needed. | 2008 progressive. <option>-ofps 24000/1001</option> is needed. |
1970 | 2009 |
1971 <screen>mencoder dvd://1 -nosound -vf softpulldown,ivtc=1 -ovc lavc -ofps 24000/1001</screen> | 2010 <screen>mencoder dvd://1 -avc copy -vf softpulldown,ivtc=1 -ovc lavc -ofps 24000/1001</screen> |
1972 </para> | 2011 </para> |
1973 </listitem> | 2012 </listitem> |
1974 | 2013 |
1975 <listitem><para> | 2014 <listitem><para> |
1976 I have not used <option>-vf filmdint</option> myself, but here is what | 2015 I have not used <option>-vf filmdint</option> myself, but here is what |