📄 encoding-guide.txt
字号:
Topics:I. Preparing to encode 1. Identifying source material and framerate 2. Selecting the quality you want 3. Constraints for efficient encoding 4. Cropping and scaling 5. Choosing resolution and bitrateII. Containers and codecs 1. Where the movie will be played 2. Constraints of DVD, SVCD, and VCD 3. Limitations of AVI containerIII. Basic MEncoder usage 1. Selecting codecs & format 2. Selecting input file or device 3. Loading video filters 4. Notes on A/V syncIV. Encoding procedures 1. Encoding progressive video 2. Two-pass encoding 3. Encoding interlaced video 4. Deinterlacing 5. Inverse telecine 6. Capturing TV input 7. Dealing with mixed-source content 8. Low-quality & damaged sourcesV. Optimizing encoding quality 1. Noise removal 2. Pure quality-gain options 3. Questionable-gain options 4. Advanced MPEG-4 featuresII. Containers and codecsII.1. Where the movie will be playedPerhaps the most important factor to choosing the format in which youwill encode your movie is where you want to be able to play it.Usually this involves a tradeoff between quality and features, sincethe formats supported by the widest variety of players are also theworst in regards to compression.If you want to be able to play your encode on standalone/set-topplayers, your primary choices are DVD, VCD, and SVCD. There are alsoextensions such as KVCD and XVCD which violate the standards but workon many players and deliver higher quality. Modern players arebeginning to support MPEG-4 ("DivX") movies in AVI and perhaps othercontainers as well, but these are often buggy and require you torestrict your encodes to certain subsets of the full MPEG-4functionality.If you wish to be able to share your movies with Windows or Macintoshusers, without them having to install additional software, yourchoices are very limited. The ancient MPEG-1 format with MP2 or PCMaudio is probably the only choice that is universally supported.Interoperability with Windows/Mac also comes into play when decidinghow to encode and whether to scale to preserve aspect, since popularmedia player applications for these systems do not honor the aspectratio encoding stored in MPEG-4 avi files.IV.2. Two-pass encodingThe complexity (and thus the number of bits) required to compress theframes of a movie can vary greatly from one scene to another. Modernvideo encoders can adjust to these needs as they go and vary thebitrate. However, they cannot exceed the requested average bitrate forlong stretches of time, because they do not know the bitrate needs offuture scenes.Two-pass encoding solves this problem by encoding the movie twice.During the first pass, statistics are generated regarding the numberof bits used by each frame and the quantization level (quality) atwhich it was encoded. Then, when the second pass begins, the encoderreads these statistics and redistributes the bits from frames wherethey are in excess to frames that are suffering from low quality.In order for the process to work properly, the encoder should be givenexactly the same sequence of frames during both passes. This meansthat the same filters must be used, the same encoder parameters mustbe used (with the possible exception of bitrate), and the same framedrops and duplications (if any) must take place.In theory it's possible to use -oac pcm or -oac copy during the firstpass to avoid spending time encoding the audio. However, this canresult in slight variations in which frames get dropped or duplicated,so it may be preferable to encode the audio during the first pass aswell as the second. This also allows you to examine the final audiobitrate and filesize, and to adjust the audio or video bitrateslightly between passes if you don't meet your target size.Here is an example: Encoding from an existing AVI file 500 kbit/sec MPEG-4 video 96 kbit/sec average-bitrate MP3 audio mencoder bar.avi -vf scale=448:336 -mc 0 -oac mp3lame -lameopts \ abr:br=96 -ovc lavc -lavcopts vcodec=mpeg4:vbitrate=500:vpass=1 mencoder bar.avi -vf scale=448:336 -mc 0 -oac mp3lame -lameopts \ abr:br=96 -ovc lavc -lavcopts vcodec=mpeg4:vbitrate=500:vpass=2If you do not want to overwrite the output from the first pass whenyou begin the second, you can use the -o option to choose a differentoutput filename. Note the addition of the vpass option in thisexample. If vpass is not specified, single-pass encoding is performed.If vpass=1, a log file is written with statistics from the first pass.If vpass=2, the log file is read and the second pass is encoded basedon those statistics. If you are short on disk space or don't want theextra disk wear from writing the file twice, you can use -o /dev/nullduring the first pass. However, sometimes it is beneficial to watchthe first-pass file before beginning the second pass to make surenothing went wrong in the encoding.Next, an example using XviD instead of libavcodec: Encoding from an existing AVI file 500 kbit/sec MPEG-4 video Copying the existing audio stream unmodified mencoder foo.avi -vf scale=320:240 -mc 0 -oac copy -ovc xvid \ -xvidencopts bitrate=400:pass=1 mencoder foo.avi -vf scale=320:240 -mc 0 -oac copy -ovc xvid \ -xvidencopts bitrate=400:pass=2The options used are slightly different, but the process is otherwisethe same.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -