2

I'm learning how to use ffmpeg to stabilize some footage I shot at a conference (my setup had a nasty wobble and I didn't realise how bad it was until I started editing).

After trial and error I finally had great results with ffmpeg with the vidstab option and I'm about to process some longer clips (over an hour each) and just want to check I'm using the optimal settings (for close to visually lossless quality and speed balance)...

Below are the commands I'm using:

ffmpeg -i filename.MP4 -vf vidstabdetect=stepsize=32:shakiness=7:accuracy=10:result=transform_vectors.trf -f null -

and then:

ffmpeg -i filename.MP4 -vf vidstabtransform=input=transform_vectors.trf:zoom=0:smoothing=10,unsharp=5:5:0.8:3:3:0.4 -c:v libx264 -preset slow -crf 18 -c:a copy Output.MP4

Questions:

  1. Does -preset slow vs -preset medium make much of a difference in quality at -crf18?
  2. What is the fastest codec to output / encode to in this situation? At the moment I'm using h.264 (file sizes are good).

Note: ffmpeg with vidstab is much better than the other options I tried like Deshake, Pr/Ae Warp stabilizer, Blender, ...

  • I would expect that you can reduce settings for shakiness and qrf but want to increase smoothing. However, without sample footage this is difficult to say. Here is what I'm using. – Christian Lindig May 27 at 12:44
  • Just a follow up comment that I ended up leaving it on -preset medium and to stabilize a 1 hour clip on my system took less than an hour which was great, approx. 45mins – Dan Jun 5 at 6:47
2

Ad 1:

Presets have (almost) no impact to the quality - their purpose is for adjusting the trade-off of encoding time for the output size (the longer encoding time, the smaller the output stream).

Different presets enable / disable separate algorithms for compression. For example, in my installation, the -preset ultrafast is equivalent to options

--no-8x8dct --aq-mode 0 --b-adapt 0
--bframes 0 --no-cabac --no-deblock
--no-mbtree --me dia --no-mixed-refs
--partitions none --rc-lookahead 0 --ref 1
--scenecut 0 --subme 0 --trellis 0
--no-weightb --weightp 0

As you can see, almost no optimization, i. e. the output will be very large.


Ad 2:

H.264, aka MPEG-4 Part 10, aka Advanced Video Coding (AVC) is good enough, and its particular implementation - x264 library - is a very good one.

The pervasive rule is again the same:

Recent video compression standards are able to reach a little better compression than their predecessors, but for longer encoding time (and sometimes for lesser compatibility with media players, too).

So if you don't need cutting-edge compression, every contemporary compression standard is good enough.

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.