3

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?

1 Answer 1

5

ffmpeg example

tl;dr: The important options are -preset slow and -crf 20:

ffmpeg -i input -c:v libx264 -preset slow -crf 20 -vf format=yuv420p -c:a aac -ac 2 -movflags +faststart output.mp4

The other options are to ensure compatibility.


How to find out what Vimeo uses

1. Download video using youtube-dl:

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

2. Get encoding info

Assuming x264 is used to encode, and the encoding settings weren't stripped out, you can see what version was used and view the encoding settings.

Using mediainfo

Refer to the "Encoding settings" line.

mediainfo input.mp4

Using strings (Linux or macOS)

strings input.mp4 | grep x264

Example output

x264 - core 157 r10 d4099dd - H.264/MPEG-4 AVC codec - Copyleft 2003-2019 - http://www.videolan.org/x264.html - options: cabac=1 ref=5 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=8 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=2 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=34 lookahead_threads=5 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 stitchable=1 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=2 b_bias=0 direct=3 weightb=1 open_gop=0 weightp=2 keyint=infinite keyint_min=23 scenecut=40 intra_refresh=0 rc_lookahead=50 rc=crf mbtree=1 crf=20.0 qcomp=0.60 qpmin=5 qpmax=69 qpstep=4 vbv_maxrate=5500 vbv_bufsize=15000 crf_max=0.0 nal_hrd=none filler=0 ip_ratio=1.40 aq=1:1.00

  • This shows that -preset slow and -crf 20 were used. The options are set by -preset, so there is no need to manually attempt to set each option.

  • VBV is enabled for streaming. In ffmpeg this is set with -maxrate 5500k and -bufsize 15000k. I just used the values shown in the encoding settings above.

  • Thanks to Vimeo for not stripping the SEI (they certainly could have like YouTube) and allowing us to see what they used. Perhaps they wanted to show that they appreciate the open source tools they use.

Also see

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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