Index: en/mencoder.xml =================================================================== RCS file: /cvsroot/mplayer/main/DOCS/xml/en/mencoder.xml,v retrieving revision 1.85 diff -u -r1.85 mencoder.xml --- en/mencoder.xml 20 Jul 2005 07:59:20 -0000 1.85 +++ en/mencoder.xml 21 Jul 2005 21:21:22 -0000 @@ -53,36 +53,6 @@ - -Encoding to MPEG format - -MEncoder can create MPEG (MPEG-PS) format output -files. It is probably useful only with -libavcodec's -mpeg1video codec, because players - except -MPlayer - expect MPEG-1 video, and MPEG-1 layer 2 (MP2) -audio streams in MPEG files. - - - -This feature is not very useful right now, aside that it probably has many bugs, -but the more importantly because MEncoder currently -cannot encode MPEG-1 layer 2 (MP2) audio, which all other players expect in MPEG files. - - - -To change MEncoder's output file format, -use the option. - - - -Example: - -mencoder -of mpeg -ovc lavc -lavcopts vcodec=mpeg1video -oac copy other_options media.avi -o output.mpg - - - - Rescaling movies @@ -140,86 +110,6 @@ - -Encoding with the <systemitem class="library">libavcodec</systemitem> - codec family - - -libavcodec -provides simple encoding to a lot of interesting video and audio formats. -You can encode to the following codecs (more or less up to date): - - - - -Codec nameDescription - - -mjpeg - Motion JPEG - -ljpeg - Lossless JPEG - -h263 - H.263 - -h263p - H.263+ - -mpeg4 - ISO standard MPEG-4 (DivX 5, XVID compatible) - -msmpeg4 - pre-standard MPEG-4 variant by MS, v3 (AKA DivX3) - -msmpeg4v2 - pre-standard MPEG-4 by MS, v2 (used in old asf files) - -wmv1 - Windows Media Video, version 1 (AKA WMV7) - -wmv2 - Windows Media Video, version 2 (AKA WMV8) - -rv10 - an old RealVideo codec - -mpeg1video - MPEG-1 video - -mpeg2video - MPEG-2 video - -huffyuv - lossless compression - -asv1 - ASUS Video v1 - -asv2 - ASUS Video v2 - -ffv1 - FFmpeg's lossless video codec - - - - - -The first column contains the codec names that should be passed after the -vcodec config, like: - - - - -An example, with MJPEG compression: -mencoder dvd://2 -o title2.avi -ovc lavc -lavcopts vcodec=mjpeg -oac copy - - - - - Encoding from multiple input image files (JPEG, PNG, TGA, SGI) @@ -410,72 +300,6 @@ -Custom inter/intra matrices - - -With this feature of -libavcodec -you are able to set custom inter (I-frames/keyframes) and intra -(P-frames/predicted frames) matrices. It is supported by many of the codecs: -mpeg1video and mpeg2video -are reported as working. - - - -A typical usage of this feature is to set the matrices preferred by the -KVCD specifications. - - - -The KVCD "Notch" Quantization Matrix: - - - -Intra: - - 8 9 12 22 26 27 29 34 - 9 10 14 26 27 29 34 37 -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 29 34 37 38 40 48 58 -29 34 37 38 40 48 58 69 -34 37 38 40 48 58 69 79 - - -Inter: - -16 18 20 22 24 26 28 30 -18 20 22 24 26 28 30 32 -20 22 24 26 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 36 38 40 -28 30 32 34 36 38 42 42 -30 32 34 36 38 40 42 44 - - - - -Usage: - -$ mencoder input.avi -o output.avi -oac copy -ovc lavc -lavcopts inter_matrix=...:intra_matrix=... - - - - - -$ mencoder input.avi -ovc lavc -lavcopts -vcodec=mpeg2video:intra_matrix=8,9,12,22,26,27,29,34,9,10,14,26,27,29,34,37, -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, -29,34,37,38,40,48,58,29,34,37,38,40,48,58,69,34,37,38,40,48,58,69,79 -:inter_matrix=16,18,20,22,24,26,28,30,18,20,22,24,26,28,30,32,20,22,24,26, -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, -36,38,40,28,30,32,34,36,38,42,42,30,32,34,36,38,40,42,44 -oac copy -o svcd.mpg - - - - Making a high quality MPEG-4 ("DivX") rip of a DVD movie @@ -1688,49 +1512,267 @@ - -Encoding options of libavcodec + +Muxing - Ideally, you would probably want to be able to just tell the encoder to switch - into "high quality" mode and move on. - That would probably be nice, but unfortunately hard to implement as different - encoding options yield different quality results depending on the source material. - That is because compression depends on the visual properties of the video - in question. - For example, anime and live action have very different properties and - thus require different options to obtain optimum encoding. - The good news is that some options should never be left out, like - , , and . - See below for a detailed description of common encoding options. + Now that you have encoded your video, you will most likely want + to mux it with one or more audio tracks into a movie container, such + as AVI, MPEG, Matroska or NUT. + MEncoder is currently only able to output + audio and video into MPEG and AVI container formats. + for example: + mencoder -oac copy -ovc copy -o output_movie.avi -audiofile input_audio.mp2 input_video.avi + This would merge the video file input_video.avi + and the audio file input_audio.mp2 + into the AVI file output_movie.avi. + This command works with MPEG-1 layer I, II and III (more commonly known + as MP3) audio, WAV and a few other audio formats too. + + MEncoder features experimental support for + libavformat, which is a + library from the FFmpeg project that supports muxing and demuxing + a variety of containers. + For example: + mencoder -oac copy -ovc copy -o output_movie.asf -audiofile input_audio.mp2 input_video.avi -of lavf -lavfopts format=asf + This will do the same thing as the previous example, except that + the output container will be ASF. + Please note that this support is highly experimental (but getting + better every day), and will only work if you compiled + MPlayer with the support for + libavformat enabled (which + means that a pre-packaged binary version will not work in most cases). + - -Options to adjust: - - vmax_b_frames: 1 or 2 is good, depending on - the movie. - Note that if you need to have your encode be decodable by DivX5, you - need to activate closed GOP support, using - libavcodec's - option, but you need to deactivate scene detection, which - is not a good idea as it will hurt encode efficiency a bit. - + +Limitations of the AVI container + + Although it is the most widely-supported container format after MPEG-1, + AVI also has some major drawbacks. + Perhaps the most obvious is the overhead. + For each chunk of the AVI file, 24 bytes are wasted on headers and + index. + This translates into a little over 5 MB per hour, or 1-2.5% + overhead for a 700 MB movie. This may not seem like much, but it could + mean the difference between being able to use 700 kbit/sec video or + 714 kbit/sec, and every bit of quality counts. + - - vb_strategy=1: helps in high-motion scenes. - Requires vmax_b_frames >= 2. - On some videos, vmax_b_frames may hurt quality, but vmax_b_frames=2 along - with vb_strategy=1 helps. - + + In addition this gross inefficiency, AVI also has the following major + limitations: + - - dia: motion search range. Bigger is better - and slower. - Negative values are a completely different scale. - Good values are -1 for a fast encode, or 2-4 for slower. - + + + + Only fixed-fps content can be stored. This is particularly limiting + if the original material you want to encode is mixed content, for + example a mix of NTSC video and film material. + Actually there are hacks that can be used to store mixed-framerate + content in AVI, but they increase the (already huge) overhead + fivefold or more and so are not practical. + + + + + Audio in AVI files must be either constant-bitrate (CBR) or + constant-framesize (i.e. all frames decode to the same number of + samples). + Unfortunately, the most efficient codec, Vorbis, does not meet + either of these requirements. + Therefore, if you plan to store your movie in AVI, you will have to + use a less efficient codec such as MP3 or AC3. + + + + + + Having said all that, MEncoder does not + currently support variable-fps output or Vorbis encoding. + Therefore, you may not see these as limitations if + MEncoder is the + only tool you will be using to produce your encodes. + However, it is possible to use MEncoder + only for video encoding, and then use external tools to encode + audio and mux it into another container format. + + + + +Muxing into the Matroska container + + Matroska is a free, open standard container format, aiming + to offer a lot of advanced features, which older containers + like AVI cannot handle. + For example, Matroska supports variable bitrate audio content + (VBR), variable framerates (VFR), chapters, file attachments, + error detection code (EDC) and modern A/V Codecs like "Advanced Audio + Coding" (AAC), "Vorbis" or "MPEG-4 AVC" (H.264), next to nothing + handled by AVI. + + + + The tools required to create Matroska files are collectively called + mkvtoolnix, and are available for most + Unix platforms as well as Windows. + Because Matroska is an open standard you may find other + tools that suit you better, but since mkvtoolnix is the most + common, and is supported by the Matroska team itself, we will + only cover its usage. + + + + Probably the easiest way to get started with Matroska is to use + MMG, the graphical frontend shipped with + mkvtoolnix, and follow the + guide to mkvmerge GUI (mmg) + + + + You may also mux audio and video files using the command line: + mkvmerge -o output.mkv input_video.avi input_audio1.mp3 input_audio2.ac3 + This would merge the video file input_video.avi + and the two audio files input_audio1.mp3 + and input_audio2.ac3 into the Matroska + file output.mkv. + Matroska, as mentioned earlier, is able to do much more than that, like + multiple audio tracks (including fine-tuning of audio/video + synchronization), chapters, subtitles, splitting, etc... + Please refer to the documentation of those applications for + more details. + + + + + + + + + + +Encoding with the <systemitem class="library">libavcodec</systemitem> + codec family + + +libavcodec +provides simple encoding to a lot of interesting video and audio formats. +You can encode to the following codecs (more or less up to date): + + + + +Codec nameDescription + + +mjpeg + Motion JPEG + +ljpeg + Lossless JPEG + +h263 + H.263 + +h263p + H.263+ + +mpeg4 + ISO standard MPEG-4 (DivX 5, XVID compatible) + +msmpeg4 + pre-standard MPEG-4 variant by MS, v3 (AKA DivX3) + +msmpeg4v2 + pre-standard MPEG-4 by MS, v2 (used in old asf files) + +wmv1 + Windows Media Video, version 1 (AKA WMV7) + +wmv2 + Windows Media Video, version 2 (AKA WMV8) + +rv10 + an old RealVideo codec + +mpeg1video + MPEG-1 video + +mpeg2video + MPEG-2 video + +huffyuv + lossless compression + +asv1 + ASUS Video v1 + +asv2 + ASUS Video v2 + +ffv1 + FFmpeg's lossless video codec + + + + + +The first column contains the codec names that should be passed after the +vcodec config, like: + + + + +An example, with MJPEG compression: +mencoder dvd://2 -o title2.avi -ovc lavc -lavcopts vcodec=mjpeg -oac copy + + + + +Encoding options of libavcodec + + + Ideally, you would probably want to be able to just tell the encoder to switch + into "high quality" mode and move on. + That would probably be nice, but unfortunately hard to implement as different + encoding options yield different quality results depending on the source material. + That is because compression depends on the visual properties of the video + in question. + For example, anime and live action have very different properties and + thus require different options to obtain optimum encoding. + The good news is that some options should never be left out, like + , , and . + See below for a detailed description of common encoding options. + + + + +Options to adjust: + + vmax_b_frames: 1 or 2 is good, depending on + the movie. + Note that if you need to have your encode be decodable by DivX5, you + need to activate closed GOP support, using + libavcodec's + option, but you need to deactivate scene detection, which + is not a good idea as it will hurt encode efficiency a bit. + + + + vb_strategy=1: helps in high-motion scenes. + Requires vmax_b_frames >= 2. + On some videos, vmax_b_frames may hurt quality, but vmax_b_frames=2 along + with vb_strategy=1 helps. + + + + dia: motion search range. Bigger is better + and slower. + Negative values are a completely different scale. + Good values are -1 for a fast encode, or 2-4 for slower. + predia: motion search pre-pass. @@ -1975,140 +2017,100 @@ - -Muxing + +Encoding to MPEG format - Now that you have encoded your video, you will most likely want - to mux it with one or more audio tracks into a movie container, such - as AVI, MPEG, Matroska or NUT. - MEncoder is currently only able to output - audio and video into MPEG and AVI container formats. - for example: - mencoder -oac copy -ovc copy -o output_movie.avi -audiofile input_audio.mp2 input_video.avi - This would merge the video file input_video.avi - and the audio file input_audio.mp2 - into the AVI file output_movie.avi. - This command works with MPEG-1 layer I, II and III (more commonly known - as MP3) audio, WAV and a few other audio formats too. +MEncoder can create MPEG (MPEG-PS) format output +files. It is probably useful only with +libavcodec's +mpeg1video codec, because players - except +MPlayer - expect MPEG-1 video, and MPEG-1 layer 2 (MP2) +audio streams in MPEG files. - MEncoder features experimental support for - libavformat, which is a - library from the FFmpeg project that supports muxing and demuxing - a variety of containers. - For example: - mencoder -oac copy -ovc copy -o output_movie.asf -audiofile input_audio.mp2 input_video.avi -of lavf -lavfopts format=asf - This will do the same thing as the previous example, except that - the output container will be ASF. - Please note that this support is highly experimental (but getting - better every day), and will only work if you compiled - MPlayer with the support for - libavformat enabled (which - means that a pre-packaged binary version will not work in most cases). +This feature is not very useful right now, aside that it probably has many bugs, +but the more importantly because MEncoder currently +cannot encode MPEG-1 layer 2 (MP2) audio, which all other players expect in MPEG files. - -Limitations of the AVI container - Although it is the most widely-supported container format after MPEG-1, - AVI also has some major drawbacks. - Perhaps the most obvious is the overhead. - For each chunk of the AVI file, 24 bytes are wasted on headers and - index. - This translates into a little over 5 MB per hour, or 1-2.5% - overhead for a 700 MB movie. This may not seem like much, but it could - mean the difference between being able to use 700 kbit/sec video or - 714 kbit/sec, and every bit of quality counts. +To change MEncoder's output file format, +use the option. - In addition this gross inefficiency, AVI also has the following major - limitations: +Example: + +mencoder -of mpeg -ovc lavc -lavcopts vcodec=mpeg1video -oac copy other_options media.avi -o output.mpg + + + +Custom inter/intra matrices - - - - Only fixed-fps content can be stored. This is particularly limiting - if the original material you want to encode is mixed content, for - example a mix of NTSC video and film material. - Actually there are hacks that can be used to store mixed-framerate - content in AVI, but they increase the (already huge) overhead - fivefold or more and so are not practical. - - - - Audio in AVI files must be either constant-bitrate (CBR) or - constant-framesize (i.e. all frames decode to the same number of - samples). - Unfortunately, the most efficient codec, Vorbis, does not meet - either of these requirements. - Therefore, if you plan to store your movie in AVI, you will have to - use a less efficient codec such as MP3 or AC3. +With this feature of +libavcodec +you are able to set custom inter (I-frames/keyframes) and intra +(P-frames/predicted frames) matrices. It is supported by many of the codecs: +mpeg1video and mpeg2video +are reported as working. - - - Having said all that, MEncoder does not - currently support variable-fps output or Vorbis encoding. - Therefore, you may not see these as limitations if - MEncoder is the - only tool you will be using to produce your encodes. - However, it is possible to use MEncoder - only for video encoding, and then use external tools to encode - audio and mux it into another container format. +A typical usage of this feature is to set the matrices preferred by the +KVCD specifications. - - -Muxing into the Matroska container - Matroska is a free, open standard container format, aiming - to offer a lot of advanced features, which older containers - like AVI cannot handle. - For example, Matroska supports variable bitrate audio content - (VBR), variable framerates (VFR), chapters, file attachments, - error detection code (EDC) and modern A/V Codecs like "Advanced Audio - Coding" (AAC), "Vorbis" or "MPEG-4 AVC" (H.264), next to nothing - handled by AVI. +The KVCD "Notch" Quantization Matrix: - The tools required to create Matroska files are collectively called - mkvtoolnix, and are available for most - Unix platforms as well as Windows. - Because Matroska is an open standard you may find other - tools that suit you better, but since mkvtoolnix is the most - common, and is supported by the Matroska team itself, we will - only cover its usage. +Intra: + + 8 9 12 22 26 27 29 34 + 9 10 14 26 27 29 34 37 +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 29 34 37 38 40 48 58 +29 34 37 38 40 48 58 69 +34 37 38 40 48 58 69 79 + + +Inter: + +16 18 20 22 24 26 28 30 +18 20 22 24 26 28 30 32 +20 22 24 26 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 36 38 40 +28 30 32 34 36 38 42 42 +30 32 34 36 38 40 42 44 + - Probably the easiest way to get started with Matroska is to use - MMG, the graphical frontend shipped with - mkvtoolnix, and follow the - guide to mkvmerge GUI (mmg) +Usage: + +$ mencoder input.avi -o output.avi -oac copy -ovc lavc -lavcopts inter_matrix=...:intra_matrix=... + - You may also mux audio and video files using the command line: - mkvmerge -o output.mkv input_video.avi input_audio1.mp3 input_audio2.ac3 - This would merge the video file input_video.avi - and the two audio files input_audio1.mp3 - and input_audio2.ac3 into the Matroska - file output.mkv. - Matroska, as mentioned earlier, is able to do much more than that, like - multiple audio tracks (including fine-tuning of audio/video - synchronization), chapters, subtitles, splitting, etc... - Please refer to the documentation of those applications for - more details. + +$ mencoder input.avi -ovc lavc -lavcopts +vcodec=mpeg2video:intra_matrix=8,9,12,22,26,27,29,34,9,10,14,26,27,29,34,37, +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, +29,34,37,38,40,48,58,29,34,37,38,40,48,58,69,34,37,38,40,48,58,69,79 +:inter_matrix=16,18,20,22,24,26,28,30,18,20,22,24,26,28,30,32,20,22,24,26, +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, +36,38,40,28,30,32,34,36,38,42,42,30,32,34,36,38,40,42,44 -oac copy -o svcd.mpg + - - -