HDR video transcode with cuvid, swcale_npp, tonemap_opencl and nvenc

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

HDR video transcode with cuvid, swcale_npp, tonemap_opencl and nvenc

Sergei Matsukov
I am trying to quickly convert 10 bit HDR video to 8 bit SDR video.

In software mode I'm using command:

ffmpeg -i sony_pictures_4k_ultra_hd_movies_1-DWEU.mkv -map 0:0 -vf
scale=w=1920:h=1080:flags=lanczos,zscale=t=linear:npl=100,format=gbrpf32le,zscale=p=bt709,tonemap=tonemap=hable:desat=0,zscale=t=bt709:r=tv,format=yuv420p
-c:v libx264 -crf 19 test.mkv

But the conversion speed is rather low.

How can I use ffmpeg for fast hardware transcode with hwaccel
hevc_cuvid, scale_npp and tonemap_opencl filters, h264_nvenc encoder?

I tried to use the following command, but got an error:

ffmpeg -loglevel verbose -hwaccel_device 0 -hwaccel cuvid -c:v
hevc_cuvid -i sony_pictures_4k_ultra_hd_movies_1-DWEU.mkv -map 0:0
-filter:v
scale_npp=w=1920:h=1080:format=p010le:interp_algo=lanczos,tonemap_opencl=tonemap=hable:t=bt709:m=bt709:p=bt709:r=tv:format=yuv420p
-c:v h264_nvenc -profile:v high -preset slow -rc vbr_hq -b:v 7000k test.mkv

ffmpeg version N-93387-gdef18ac43b Copyright (c) 2000-2019 the FFmpeg
developers
   built with gcc 8.3.0 (Rev2, Built by MSYS2 project)
   configuration:  --enable-nonfree --enable-amf --enable-cuda
--enable-cuvid --enable-d3d11va --enable-dxva2 --enable-iconv
--enable-lzma --enable-nvenc --enable-zlib --enable-sdl2 --disable-debug
--enable-ffnvcodec --enable-nvdec --enable-gmp --enable-libmp3lame
--enable-libopus --enable-libvorbis --enable-libvpx --enable-libx264
--enable-libx265 --enable-libdav1d --enable-fontconfig --enable-libass
--enable-libbluray --enable-libfreetype --enable-libmfx
--enable-libopencore-amrnb --enable-libopencore-amrwb
--enable-libopenjpeg --enable-libsnappy --enable-libsoxr
--enable-libspeex --enable-libtheora --enable-libtwolame
--enable-libvidstab --enable-libvo-amrwbenc --enable-libwavpack
--enable-libwebp --enable-libxml2 --enable-libzimg --enable-libshine
--enable-gpl --enable-avisynth --enable-libaom --enable-version3
--enable-gcrypt --enable-cuda-nvcc --enable-libfdk-aac
--enable-libfribidi --enable-libkvazaar --enable-libnpp
--enable-libopenmpt --enable-libxavs --enable-opencl --enable-opengl
--cpu=native --enable-gnutls --extra-cflags=-DLIBTWOLAME_STATIC
--extra-libs=-lstdc++ --extra-cflags=-DLIBXML_STATIC
--extra-cflags=-DKVZ_STATIC_LIB
--extra-cflags='-IC:/PROGRA~1/NVIDIA~2/CUDA/v10.1/include'
--extra-ldflags='-LC:/PROGRA~1/NVIDIA~2/CUDA/v10.1/lib/x64'
   libavutil      56. 26.100 / 56. 26.100
   libavcodec     58. 47.103 / 58. 47.103
   libavformat    58. 26.101 / 58. 26.101
   libavdevice    58.  6.101 / 58.  6.101
   libavfilter     7. 48.100 /  7. 48.100
   libswscale      5.  4.100 /  5.  4.100
   libswresample   3.  4.100 /  3.  4.100
   libpostproc    55.  4.100 / 55.  4.100
Input #0, matroska,webm, from 'sony_pictures_4k_ultra_hd_movies_1-DWEU.mkv':
   Metadata:
     encoder         : libebml v1.3.5 + libmatroska v1.4.8
     creation_time   : 2018-01-28T08:05:04.000000Z
   Duration: 00:01:03.23, start: 0.000000, bitrate: 43628 kb/s
     Stream #0:0: Video: hevc (Main 10), 1 reference frame,
yuv420p10le(tv, bt2020nc/bt2020/smpte2084), 3840x2160 [SAR 1:1 DAR
16:9], 23.98 fps, 23.98 tbr, 1k tbn, 23.98 tbc (default)
     Metadata:
       BPS             : 42986148
       BPS-eng         : 42986148
       DURATION        : 00:01:03.230000000
       DURATION-eng    : 00:01:03.230000000
       NUMBER_OF_FRAMES: 1516
       NUMBER_OF_FRAMES-eng: 1516
       NUMBER_OF_BYTES : 339751771
       NUMBER_OF_BYTES-eng: 339751771
       _STATISTICS_WRITING_APP: mkvmerge v20.0.0 ('I Am The Sun') 64-bit
       _STATISTICS_WRITING_APP-eng: mkvmerge v20.0.0 ('I Am The Sun') 64-bit
       _STATISTICS_WRITING_DATE_UTC: 2018-01-28 08:05:04
       _STATISTICS_WRITING_DATE_UTC-eng: 2018-01-28 08:05:04
       _STATISTICS_TAGS: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
       _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
     Stream #0:1: Audio: ac3, 48000 Hz, 5.1(side), fltp, 640 kb/s (default)
     Metadata:
       BPS             : 640000
       BPS-eng         : 640000
       DURATION        : 00:01:03.232000000
       DURATION-eng    : 00:01:03.232000000
       NUMBER_OF_FRAMES: 1976
       NUMBER_OF_FRAMES-eng: 1976
       NUMBER_OF_BYTES : 5058560
       NUMBER_OF_BYTES-eng: 5058560
       _STATISTICS_WRITING_APP: mkvmerge v20.0.0 ('I Am The Sun') 64-bit
       _STATISTICS_WRITING_APP-eng: mkvmerge v20.0.0 ('I Am The Sun') 64-bit
       _STATISTICS_WRITING_DATE_UTC: 2018-01-28 08:05:04
       _STATISTICS_WRITING_DATE_UTC-eng: 2018-01-28 08:05:04
       _STATISTICS_TAGS: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
       _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
[hevc_cuvid @ 0000018208ddd4c0] Initializing cuvid hwaccel
[hevc_cuvid @ 0000018208ddd4c0] CUVID capabilities for hevc_cuvid:
[hevc_cuvid @ 0000018208ddd4c0] 8 bit: supported: 1, min_width: 144,
max_width: 8192, min_height: 144, max_height: 8192
[hevc_cuvid @ 0000018208ddd4c0] 10 bit: supported: 1, min_width: 144,
max_width: 8192, min_height: 144, max_height: 8192
[hevc_cuvid @ 0000018208ddd4c0] 12 bit: supported: 1, min_width: 144,
max_width: 8192, min_height: 144, max_height: 8192
Stream mapping:
   Stream #0:0 -> #0:0 (hevc (hevc_cuvid) -> h264 (h264_nvenc))
Press [q] to stop, [?] for help
[hevc_cuvid @ 0000018208ddd4c0] Initializing cuvid hwaccel
[hevc_cuvid @ 0000018208ddd4c0] Formats: Original: cuda | HW: cuda | SW:
p010le
[graph 0 input from stream 0:0 @ 0000018208d71d40] w:3840 h:2160
pixfmt:cuda tb:1/1000 fr:24000/1001 sar:1/1 sws_param:flags=2
[auto_scaler_0 @ 0000018208d71b40] w:iw h:ih flags:'bicubic' interl:0
[Parsed_tonemap_opencl_1 @ 0000018208d72540] auto-inserting filter
'auto_scaler_0' between the filter 'Parsed_scale_npp_0' and the filter
'Parsed_tonemap_opencl_1'
Impossible to convert between the formats supported by the filter
'Parsed_scale_npp_0' and the filter 'auto_scaler_0'
Error reinitializing filters!
Failed to inject frame into filter network: Function not implemented
Error while processing the decoded data for stream #0:0
[AVIOContext @ 0000018208df8e40] Statistics: 0 seeks, 0 writeouts
[AVIOContext @ 0000018208d650c0] Statistics: 66368 bytes read, 2 seeks
Conversion failed!




_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".