How to play HDR10 videos using ffplay and ffmpeg?

640 Views Asked by At

I'm trying to play on Windows a HDR10 video. My display support 10 bits HDR content. The command that I'm using to play the HDR10 video is the following. ffplay -sws_flags print_info -i video.mp4

But the output looks washed out.

the log are the following:

ffplay version 2022-03-28-git-5ee198f9aa-full_build-www.gyan.dev Copyright (c) 2003-2022 the FFmpeg developers built with gcc 11.2.0 (Rev7, Built by MSYS2 project) configuration: --enable-gpl --enable-version3 --enable-static --disable-w32threads --disable-autodetect --enable-fontconfig --enable-iconv --enable-gnutls --enable-libxml2 --enable-gmp --enable-bzlib --enable-lzma --enable-libsnappy --enable-zlib --enable-librist --enable-libsrt --enable-libssh --enable-libzmq --enable-avisynth --enable-libbluray --enable-libcaca --enable-sdl2 --enable-libdav1d --enable-libdavs2 --enable-libuavs3d --enable-libzvbi --enable-librav1e --enable-libsvtav1 --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs2 --enable-libxvid --enable-libaom --enable-libopenjpeg --enable-libvpx --enable-mediafoundation --enable-libass --enable-frei0r --enable-libfreetype --enable-libfribidi --enable-libvidstab --enable-libvmaf --enable-libzimg --enable-amf --enable-cuda-llvm --enable-cuvid --enable-ffnvcodec --enable-nvdec --enable-nvenc --enable-d3d11va --enable-dxva2 --enable-libmfx --enable-libshaderc --enable-vulkan --enable-libplacebo --enable-opencl --enable-libcdio --enable-libgme --enable-libmodplug --enable-libopenmpt --enable-libopencore-amrwb --enable-libmp3lame --enable-libshine --enable-libtheora --enable-libtwolame --enable-libvo-amrwbenc --enable-libilbc --enable-libgsm --enable-libopencore-amrnb --enable-libopus --enable-libspeex --enable-libvorbis --enable-ladspa --enable-libbs2b --enable-libflite --enable-libmysofa --enable-librubberband --enable-libsoxr --enable-chromaprint libavutil 57. 24.101 / 57. 24.101 libavcodec 59. 25.100 / 59. 25.100 libavformat 59. 20.101 / 59. 20.101 libavdevice 59. 6.100 / 59. 6.100 libavfilter 8. 29.100 / 8. 29.100 libswscale 6. 6.100 / 6. 6.100 libswresample 4. 6.100 / 4. 6.100 libpostproc 56. 5.100 / 56. 5.100 Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'video.mp4':=0/0 Metadata: major_brand : isom minor_version : 512 compatible_brands: isomiso2mp41 encoder : Lavf58.29.100 Duration: 00:00:08.78, start: 0.000000, bitrate: 159424 kb/s Stream #0:0[0x1](und): Video: hevc (Main 10) (hev1 / 0x31766568), yuv420p10le(tv, bt2020nc/bt2020/smpte2084, progressive), 3840x2160 [SAR 1:1 DAR 16:9], 159427 kb/s, 60 fps, 60 tbr, 15360 tbn (default) Metadata: handler_name : VideoHandler vendor_id : [0][0][0][0] [swscaler @ 000001d62a81d000] [swscaler @ 000001d622aebf80] bicubic scaler, from yuv420p10le to yuv420p using MMXEXT [swscaler @ 000001d62a81d000] [swscaler @ 000001d622aebf80] using unscaled yuv420p10le -> yuv420p special converter [swscaler @ 000001d62a81d000] [swscaler @ 000001d635638600] bicubic scaler, from yuv420p10le to yuv420p using MMXEXT [swscaler @ 000001d62a81d000] [swscaler @ 000001d635638600] using unscaled yuv420p10le -> yuv420p special converter [swscaler @ 000001d62a81d000] [swscaler @ 000001d635661d80] bicubic scaler, from yuv420p10le to yuv420p using MMXEXT [swscaler @ 000001d62a81d000] [swscaler @ 000001d635661d80] using unscaled yuv420p10le -> yuv420p special converter [swscaler @ 000001d62a81d000] [swscaler @ 000001d63567df80] bicubic scaler, from yuv420p10le to yuv420p using MMXEXT [swscaler @ 000001d62a81d000] [swscaler @ 000001d63567df80] using unscaled yuv420p10le -> yuv420p special converter [swscaler @ 000001d62a81d000] [swscaler @ 000001d6356bbf80] bicubic scaler, from yuv420p10le to yuv420p using MMXEXT 3.44 M-V: 0.204 fd= 91 aq= 0KB vq=15552KB sq= 0B f=0/0

With the help of '-sws_flags print_info' flag we can see that there is a downscaling happening from 10 bits to 8 bits "yuv420p10le -> yuv420p"

I have try to play the video using VLC and it is working fine on my display: colour are vivid and display bright.

I have also try to decode first the video and then past metadata directly to ffplay as follow. Decoding to yuv format with : ffmpeg -i video.mp4 video.yuv Then play yuv file: ffplay -framerate 60 -video_size 3840x2160 -pixel_format yuv420p10le -color_range tv -color_trc smpte2084 -color_primaries bt2020 -colorspace bt2020nc -i video.yuv

But the result is the same washed out color and "yuv420p10le -> yuv420p" conversion

Is there a way to play a HDR video (encoded or decoded stream) with ffplay?

0

There are 0 best solutions below