The Notebook Review forums were hosted by TechTarget, who shut down them down on January 31, 2022. This static read-only archive was pulled by NBR forum users between January 20 and January 31, 2022, in an effort to make sure that the valuable technical information that had been posted on the forums is preserved. For current discussions, many NBR forum users moved over to NotebookTalk.net after the shutdown.
Problems? See this thread at archive.org.

    HDR10 10-bit HEVC encoding with FFmpeg's VAAPI encoders

    Discussion in 'Linux Compatibility and Software' started by Dennismungai, Apr 1, 2019.

  1. Dennismungai

    Dennismungai Notebook Deity

    Reputations:
    785
    Messages:
    933
    Likes Received:
    867
    Trophy Points:
    106
    Hello there,

    For these who rely on FFmpeg in your workflows: You can now evaluate HDR10 HEVC 10-bit encoding with the VAAPI-based encoders.

    A few examples of this in use.

    [​IMG]

    Commands running in the shells in 1 and 2, to the left:

    (a). Shell 1:
    time ffmpeg -threads:v 4 -threads:a 12 \
    -init_hw_device vaapi=va:/dev/dri/renderD128 -hwaccel vaapi -hwaccel_output_format vaapi -hwaccel_device va -filter_hw_device va \
    -i 'a/sm.mkv' \
    -b:v 15000k -maxrate:v 30000k -bufsize:v 2503k -c:v hevc_vaapi -sei hdr -profile:v main10 -qp:v 19 -g:v 50 -r:v 23.976 -rc_mode:v 3 -bf:v 3 -bits_per_raw_sample 10 -level:v 5.1 \
    -flags -global_header+low_delay -max_muxing_queue_size 1024 -fflags +genpts -vsync 1 \
    -map 0 -c:a copy -c:s copy \
    -f matroska -y "b/sm.mkv"

    (b). Shell 2:
    time ffmpeg -threads:v 4 -threads:a 12 \
    -init_hw_device vaapi=va:/dev/dri/renderD128 -hwaccel vaapi -hwaccel_output_format vaapi -hwaccel_device va -filter_hw_device va \
    -i 'a/su.mkv' \
    -b:v 15000k -maxrate:v 30000k -bufsize:v 2503k -c:v hevc_vaapi -sei hdr -profile:v main10 -qp:v 19 -g:v 50 -r:v 23.976 -rc_mode:v 3 -bf:v 3 -bits_per_raw_sample 10 -level:v 5.1 \
    -flags -global_header+low_delay -max_muxing_queue_size 1024 -fflags +genpts -vsync 1 \
    -map 0 -c:a copy -c:s copy \
    -f matroska -y "b/su.mkv"

    See how hard the Intel integrated GPU is being hammered, from the intel_gpu_top output above.

    Condensed view, showing vainfo:

    [​IMG]

    I can indeed confirm that this encoder implements HDR metadata retention, and the same can be recognized by HDR10-capable devices with zero issues.

    How FFmpeg was built:

    https://gist.github.com/Brainiarc7/4f831867f8e55d35cbcb527e15f9f116

    Intel's Neo OCL runtime may fail to build from source (bugs everywhere!) but can be safely installed from a PPA if so needed.

    The likes of Plex should pick this up so they stop stripping off HDR metadata when they use hardware-based encoders. In my testing a few months ago, the proprietary QSV-based encoders in libav and FFmpeg strip this info. Will repeat the tests again to confirm if this is the case at present.