Improving Video Encoding Quality
Posted by - NA -, Last modified by Mark [Elevated X Support] on 26 August 2019 11:42 PM

Improving Video Encoding Quality

The information in this article will improve the server side video quality considerably. The trade-off for quality is speed of the encoding process and file size.


1)  PNG, with or without transparancy, is the best format for watermarking video. The system will place the watermark in the bottom right-hand corner of the video.  We suggest that you size the watermark for each size video that you create.

Extra Encoding Flags

2) Extra flags to enter under Plug-Ins, Transcoder for each entry that may improve this:

a) Quality flags:
 -qcomp 0.6 -subq 9

What this does:
qcomp is video quantizer scale compression (VBR) (default 0.5) -  Constant of rate control equation.

qcomp trades off the number of bits allocated to "expensive" high-motion versus "cheap" low-motion frames. At one extreme, qcomp=0 aims for true constant bitrate. Typically this would make high-motion scenes look completely awful, while low-motion scenes would probably look absolutely perfect, but would also use many times more bitrate than they would need in order to look merely excellent. At the other extreme, qcomp=1 achieves nearly constant quantization parameter (QP). Constant QP does not look bad, but most people think it is more reasonable to shave some bitrate off of the extremely expensive scenes (where the loss of quality is not as noticeable) and reallocate it to the scenes that are easier to encode at excellent quality. qcomp is set to 0.6 by default, which may be slightly low for many peoples' taste (0.7-0.8 are also commonly used).

More information is here:

qmin is minimum video quantizer scale (VBR)
qmax is maximum video quantizer scale (VBR)
qdiff is maximum difference between the quantizer scales (VBR)

What this does is set up the level of compression / quality that is performed by ffmpeg   In the case of qmin and qmax, lower settings generate higher quality movies.  The tradeoff is that higher quality videos take a lot longer to encode.

So for instance, a very high quality movie might use:

 -qcomp 0.6 -qmin 3 -qmax 7 -qdiff 4

***PLEASE BEWARE: These changes will affect file quality AND file size. (The file might be huge at 3x or 4x the source file.)

qmin, qmax, and qdiff override any sort of bitrate settings here. The system tries to determine the quality of the movie and then working backwards and determining the bitrate from there.

b) BFrames:

MPEG1, MPEG2 and MPEG4 movies have support for Bframes.  What this will do is add support for forward / backward interpolation.  This will result in a better quality picture using the same bitrate.

-bf 4 -b_strategy 2

Note: If these additional flags are enabled for non-MPEG movies, your encode will fail.

c) General flags that can be used on all videos.

-subq 7
This is the most important quality setting.  The default ffmpeg setting is subq=5.  subq=7 will have a speed cost of encoding video 50-150% slower than a regular movie, but create a higher quality movie.

More information is here:

-g 250
 This sets the group of pictures size

-i_qfactor 0.71
 qp factor between P- and I-frames.

-keyint_min 25
-sc_threshold 40
-refs 16
-directpred 3
-trellis 2
-flags2 +bpyramid+wpred+mixed_refs+dct8x8+fastpskip
-coder 1
-flags +loop
-cmp +chroma
-partitions +parti8x8+parti4x4+partp8x8+partb8x8
-me_range 32

Many settings have trade-offs. Whenever you are changing a setting for higher quality, you will be trading encoding speed for quality.

(2 vote(s))
Not helpful

Comments (0)