20 May, 2009

FFmpeg Ninja Moves - part 4

Maintaining video quality during conversion can be a primary concern when converting to an alternative format while maintaining the necessary video quality.

By default, the output codec will utilize a default set of encoder quality specifiers. You can override these values by specifying -sameq, -qmin, -qmax or -qscale factors.

The -sameq specifier tells FFMpeg to maintain the same video quality as the source video file.

$ ffmpeg -i /tmp/video.avi -sameq /tmp/video.mpg


The qmin and qmax specifiers constrain the q-factors to a user-specified range. This applies to variable bit rate output streams. Specifying a narrow range will ensure consistent quality. Specifying a highly constrained, high quality factor will give you a good quality output video.

$ ffmpeg -i /tmp/video.avi -qmin 1 -qmax 1 /tmp/video.mpg


Constraining the scale factor to a single numeric can be alternatively done by specifying -qscale as follows.

$ ffmpeg -i /tmp/video.avi -qscale 1 /tmp/video.mpg


Note, the lower the value the higher the video quality.

No comments: