Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Running this command

ffmpeg -i a.mp4 -tune b c.mp4

reveals the possible tune values for x264 and in turn FFmpeg

[libx264 @ 0000000002167100] Possible tunes: film animation grain stillimage 
                                             psnr ssim fastdecode zerolatency

However I could not find a reference explaining what these values actually do.

share|improve this question

1 Answer 1

up vote 16 down vote accepted

This is what the modes do:

  • film – intended for high-bitrate/high-quality movie content. Lower deblocking is used here.
  • animation – intended for cartoons, etc., where deblocking is boosted to compensate for larger, flat areas. More reference frames are used.
  • grain – this should be used for material that is already grainy. Here, the grain won't be filtered out as much.
  • stillimage – like the name says, it optimizes for still image encoding by lowering the deblocking filter.
  • psnr and ssim – these are debugging modes to optimize for good PSNR and SSIM values only. Better metrics don't necessarily mean better quality though.
  • fastdecode – disables CABAC and the in-loop deblocking filter to allow for faster decoding on devices with lower computational power.
  • zerolatency – optimization for fast encoding and low latency streaming

You can see the detailed options applied with each tune with x264 --fullhelp:

--tune <string>         Tune the settings for a particular type of source
                          or situation
                              Overridden by user settings.
                              Multiple tunings are separated by commas.
                              Only one psy tuning can be used at a time.
                              - film (psy tuning):
                                --deblock -1:-1 --psy-rd <unset>:0.15
                              - animation (psy tuning):
                                --bframes {+2} --deblock 1:1
                                --psy-rd 0.4:<unset> --aq-strength 0.6
                                --ref {Double if >1 else 1}
                              - grain (psy tuning):
                                --aq-strength 0.5 --no-dct-decimate
                                --deadzone-inter 6 --deadzone-intra 6
                                --deblock -2:-2 --ipratio 1.1 
                                --pbratio 1.1 --psy-rd <unset>:0.25
                                --qcomp 0.8
                              - stillimage (psy tuning):
                                --aq-strength 1.2 --deblock -3:-3
                                --psy-rd 2.0:0.7
                              - psnr (psy tuning):
                                --aq-mode 0 --no-psy
                              - ssim (psy tuning):
                                --aq-mode 2 --no-psy
                              - fastdecode:
                                --no-cabac --no-deblock --no-weightb
                                --weightp 0
                              - zerolatency:
                                --bframes 0 --force-cfr --no-mbtree
                                --sync-lookahead 0 --sliced-threads
                                --rc-lookahead 0
share|improve this answer
1  
I was under the impression that --tune film is for grainy material, but from what you're saying it's synonymous with high-quality input; basically, if my sources are always great quality, then I should always use this tune. And then --tune grain should be used for things such as very old film material. Is that correct? –  Florin Andrei Jun 9 '13 at 0:57
2  
@Florin Both are for high-quality sources, but --tune film will filter some of the grain and --tune grain will preserve more of it. AIUI the latter should only be used if the grain is an important part of the visuals that could still be noticeable at the target settings. –  Tobu Aug 27 '13 at 0:32
    
@Tobu makes sense, thanks! –  Florin Andrei Aug 27 '13 at 1:22
    
--tune film is for live-action content: anything shot on a camera, as opposed to cel animation or computer generated text/charts. It is even suitable for somewhat realistic 3d animation, so don't let the "film" part food you. It works for grainy and non-grainy sources and balances grain retention with overall quality-per-bitrate, whereas --tune grain will try to preserve grain at any cost; useful if keeping the grain is a must-have for some reason. --tune film does NOT only help for high bitrate (indeed, tunings tend to have more of an effect on lower bitrates in general). –  thomasrutter Aug 12 at 12:47
    
Note: "stillimage" is for people writing tools that use x264 to encode a single still frame, as an alterntive to JPEG or JPEG2000. It could however still be helpful for people doing a video which is essentially a slideshow of still images where a static image is shown unchanged for many frames before changing to the next image, as long as it literally is a static slide show with no transitions. The point of "stillimage" is that it boosts certain psy optimisations that would improve single frames at the expense of harming motion. –  thomasrutter Dec 16 at 3:58

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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