[FFmpeg-user] Reencoding from H.264 to H.265
Sven C. Dack
sven.c.dack at sky.com
Sun Sep 4 21:40:16 EEST 2016
On 02/09/16 17:28, Sven C. Dack wrote:
> Hello Peter,
>
> I was not arguing. I was stating what I was doing. Your suggestions are
> however welcome.
>
> Sven
>
I now had the time to follow up on your suggestions, Peter.
There are a few things I need to note first... The Nvidia hardware encoder NVENC
doesn't accept a "-crf" value, which is why I had to use "-qmax" for a quality
setting. But as per your suggestion did I now include the software encoders x264
and x265. The "-crf" values have been chosen so all three encoders (x264, x265 &
nvenc) produce about the same file size when using the simplest of algorithm,
nearest neighbor.
I may also have found a bug in the Nvidia CUDA scaler (filter "scale_npp"). It
appears that when one is downscaling the input without changing the aspect ratio
will some filter algorithms not work (some do), but appear to default to
"nearest neighbor" instead (see below).
*** Please note that this is _NOT_ a comparison of encoders, but it is meant to
show the effect of the (down-)scaling filters on reencoding. ***
The original video is 182MB in size, its format is Ultra-HD 3840x2160p 60Hz,
webm (VP9), courtesy of Harmonica and can be found here:
https://www.youtube.com/watch?v=7n_dx5NuvSM It is being downscaled to 1280x720p
before the reencoding. The image sample is taken from position 0:30 and cropped
to show just the face and some hair of a monkey. Each sample is labelled by
filter name, the encoder setting and the resulting file size.
http://i.imgur.com/SNuHzma.png (low quality setting)
http://i.imgur.com/LmxKZdH.png (high quality setting)
Out of completeness, a criss-cross of H/W and S/W, scalers and encoders:
http://i.imgur.com/ihhhUsY.png (low quality setting)
http://i.imgur.com/5qfPCSU.png (high quality setting)
Suggestions are welcome!
To the bug... When the CUDA H/W scaler is run as follows:
... -pix_fmt:v +nv12 -filter:v
"hwupload_cuda,scale_npp=w=1024:h=720:format=nv12:interp_algo=cubic,hwdownload" ...
then it will apply the cubic filter correctly. If however 1280 is given as width
and so the aspect ratio stays the same will it fail to select the cubic filter.
This happens for the linear, lanczos, cubic and catmulrom filter, too. The
spline, b05c03 and super filter do work though. This is with Nvidia driver
370.23, CUDA 7.5, Video SDK 7.0.1 on a GTX 960.
Sven
$ ffmpeg -version
ffmpeg version N-81542-gb6e8efb Copyright (c) 2000-2016 the FFmpeg developers
built with gcc 6.2.0 (GCC)
configuration: --prefix=/home/sven/av --enable-gpl --enable-version3
--enable-nonfree --arch=x86_64 --cpu=native --disable-debug --disable-shared
--enable-static --enable-libvorbis --enable-libopus --enable-libx264
--enable-libx265 --enable-opengl --enable-opencl --enable-vaapi --enable-vdpau
--enable-cuda --enable-cuvid --enable-nvenc --enable-libnpp
--extra-cflags='-I/home/sven/av/include -I/usr/local/cuda/include
-I/usr/local/Video_Codec_SDK_7.0.1/Samples/common/inc'
--extra-ldflags='-L/home/sven/av/lib -L/usr/local/cuda/lib64' --ar=gcc-ar
--nm=gcc-nm --ranlib=true
libavutil 55. 29.100 / 55. 29.100
libavcodec 57. 54.102 / 57. 54.102
libavformat 57. 48.102 / 57. 48.102
libavdevice 57. 0.102 / 57. 0.102
libavfilter 6. 59.100 / 6. 59.100
libswscale 4. 1.100 / 4. 1.100
libswresample 2. 1.100 / 2. 1.100
libpostproc 54. 0.100 / 54. 0.100
More information about the ffmpeg-user
mailing list