Modern video encoders can adjust to these needs as they go and vary the bitrate. In simple modes such as CBR, however, the encoders do not know the bitrate needs of future scenes and so cannot exceed the requested average bitrate for long stretches of time. More advanced modes, such as multipass encode, can take into account the statistics from previous passes; this fixes the problem mentioned above.
Most codecs which support ABR encode only support two pass encode while some others such as x , Xvid and libavcodec support multipass, which slightly improves quality at each pass, yet this improvement is no longer measurable nor noticeable after the 4th or so pass.
Therefore, in this section, two pass and multipass will be used interchangeably. In each of these modes, the video codec such as libavcodec breaks the video frame into 16x16 pixel macroblocks and then applies a quantizer to each macroblock. The lower the quantizer, the better the quality and higher the bitrate. The method the movie encoder uses to determine which quantizer to use for a given macroblock varies and is highly tunable. This is an extreme over-simplification of the actual process, but the basic concept is useful to understand.
When you specify a constant bitrate, the video codec will encode the video, discarding detail as much as necessary and as little as possible in order to remain lower than the given bitrate. If you truly do not care about file size, you could as well use CBR and specify a bitrate of infinity.
In practice, this means a value high enough so that it poses no limit, like Kbit. With no real restriction on bitrate, the result is that the codec will use the lowest possible quantizer for each macroblock as specified by vqmin for libavcodec , which is 2 by default.
As soon as you specify a low enough bitrate that the codec is forced to use a higher quantizer, then you are almost certainly ruining the quality of your video. In order to avoid that, you should probably downscale your video, according to the method described later on in this guide. In general, you should avoid CBR altogether if you care about quality. With constant quantizer, the codec uses the same quantizer, as specified by the vqscale option for libavcodec , on every macroblock.
The problem with constant quantizing is that it uses the given quantizer whether the macroblock needs it or not. That is, it might be possible to use a higher quantizer on a macroblock without sacrificing visual quality. Why waste the bits on an unnecessarily low quantizer? Your CPU has as many cycles as there is time, but there is only so many bits on your hard disk.
With a two pass encode, the first pass will rip the movie as though it were CBR, but it will keep a log of properties for each frame. This data is then used during the second pass in order to make intelligent decisions about which quantizers to use. During fast action or high detail scenes, higher quantizers will likely be used, and during slow moving or low detail scenes, lower quantizers will be used.
Normally, the amount of motion is much more important than the amount of detail. Since you are now convinced that two pass is the way to go, the real question now is what bitrate to use? The answer is that there is no single answer. Ideally you want to choose a bitrate that yields the best balance between quality and file size.
This is going to vary depending on the source video. If size does not matter, a good starting point for a very high quality rip is about Kbit plus or minus Kbit.
For fast action or high detail source video, or if you just have a very critical eye, you might decide on or For some DVDs, you might not notice a difference at Kbit.
It is a good idea to experiment with scenes at different bitrates to get a feel. If you aim at a certain size, you will have to somehow calculate the bitrate. But before that, you need to know how much space you should reserve for the audio track s , so you should rip those first. 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 file size, it is a bad idea to use dimensions that are not multiples of Most DVDs also have some degree of black borders at the edges.
Leaving these in place will hurt quality a lot in several ways. 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.
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 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. 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:. 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. Again, this problem only applies if black borders do not line up on multiple-of boundaries. 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. 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. Despite the borders being entirely black and never changing, there is at least a minimal amount of overhead involved in having more macroblocks.
For all of these reasons, it is recommended to fully crop black borders. 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. 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. When cropping, there are a few guidelines that must be followed to avoid damaging your movie. The normal YUV format, , stores chroma color information subsampled, i. Observe this diagram, where L indicates luma sampling points and C chroma. 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. 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. Many if not most widescreen DVDs are not strictly , and will be either 1. This means that there will be black bands in the video that will need to be cropped out.
MPlayer provides a crop detection filter that will determine the crop rectangle -vf cropdetect. Run MPlayer with -vf cropdetect 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.
Then, test the values you get with MPlayer , using the command line which was printed by cropdetect , and adjust the rectangle as needed. The rectangle 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. 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 dimensions, you will have to overcrop. Do not undercrop, since black borders are very bad for encoding! 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 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 to scale the video instead. We will look at this in our example below. You can actually let the cropdetect filter do all of the above for you, as it has an optional round parameter that is equal to 16 by default.
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. After all is said and done, you will probably end up with video whose pixels are not quite 1. You could calculate the new aspect ratio manually, but MEncoder offers an option for libavcodec called autoaspect 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. Note: experimental decoders can pose a security risk, do not use this for decoding untrusted input. This is useful if you want to analyze the content of a video and thus want everything to be decoded no matter what. This option will not result in a video that is pleasing to watch in case of errors.
Most useful in setting up a CBR encode. It is of little use elsewise. At present, those are H. Supported at present by AV1 decoders. Set the number of threads to be used, in case the selected codec implementation supports multi-threading. Set encoder codec profile. Encoder specific profiles are documented in the relevant encoder documentation.
Possible values:. Set to 1 to disable processing alpha transparency. Default is 0. Separator used to separate the fields printed on the command line about the Stream parameters. For example, to separate the fields with newlines and indentation:. Maximum number of pixels per image.
This value can be used to avoid out of memory failures due to large images. Enable cropping if cropping parameters are multiples of the required alignment for the left and top parameters. If the alignment is not met the cropping will be partially applied to maintain alignment. Default is 1 enabled. When you configure your FFmpeg build, all the supported native decoders are enabled by default.
Decoders requiring an external library must be enabled manually via the corresponding --enable-lib option. You can list all available decoders using the configure option --list-decoders. Requires the presence of the libdav1d headers and library during configuration. You need to explicitly configure the build with --enable-libdav1d.
Set amount of frame threads to use during decoding. The default value is 0 autodetect. Use the global option threads instead. Set amount of tile threads to use during decoding. Apply film grain to the decoded video if present in the bitstream. Defaults to the internal default of the library.
This option is deprecated and will be removed in the future. Select an operating point of a scalable AV1 bitstream 0 - Requires the presence of the libuavs3d headers and library during configuration. You need to explicitly configure the build with --enable-libuavs3d. Dynamic Range Scale Factor.
The factor to apply to dynamic range values from the AC-3 stream. This factor is applied exponentially. The default value is 1. There are 3 notable scale factor ranges:. DRC enabled. Applies a fraction of the stream DRC value. Audio reproduction is between full range and full compression.
Loud sounds are fully compressed. Soft sounds are enhanced. The lavc FLAC encoder used to produce buggy streams with high lpc values like the default value.
This decoder generates wave patterns according to predefined sequences. Its use is purely internal and the format of the data it accepts is not publicly documented. Requires the presence of the libcelt headers and library during configuration.
You need to explicitly configure the build with --enable-libcelt. Requires the presence of the libgsm headers and library during configuration. You need to explicitly configure the build with --enable-libgsm. Requires the presence of the libilbc headers and library during configuration. You need to explicitly configure the build with --enable-libilbc. Using it requires the presence of the libopencore-amrnb headers and library during configuration.
You need to explicitly configure the build with --enable-libopencore-amrnb. Using it requires the presence of the libopencore-amrwb headers and library during configuration. You need to explicitly configure the build with --enable-libopencore-amrwb. Requires the presence of the libopus headers and library during configuration. You need to explicitly configure the build with --enable-libopus. Sets the base path for the libaribb24 library. This is utilized for reading of configuration files for custom unicode conversions , and for dumping of non-text symbols as images under that location.
This codec decodes the bitmap subtitles used in DVDs; the same subtitles can also be found in VobSub file pairs and in some Matroska files. Specify the global palette used by the bitmaps. When stored in VobSub, the palette is normally specified in the index file; in Matroska, the palette is stored in the codec extra-data in the same format as in VobSub. The format for this option is a string containing 16 bits hexadecimal numbers without 0x prefix separated by commas, for example 0d00ee, eed, , eaeaea, 0ce60b, ec14ed, ebff0b, 0da, 7b7b7b, d1d1d1, 7b2a0e, 0dc, 0fb, cf0dec, cfa80c, 7cb.
Only decode subtitle entries marked as forced. Some titles have forced and non-forced subtitles in the same track. Setting this flag to 1 will only keep the forced subtitles. Default value is 0. Requires the presence of the libzvbi headers and library during configuration. You need to explicitly configure the build with --enable-libzvbi. List of teletext page numbers to decode. Pages that do not match the specified list are dropped.
Set default character set used for decoding, a value between 0 and 87 see ETS , Section 15, Table Default value is -1, which does not override the libzvbi default. This option is needed for some legacy level 1. The default format, you should use this for teletext pages, because certain graphics and colors cannot be expressed in simple text or even ASS.
Formatted ASS output, subtitle pages and teletext pages are returned in different styles, subtitle pages are stripped down to text, but an effort is made to keep the text alignment and the formatting. Chops leading and trailing spaces and removes empty lines from the generated text.
This option is useful for teletext based subtitles where empty spaces may be present at the start or at the end of the lines or empty lines may be present between the subtitle lines because of double-sized teletext characters. Default value is 1. Sets the display duration of the decoded teletext pages or subtitles in milliseconds. Default value is -1 which means infinity or until the next subtitle event comes. Force transparent background of the generated teletext bitmaps.
Default value is 0 which means an opaque background. Sets the opacity of the teletext background. When you configure your FFmpeg build, all the supported native encoders are enabled by default. Encoders requiring an external library must be enabled manually via the corresponding --enable-lib option.
You can list all available encoders using the configure option --list-encoders. Setting this automatically activates constant bit rate CBR mode. If this option is unspecified it is set to kbps. Set quality for variable bit rate VBR mode. This option is valid only using the ffmpeg command-line tool. Set cutoff frequency. If unspecified will allow the encoder to dynamically adjust the cutoff to improve clarity on low bitrates.
This method first sets quantizers depending on band thresholds and then tries to find an optimal combination by adding or subtracting a specific value from all quantizers and adjusting some individual quantizer a little. This is an experimental coder which currently produces a lower quality, is more unstable and is slower than the default twoloop coder but has potential. Not currently recommended.
Worse with low bitrates less than 64kbps , but is better and much faster at higher bitrates. Can be forced for all bands using the value "enable", which is mainly useful for debugging or disabled using "disable".
Sets intensity stereo coding tool usage. Can be disabled for debugging by setting the value to "disable". Uses perceptual noise substitution to replace low entropy high frequency bands with imperceptible white noise during the decoding process. Enables the use of a multitap FIR filter which spans through the high frequency bands to hide quantization noise during the encoding process and is reverted by the decoder. As well as decreasing unpleasant artifacts in the high range this also reduces the entropy in the high bands and allows for more bits to be used by the mid-low bands.
Enables the use of the long term prediction extension which increases coding efficiency in very low bandwidth situations such as encoding of voice or solo piano music by extending constant harmonic peaks in bands throughout frames. Use in conjunction with -ar to decrease the samplerate. Enables the use of a more traditional style of prediction where the spectral coefficients transmitted are replaced by the difference of the current coefficients minus the previous "predicted" coefficients.
In theory and sometimes in practice this can improve quality for low to mid bitrate audio. The default, AAC "Low-complexity" profile.
Is the most compatible and produces decent quality. Introduced in MPEG4. Introduced in MPEG2. This does not mean that one is always faster, just that one or the other may be better suited to a particular system.
The AC-3 metadata options are used to set parameters that describe the audio, but in most cases do not affect the audio encoding itself. Some of the options do directly affect or influence the decoding and playback of the resulting bitstream, while others are just for informational purposes.
A few of the options will add bits to the output stream that could otherwise be used for audio data, and will thus affect the quality of the output. Those will be indicated accordingly with a note in the option list below. Allow Per-Frame Metadata. Specifies if the encoder should check for changing metadata for each frame. Center Mix Level. The amount of gain the decoder should apply to the center channel when downmixing to stereo. This field will only be written to the bitstream if a center channel is present.
The value is specified as a scale factor. There are 3 valid values:. Surround Mix Level. The amount of gain the decoder should apply to the surround channel s when downmixing to stereo.
This field will only be written to the bitstream if one or more surround channels are present. Audio Production Information is optional information describing the mixing environment. Either none or both of the fields are written to the bitstream.
Mixing Level. Specifies peak sound pressure level SPL in the production environment when the mix was mastered. Valid values are 80 to , or -1 for unknown or not indicated. The default value is -1, but that value cannot be used if the Audio Production Information is written to the bitstream. Room Type. Describes the equalization used during the final mixing session at the studio or on the dubbing stage. A large room is a dubbing stage with the industry standard X-curve equalization; a small room has flat equalization.
Dialogue Normalization. This parameter determines a level shift during audio reproduction that sets the average volume of the dialogue to a preset level. The goal is to match volume level between program sources. A value of dB will result in no volume level change, relative to the source volume, during audio reproduction.
Valid values are whole numbers in the range to -1, with being the default. Dolby Surround Mode. Specifies whether the stereo signal uses Dolby Surround Pro Logic. This field will only be written to the bitstream if the audio stream is stereo. Original Bit Stream Indicator. Specifies whether this audio is from the original source and not a copy. It is grouped into 2 parts. If any one parameter in a group is specified, all values in that group will be written to the bitstream.
Default values are used for those that are written but have not been specified. Preferred Stereo Downmix Mode. Dolby Surround EX Mode. Indicates whether the stream uses Dolby Surround EX 7. Dolby Headphone Mode. Indicates whether the stream uses Dolby Headphone encoding multi-channel matrixed to 2. Stereo Rematrixing. This option is enabled by default, and it is highly recommended that it be left as enabled except for testing purposes.
Set lowpass cutoff frequency. If unspecified, the encoder selects a default determined by various other encoding parameters. These options are only valid for the floating-point encoder and do not exist for the fixed-point encoder due to the corresponding features not being implemented in fixed-point. The per-channel high frequency information is sent with less accuracy in both the frequency and time domains. This allows more bits to be used for lower frequencies while preserving enough information to reconstruct the high frequencies.
This option is enabled by default for the floating-point encoder and should generally be left as enabled except for testing purposes or to increase encoding speed. Coupling Start Band. Sets the channel coupling start band, from 1 to If a value higher than the bandwidth is used, it will be reduced to 1 less than the coupling end band.
If auto is used, the start band will be determined by the encoder based on the bit rate, sample rate, and channel layout. This option has no effect if channel coupling is disabled. Sets the compression level, which chooses defaults for many other options if they are not set explicitly. Valid values are from 0 to 12, 5 is the default. Chooses if rice parameters are calculated exactly or approximately.
Multi Dimensional Quantization. If set to 1 then a 2nd stage LPC algorithm is applied after the first stage to finetune the coefficients. This is quite slow and slightly improves compression. This is a native FFmpeg encoder for the Opus format. Currently its in development and only implements the CELT part of the codec. Its quality is usually worse and at best is equal to the libopus encoder.
XviD codec is mpeg-4 video codec. Xvid is an open-source research project focusing on video compression and is a collaborative development effort.
XviD is a open source project, which is developed and maintained by a handful of skilled and interested engineers from all over the world. This release is the long awaited 1.
0コメント