2

I like Vimeo, but I rather host a player and video myself. So I was wondering if someone knows how to get the closest result to Vimeo quality, but from FFMPEG?

It seems that Vimeo uses 1280 pixels width for it's HD videos, but I'm wondering if there are presets or settings out in the wild that can specify bitrate, quality etc for FFMPEG?

3

Download

Assuming the downloaded video is the same as the one you'd watch in your browser:

$ youtube-dl https://vimeo.com/123456789

strings & grep

Assuming x264 is used to encode, and the encoding settings weren't stripped out, you can see what version was used and view some of the particular settings. However, it does not mean that you should attempt to emulate everything verbatim.

$ strings input.mp4 | grep x264
x264 - core 144 r11 40bb568 - H.264/MPEG-4 AVC codec - Copyleft
2003-2014 - http://www.videolan.org/x264.html - options: cabac=1 ref=3
deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00
mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 
deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=72
lookahead_threads=8 sliced_threads=0 nr=0 decimate=1 interlaced=0
bluray_compat=0 stitchable=1 constrained_intra=0 bframes=3 b_pyramid=2
b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2
keyint=infinite keyint_min=25 scenecut=40 intra_refresh=0
rc_lookahead=40 rc=crf mbtree=1 crf=20.0 qcomp=0.60 qpmin=5 qpmax=69
qpstep=4 vbv_maxrate=4950 vbv_bufsize=13500 crf_max=0.0 nal_hrd=none
filler=0 ip_ratio=1.40 aq=1:1.00
  • It seems as if some (older?) videos have been stripped of this info.

  • Some videos seem to use 2pass rate control and others seem to use crf. I'm guessing the crf method is their current one. Both methods are using VBV (in ffmpeg this is set with -maxrate and -bufsize) but that doesn't mean you need to.

  • Looks like the medium preset was used, but there is no reason for you to use the same exact preset. If you have the patience for a slower preset, then use a slower preset.

  • You can see some additional info about the video stream, audio stream, and container format with: ffprobe -v error -show_format -show_streams input.mp4.

Encoding example

There is no need to overcomplicate things, so for simplicity, and "to get the closest result to Vimeo quality", just use -crf 20 with the slowest -preset that you have patience for. Or even better, use the highest crf value that still looks good to you.

This example is assuming your build supports the AAC audio encoder libfdk_aac. If not then you can use the native FFmpeg AAC encoder: -c:a aac -strict experimental -b:a 192k.

ffmpeg -i input -c:v libx264 -preset slower -crf 20 -c:a libfdk_aac -vbr 4 \
-ac 2 -movflags +faststart output.mp4

Also see

  • As always +1 for this very nice answer LordNeckbeard! – p2or Mar 27 '15 at 10:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.