[FFmpeg-user] VP9 to HEVC hdr demo conversion?

Andy Furniss adf.lists at gmail.com
Mon Dec 12 21:28:21 EET 2016


traycold wrote:
> hi,
> I tried the same (convert a vp9.2 hdr video to hevc to watch it on a samsung
> smart tv).
> So far, I tried this command (input.mkv contains both VP9.2 video stream and
> audio stream):
>
> ffmpeg -i input.mkv -vf
> scale=out_color_matrix=bt2020:out_h_chr_pos=0:out_v_chr_pos=0,format=yuv420p10
> -pix_fmt yuv420p10le -c:v libx265 -x265-params
> "colorprim=bt2020:transfer=smpte-st-2084:colormatrix=bt2020nc" -crf 22 -c:a
> copy output.mkv
>
> It works in the sense that the video is visible on smart TV. Looking with
> mediainfo it seems ok to me, but the video is notably darker and color
> different than original (for instance: orange becomes almost a dark red).
>
> So probably there is something wrong. Honestly I just put that command
> together looking at various forums, threads, tutorials I found on the web,
> as I'm a totally noob with encoding and ffmpeg.
>
> Hope this may help, anyway. And someone can provide a better way to convert.

I am not sure if it's currently possible or not - I don't have a TV to test.

Looking with ffprobe at HDR hevc from the web you will see extradata in 
the stream.

I don't know how to write that with ffmpeg.

libx265 does have options to add some HDR info into the headers - 
possibly they could work.

mpv auto converts HDR 2020 to 709 SDR. For the youtube vid mentioned
mpv -v will see and act on this metadata, I don't know how to see it
with ffmpeg.

mpv -v The\ World\ in\ HDR-tO01J-M3g0U.webm

....

[demux] Trying demuxers for level=normal.
[mkv] Found the head...
[mkv] + a segment...
[mkv] Parsing seek head...
[mkv] |+ segment information...
[mkv] | + muxing app: google
[mkv] | + writing app: google
[mkv] | + timecode scale: 1000000
[mkv] | + duration: 154.538s
[mkv] |+ segment tracks...
[mkv] | + a track...
[mkv] |  + Track number: 1
[mkv] |  + Track type: Video
[mkv] |  + Video track
[mkv] |   + Pixel width: 3840
[mkv] |   + Pixel height: 2160
[mkv] |    + Matrix: bt.2020-ncl
[mkv] |    + Primaries: bt.2020
[mkv] |    + Gamma: st2084
[mkv] |    + Levels: limited
[mkv] |    + HDR peak: 1000.000000
[mkv] |  + Codec ID: V_VP9
[mkv] |  + Default duration: 16.683ms ( = 59.940 fps)
[mkv] Parsing cues...
[mkv] |+ found cluster
[mkv] All headers are parsed!

....

The HDR peak is info that you can get into hevc via libx265 - but 
whether anything will read it I don't know (mpv won't).

x265 -h | grep -i hdr

--master-display <string>     SMPTE ST 2086 master display color volume 
info SEI (HDR)
    --max-cll <string>            Emit content light level info SEI as 
"cll,fall" (HDR)

I guess max-cll 1000,1000 may work, but I haven't got a clue if, or what 
to, master-display would need setting.




More information about the ffmpeg-user mailing list