HDR specification transfert
Hello everybody, I am trying to use FFMPEG ( 3.4 version) to transfert HDR video specifications (x265.mp4 videos). I have seen on other forums command lines that I tried to test for me but I never have succesfull results. I want to use Nvidia options (NVENC/SCALE_NPP/or other) because I have a P4 graphic card. Here is my file (Media Info) General Complete name : /storage/input_HDR.mp4 Format : MPEG-4 Format profile : Base Media Codec ID : isom (isom/iso2/mp41) File size : 293 MiB Duration : 54 s 422 ms Overall bit rate mode : Variable Overall bit rate : 45.1 Mb/s Writing application : Lavf56.15.103 Video ID : 1 Format : HEVC Format/Info : High Efficiency Video Coding Format profile : Main 10@L5.1@High Codec ID : hev1 Codec ID/Info : High Efficiency Video Coding Duration : 54 s 375 ms Bit rate : 44.8 Mb/s Width : 3 840 pixels Height : 2 160 pixels Display aspect ratio : 16:9 Frame rate mode : Constant Frame rate : 24.000 FPS Original frame rate : 23.976 (24000/1001) FPS Color space : YUV Chroma subsampling : 4:2:0 (Type 2) Bit depth : 10 bits Bits/(Pixel*Frame) : 0.225 Stream size : 290 MiB (99%) Writing library : ATEME Titan KFE 3.7.0 (4.7.0.2002) Color range : Limited Color primaries : BT.2020 Transfer characteristics : SMPTE ST 2084 Matrix coefficients : BT.2020 non-constant Mastering display color primaries : R: x=0.680000 y=0.320000, G: x=0.265000 y=0.690000, B: x=0.150000 y=0.060000, White point: x=0.312700 y=0.329000 Mastering display luminance : min: 0.0200 cd/m2, max: 1200.0000 cd/m2 Audio ID : 2 Format : AAC Format/Info : Advanced Audio Codec Format profile : LC Codec ID : 40 Duration : 54 s 422 ms Bit rate mode : Variable Bit rate : 384 kb/s Channel(s) : 2 channels Channel(s)_Original : 6 channels Channel positions : Front: L C R, Side: L R, LFE Sampling rate : 48.0 kHz Frame rate : 46.875 FPS (1024 SPF) Compression mode : Lossy Stream size : 2.47 MiB (1%) Default : Yes Alternate group : 1 And here is the command that I tried: time /FFmpeg/3.4/bin/ffmpeg -hwaccel cuvid -c:v hevc_cuvid -i /storage/input_HDR.mp4 -c:v nvenc_hevc -filter_complex [0:0]scale_npp=colormatrix=bt2020:h_chr_pos=0:v_chr_pos=0,format=yuv420p10le -pix_fmt yuv420p10le -x265-params "colorprim=bt2020:transfer=smpte-st-2084:colormatrix=bt2020nc" -crf 22 -c:a copy /storage/OUT/testHDR.mp4 When I ran the command I have this error message ffmpeg version 3.4 Copyright (c) 2000-2017 the FFmpeg developers built with gcc 4.8.5 (GCC) 20150623 (Red Hat 4.8.5-16) configuration: --prefix=/data/TOOL-FFMPEG/target --pkg-config-flags=--static --extra-cflags=-I/data/TOOL-FFMPEG/target/include --extra-ldflags=-L/data/TOOL-FFMPEG/target/lib --enable-static --enable-pic --disable-ffserver --disable-debug --disable-shared --disable-doc --enable-gpl --enable-fontconfig --enable-version3 --enable-libass --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvorbis --enable-libopenjpeg --enable-libvpx --enable-libx264 --enable-libx265 --enable-libvidstab --enable-runtime-cpudetect --enable-libfribidi --enable-libsoxr --enable-libvmaf --enable-vaapi --enable-libzimg --enable-openssl --enable-nvenc --enable-cuvid --enable-libnpp --enable-cuda --enable-cuda-sdk --enable-hwaccel=hevc_vaapi --enable-hwaccel=h264_vaapi --enable-hwaccel=mpeg2_vaapi --enable-hwaccel=vp9_vaapi --enable-librtmp --enable-nonfree libavutil 55. 78.100 / 55. 78.100 libavcodec 57.107.100 / 57.107.100 libavformat 57. 83.100 / 57. 83.100 libavdevice 57. 10.100 / 57. 10.100 libavfilter 6.107.100 / 6.107.100 libswscale 4. 8.100 / 4. 8.100 libswresample 2. 9.100 / 2. 9.100 libpostproc 54. 7.100 / 54. 7.100 [aac @ 0x2ce6920] This stream seems to incorrectly report its last channel as LFE[3], mapping to LFE[0] Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/storage/input_HDR.mp4': Metadata: major_brand : isom minor_version : 512 compatible_brands: isomiso2mp41 encoder : Lavf56.15.103 Duration: 00:00:54.42, start: 0.000000, bitrate: 45136 kb/s Stream #0:0(und): Video: hevc (Main 10) (hev1 / 0x31766568), yuv420p10le(tv, bt2020nc/bt2020/smpte2084), 3840x2160 [SAR 1:1 DAR 16:9], 44788 kb/s, 24 fps, 24 tbr, 24k tbn, 23.98 tbc (default) Metadata: handler_name : VideoHandler Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, 5.1, fltp, 381 kb/s (default) Metadata: handler_name : SoundHandler *[Parsed_scale_npp_0 @ 0x2ccb940] Option 'colormatrix' not found [AVFilterGraph @ 0x2cc86c0] Error initializing filter 'scale_npp' with args 'colormatrix=bt2020:h_chr_pos=0:v_chr_pos=0' Error initializing complex filters. Option not found * Why I cannot use the colomatrix option? /PS:I have tried with "scale_cuda" and it didn't work too./ -- Sent from: http://www.ffmpeg-archive.org/
On Tue, Dec 19, 2017 at 06:08:55 -0700, Rollie Tyler wrote:
And here is the command that I tried:
time /FFmpeg/3.4/bin/ffmpeg -hwaccel cuvid -c:v hevc_cuvid -i /storage/input_HDR.mp4 -c:v nvenc_hevc -filter_complex [0:0]scale_npp=colormatrix=bt2020:h_chr_pos=0:v_chr_pos=0,format=yuv420p10le -pix_fmt yuv420p10le -x265-params "colorprim=bt2020:transfer=smpte-st-2084:colormatrix=bt2020nc" -crf 22 -c:a copy /storage/OUT/testHDR.mp4 [...] *[Parsed_scale_npp_0 @ 0x2ccb940] Option 'colormatrix' not found [AVFilterGraph @ 0x2cc86c0] Error initializing filter 'scale_npp' with args 'colormatrix=bt2020:h_chr_pos=0:v_chr_pos=0' Error initializing complex filters. Option not found *
Why I cannot use the colomatrix option?
/PS:I have tried with "scale_cuda" and it didn't work too./
Because "colormatrix" isn't an option to any of those filters, but rather a filter for itself. Moritz
Ok thanks for your reply. I will make a new test with the modificated command line. -- Sent from: http://www.ffmpeg-archive.org/
Just few infos for those who want to make the same thing. Here is what I have done: I have change my command line: time FFmpeg/3.4/bin/ffmpeg -hwaccel cuvid -y -i /storage/input_HDR.mp4 -c:v nvenc_hevc -pix_fmt p010le -color_primaries 'bt2020' -preset slow -level 5.1 -b:v 20000000 -rc vbr_hq -crf 22 -c:a copy /storage/Out/testHDR_NVENC.mp4 I removed the x265-params part because it didn't work for me (I can write whatever I want inside this command and nothing change). After the transcoding I have a 4K 10bits HEVC video -bash-4.2$ mediainfo CLI -f /storage/Out/testHDR_NVENC.mp4 General Count : 325 Count of stream of this kind : 1 Kind of stream : General Kind of stream : General Stream identifier : 0 Count of video streams : 1 Count of audio streams : 1 Video_Format_List : HEVC Video_Format_WithHint_List : HEVC Codecs Video : HEVC Audio_Format_List : AAC Audio_Format_WithHint_List : AAC Audio codecs : AAC LC Complete name : /storage/Out/testHDR_NVENC.mp4 Folder name : /storage/Out File name : testHDR_NVENC.mp4 File extension : mp4 Format : MPEG-4 Format : MPEG-4 Format/Extensions usually used : mov mp4 m4v m4a m4b m4p 3ga 3gpa 3gpp 3gp 3gpp2 3g2 k3g jpm jpx mqv ismv isma ismt f4a f4b f4v Commercial name : MPEG-4 Format profile : Base Media Internet media type : video/mp4 Codec ID : isom Codec ID : isom (isom/iso2/mp41) Codec ID/Url : http://www.apple.com/quicktime/download/standalone.html CodecID_Compatible : isom/iso2/mp41 Codec : MPEG-4 Codec : MPEG-4 Codec/Extensions usually used : mov mp4 m4v m4a m4b m4p 3ga 3gpa 3gpp 3gp 3gpp2 3g2 k3g jpm jpx mqv ismv isma ismt f4a f4b f4v File size : 126928572 File size : 121 MiB File size : 121 MiB File size : 121 MiB File size : 121 MiB File size : 121.0 MiB Duration : 54422 Duration : 54 s 422 ms Duration : 54 s 422 ms Duration : 54 s 422 ms Duration : 00:00:54.422 Duration : 00:00:54:09 Duration : 00:00:54.422 (00:00:54:09) Overall bit rate : 18658420 Overall bit rate : 18.7 Mb/s Frame rate : 24.000 Frame rate : 24.000 FPS Frame count : 1305 Stream size : 28831 Stream size : 28.2 KiB (0%) Stream size : 28 KiB Stream size : 28 KiB Stream size : 28.2 KiB Stream size : 28.16 KiB Stream size : 28.2 KiB (0%) Proportion of this stream : 0.00023 HeaderSize : 36 DataSize : 126899749 FooterSize : 28787 IsStreamable : No File last modification date : UTC 2018-01-09 15:22:36 File last modification date (local) : 2018-01-09 16:22:36 Writing application : Lavf57.83.100 Writing application : Lavf57.83.100 Video Count : 338 Count of stream of this kind : 1 Kind of stream : Video Kind of stream : Video Stream identifier : 0 StreamOrder : 0 ID : 1 ID : 1 Format : HEVC Format/Info : High Efficiency Video Coding Format/Url : http://www.itu.int Commercial name : HEVC Format profile : Main 10@L5.1@Main Internet media type : video/H265 Codec ID : hev1 Codec ID/Info : High Efficiency Video Coding Codec ID/Url : http://www.itu.int/ Codec : HEVC Codec : HEVC Codec/CC : hev1 Codec profile : Main 10@L5.1@Main Duration : 54375 Duration : 54 s 375 ms Duration : 54 s 375 ms Duration : 54 s 375 ms Duration : 00:00:54.375 Duration : 00:00:54:09 Duration : 00:00:54.375 (00:00:54:09) Bit rate : 18288607 Bit rate : 18.3 Mb/s Width : 3840 Width : 3 840 pixels Height : 2160 Height : 2 160 pixels Stored_Height : 2176 Sampled_Width : 3840 Sampled_Height : 2160 Pixel aspect ratio : 1.000 Display aspect ratio : 1.778 Display aspect ratio : 16:9 Rotation : 0.000 Frame rate mode : CFR Frame rate mode : Constant Frame rate : 24.000 Frame rate : 24.000 FPS Frame count : 1305 Standard : Component Resolution : 10 Resolution : 10 bits Colorimetry : 4:2:0 Color space : YUV Chroma subsampling : 4:2:0 Chroma subsampling : 4:2:0 Bit depth : 10 Bit depth : 10 bits Scan type : Progressive Scan type : Progressive Bits/(Pixel*Frame) : 0.092 Stream size : 124305374 Stream size : 119 MiB (98%) Stream size : 119 MiB Stream size : 119 MiB Stream size : 119 MiB Stream size : 118.5 MiB Stream size : 119 MiB (98%) Proportion of this stream : 0.97933 Color range : Limited colour_description_present : Yes Color primaries : BT.2020 Audio Count : 275 Count of stream of this kind : 1 Kind of stream : Audio Kind of stream : Audio Stream identifier : 0 StreamOrder : 1 ID : 2 ID : 2 Format : AAC Format/Info : Advanced Audio Codec Commercial name : AAC Format profile : LC Codec ID : 40 Codec : AAC LC Codec : AAC LC Codec/Family : AAC Codec/CC : 40 Duration : 54422 Duration : 54 s 422 ms Duration : 54 s 422 ms Duration : 54 s 422 ms Duration : 00:00:54.422 Duration : 00:00:54:13 Duration : 00:00:54.422 (00:00:54:13) Duration_LastFrame : 1 Duration_LastFrame : 1 ms Duration_LastFrame : 1 ms Duration_LastFrame : 1 ms Duration_LastFrame : 00:00:00.001 Bit rate mode : CBR Bit rate mode : Constant Bit rate : 384000 Bit rate : 384 kb/s Channel(s) : 2 Channel(s) : 2 channels Channel(s)_Original : 6 Channel(s)_Original : 6 channels Channel positions : Front: L C R, Side: L R, LFE Channel positions : 3/2/0.1 ChannelLayout : C L R Ls Rs LFE Samples per frame : 1024 Sampling rate : 48000 Sampling rate : 48.0 kHz Samples count : 2612256 Frame rate : 46.875 Frame rate : 46.875 FPS (1024 SPF) Frame count : 2551 Compression mode : Lossy Compression mode : Lossy Stream size : 2594367 Stream size : 2.47 MiB (2%) Stream size : 2 MiB Stream size : 2.5 MiB Stream size : 2.47 MiB Stream size : 2.474 MiB Stream size : 2.47 MiB (2%) Proportion of this stream : 0.02044 Default : Yes Default : Yes Alternate group : 1 Alternate group : 1 For the HDR metadatas I will use this Python script to make the transfert https://github.com/SK-Hardwired/nv_hevc_hdr_patcher I need to make few changes in the script and normally it will be OK and I will have a 10bits 4K video with all HDR metadatas If you have comments or tips please let me know ;) -- Sent from: http://www.ffmpeg-archive.org/
Clever. What
I need to make few changes in the script and normally it will be OK and I> will have a 10bits 4K video with all HDR metadatas > > If you have comments or tips please let me know ;) Clever. I'd be interested to know what particular HDR standards you're targeting with this and how you're preparing the material. Phil
Hi, i'm think this will be helpful and no need to use NVHSP: ffmpeg -hwaccel cuvid -y -i /storage/input_HDR.mp4 -c:v nvenc_hevc -pix_fmt p010le -color_primaries 'bt2020' -colorspace 'bt2020nc' -color_trc 'smpte2084' -preset slow -level 5.1 -b:v 20000000 -rc vbr_hq -crf 22 -c:a copy /storage/Out/testHDR_NVENC.mp4 And how i know, nvenc doesn't have eqivalent "crf". No need to use -crf. For nvenc rate control options: -rc <int> E..V.... Override the preset rate-control (from -1 to INT_MAX) (default -1) constqp E..V.... Constant QP mode vbr E..V.... Variable bitrate mode cbr E..V.... Constant bitrate mode vbr_minqp E..V.... Variable bitrate mode with MinQP (deprecated) ll_2pass_quality E..V.... Multi-pass optimized for image quality (deprecated) ll_2pass_size E..V.... Multi-pass optimized for constant frame size (deprecated) vbr_2pass E..V.... Multi-pass variable bitrate mode (deprecated) cbr_ld_hq E..V.... Constant bitrate low delay high quality mode cbr_hq E..V.... Constant bitrate high quality mode vbr_hq E..V.... Variable bitrate high quality mode -- Sent from: http://www.ffmpeg-archive.org/
participants (4)
-
bes231084 -
Moritz Barsnick -
Phil Rhodes -
Rollie Tyler