cdgriffith / FastFlix

FastFlix is a free GUI for H.264, HEVC and AV1 hardware and software encoding!
https://fastflix.org/
MIT License
1.16k stars 58 forks source link

FFmpeg 5.0 - DoVi Support #285

Closed centuryx476 closed 2 years ago

centuryx476 commented 2 years ago

Hello, Does this mean Dolby Vision support in FFmpeg 5.0 ? DV

centuryx476 commented 2 years ago

This the only reference I can see in ffmpeg 5.0. This is not present in the previous ffmpeg. DV_Out

cdgriffith commented 2 years ago

Quick test seems that simply remuxing (aka copying the video stream) now doesn't remove Dolby Vision data with 5.0 like it did with 4.4!

Not yet added to libx265 for encoding https://trac.ffmpeg.org/ticket/9131

Thanks for pointing this out, exciting news!

centuryx476 commented 2 years ago

Awesome. A step in the right direction. @cdgriffith this value "apply_dolbyvision" how do we use it in an ffmpeg command ?

I remuxed a dolbyvision file and the DV layer was stripped. Only left the HDR10 layer!

cdgriffith commented 2 years ago

What version are you using, seems to work with ffmpeg-n5.0-latest-win64-gpl-5.0.zip from https://github.com/BtbN/FFmpeg-Builds/releases Tried with 2 different videos just to make sure.

HDR format  : Dolby Vision, Version 1.0, dvhe.07.06, BL+EL+RPU, Blu-ray compatible / SMPTE ST 2094 App 4, Version 1, HDR10+ Profile B compatible

Tested with simple remux into a mkv ffmpeg -i in_video.mp4 -max_muxing_queue_size 1024 -map 0:0 -c:v copy -pix_fmt yuv420p10le -map_metadata -1 -map_chapters 0 out_video.mkv

apply_dolbyvision is part of the libplacebo filter (can see all options ffmpeg -h filter=libplacebo ) never used it myself before so don't have any context for it.

centuryx476 commented 2 years ago

I'm an idiot. I was outputting as a .mp4. Now it works! Question: Now that this first step of ffmpeg preserving the DV layer. How much harder will it be for them to implement a way to encode down the BL layer while preserving the DV ? If i'm not mistaken the BL layer is the layer we want to encode down. Correct ?

cdgriffith commented 2 years ago

It should be currently possible to encode the DV layer and pair back with the RPU, but requires using x265 directly https://codecalamity.com/encoding-uhd-4k-hdr10-videos-with-ffmpeg/#saving-dolby-vision

However I know no way of saving the EL layer.

centuryx476 commented 2 years ago

It should be currently possible to encode the DV layer and pair back with the RPU, but requires using x265 directly https://codecalamity.com/encoding-uhd-4k-hdr10-videos-with-ffmpeg/#saving-dolby-vision

However I know no way of saving the EL layer.

I understand. What I was referring too was using only ffmpeg and no other tool.

cdgriffith commented 2 years ago

Unfortunately x265 has DV RPU as a CLI only option https://x265.readthedocs.io/en/master/cli.html#cmdoption-dolby-vision-rpu

So have to wait for an update from them or for the ffmpeg workaround to be added https://trac.ffmpeg.org/ticket/9131

centuryx476 commented 2 years ago

@cdgriffith I sent you an email asking about x265.

Thank You