quietvoid / dovi_tool

dovi_tool is a CLI tool combining multiple utilities for working with Dolby Vision.
MIT License
641 stars 59 forks source link

Invalid RPU possible bug and exit status is zero on error #122

Closed sammys closed 2 years ago

sammys commented 2 years ago

Hi and thanks for creating dovi_tool!

I've encountered an FEL+RPU stream that dovi_tool fails to convert for some reason and upon exit it also has an exit status of zero instead of non-zero. Here is a screenshot of the output.

Screen Shot 2022-02-04 at 10 44 39

The bitstream file is 10GB so please advise me how you'd like to receive it.

quietvoid commented 2 years ago

I should be able to reproduce this locally without a sample file. Currently, the return code is always zero. I'll have to look into fixing that.

quietvoid commented 2 years ago

Though if you're able to mention the title of the movie, that would work as well.

A sample would be better to see if there's an issue with the HEVC parser.

sammys commented 2 years ago

Happy to give you the details.

Movie: Crank.Extended.Cut.2006.MULTI.COMPLETE.UHD.BLURAY-GENTLEMAN

Stream was taken directly from BDMV/STREAM/00002.m2ts using the following command (FFmpeg 4.4):

ffmpeg -analyzeduration 2000M -probesize 2000M -hide_banner -i "BDMV/STREAM/00002.m2ts" -c copy -an -sn -map 0:v:1 -vbsf hevc_mp4toannexb -y "example.FEL+RPU.7.hevc"

In case you are wondering, I also tried piping the FFmpeg output to dovi_tool with the same result.

If you'd like me to post a sample, would it be fastest if you posted a patch I can apply to dovi_tool to make it output the location of the error it finds (if there's no other way to get it to do that)?

quietvoid commented 2 years ago

Thanks for the info. I'll look into it.

quietvoid commented 2 years ago

Seems the file is "corrected" by remuxing/demuxing with MKVToolNix. So, currently I'm blaming FFmpeg. There is indeed a weird sequence of bytes, which I'm not sure is legal but it's not being errored on so maybe it is.

The bytes at the end of the RPU are 80 00 00 00 00 00 01. While 00 00 00 01 is expected, it signals the start of a new NALU. I don't think 00 00 00 00 01 is valid because it hasn't been escaped.

edit: Anyways, I asked and apparently it's perfectly fine. I'll fix it somehow.

quietvoid commented 2 years ago

The parsing should be fixed, and dovi_tool should now return a relevant exit code if there's an error.

sammys commented 2 years ago

Always those pesky edge cases hehe. Built 1.4.6 and...

Screen Shot 2022-02-05 at 09 09 01

Can't test the exit status as I don't have any invalid streams on hand. Thanks for the quick turnaround!