[FFmpeg-user] Reencoding from H.264 to H.265

Peter White peter.white at posteo.net
Fri Sep 2 14:29:45 EEST 2016


02.09.2016, 08:50, Sven C. Dack:
  > Hello,
  >
  > On the subject... I've been doing just that. Transcoding H.264
  > videos into H.265, scaling these down to 480p and reducing the
  > bitrate to about 1mbit/s.

Well, the size reduction is obviously due to the smaller image
dimensions and not because the codec is so much better. I can get to
that bitrate with plain "old" x264 at 480p and not notice any artefacts.

  > Using the same quality settings are there significant differences in
  > the video file sizes for different scaling algorithms. Here is a
  > picture which shows the scaling algorithms of the CUDA NPP filter
  > "scale_npp" with NVENC at -qmax 20 and -qmax 24 including the file
  > size of the output:
  >
  > http://i.imgur.com/c7hzoae.png

-qmax is the wrong setting here. It does not allow for the same
quality. It simply *caps* the allowed maximum quantizer. And only
because the quantizer is higher does not mean the quality is lower. It
might just as well mean there was less information, hence the higher
quantizer.
IMHO, the proper test would set an equal CRF for all the transcodings
and leave all other settings alone, or at least the ones that tie the
hands of the codec like -qmax does. It constrains what the encoder is
allowed to do:
"x265: this image only deserves a q of 30
qmax: Overruled! q will be reduced to qmax of 20."

  > It shows that using super-sampling at "-qmax 20" needs about as much
  > space as a lanczos filter at "-qmax 24" (the higher the -qmax the
  > lower the quality).

That is the wrong assumption, as I said above. In CRF mode that might
just as well mean, the image can be compressed with a higher quantizer
at no perceivable quality loss.
Also, your comparisons are flawed, if you compare different bitrate
files and base your judgement on the bitrate alone. There are really
only two valid comparisons. One, you make the files the same bitrate by
tuning -crf, which can be very tedious to achieve, and then compare the
perceptual quality. Two, do it the other way around, make the files the
same perceptual quality and then compare bitrate. Option two will be
very very hard to achieve.

  > I've seen people using and recommending lanczos and cubic
  > interpolations, and these are good filters for most purposes,
  > however it shows that these are even worse than a simple linear
  > interpolation algorithm when it comes to transcoding.

You are not saying that a linear interpolation provides better quality
than the other two, are you? Plus, you keep mixing up transcoding and
scaling. Of course, smaller image dimensions will reduce the bitrate.
Duh!

  > If you keep this in mind then you can safely transcode and downscale
  > old H.264 videos into H.265.

That is downright dangerous advice, sorry. Of course, no puppies will
die but there is nothing one can "safely" do when transcoding from one
lossy codec to another. There will be quality loss, period. The general
advice is, don't do it. For exceptions have a look at Nicolas George's
reply.

  > Sven

And please do not top-post.


Peter


More information about the ffmpeg-user mailing list