[FFmpeg-user] formula for transcoding to ogv, shrinking an mkv

Tom Evans tevans.uk at googlemail.com
Fri Jan 18 17:56:12 CET 2013


On Fri, Jan 18, 2013 at 4:17 PM, James Miller <gajs-f0el at dea.spamcon.org> wrote:
> As stated in my initial posting, I need to upload my screencasts to a site
> that has fairly low upload limits. So my files need to be around 100 MB,
> give or take. This is the reason why I am trying to transcode and shrink the
> lossless screencast files I record. The upload site seems to deal best with
> .ogv files.
>
>
>> Experiment with the crf option until you find a quality level you are
>> happy with. A higher crf will result in a lower quality, lower bitrate
>> file, a lower crf will increase the quality and bitrate.
>
>
> Now I'm getting confused: someone else seemed to be saying (if I understood
> him correctly) that I should not be using the -crf option when I transcode.
>

So, *iff* you have a target file size, you can easily calculate a
bitrate, and then do a 2-pass encoding with that target bitrate. This
will produce a file of exactly your size limit.

Alternatively, you can encode with a crf and no target bitrate. This
will produce you a file of known quality, but unknown size. The size
will depend on the bitrate required to produce the quality requested.
Adjust the crf until the end size is below your limit.

If you then compare the two files, they will be very similar quality -
the one produced by crf will have a slightly lower bitrate than the
2-pass encode - which should be obvious, the crf encoded file is less
than your size limit, the 2-pass encoded file is your size limit, and
the two have the same length video! - and, since the bitrates are
probably quite similar, the quality should also be similar.

If all your videos are roughly of similar lengths and content, you
should be able to choose a CRF that produces good results, and  always
under the size limit, where as by calculating and using a target
bitrate, the file size will always be your maximum/target file size,
and quality will vary depending upon length of the video.

I guess you could look at it as "what failure mode is preferred". If
you encode for a target file size, and your source file is
unexpectedly long, the failure mode would be (silently) producing and
submitting a video with too poor quality. If you encode for a target
CRF, and your source file is unexpectedly long, then the failure mode
would be failing to upload a video of the right quality.

You pays your money, you takes your choice :)

Cheers

Tom


More information about the ffmpeg-user mailing list