quietvoid / hdr10plus_tool

CLI utility to work with HDR10+ in HEVC files.
MIT License
296 stars 33 forks source link

Error; Condition failed #63

Closed admirbabovic closed 1 year ago

admirbabovic commented 1 year ago

When I try to extract HDR10Plus metadata from .mkv file I get this error Error: Condition failed: self.hdr10plus_sei_list.len() == frames.len() (222353 vs 222352)

Any way to fix this?

quietvoid commented 1 year ago

No, it sounds like an invalid file to me.

admirbabovic commented 1 year ago

Ok, thank you!

end2endzone commented 11 months ago

I have found a similar mkv file which reported the same error. The file is in fact an invalid file as previously mentioned. The issue with such a file is that reported length is incorrect. For example, the length reported by VLC (or Media Info) is 2:36:54 while the actual length is some where around 2:34:33. This error can also append if one of the the audio track is longer than the video track. According to hdr10plus_tool, the length of the HDR10+ data is 222352 frames. 222352 frames at 23.97602398 fps is 02:34:33.93133333.

To resolve the issue (and fix the file without reencoding), you need to cut the file at the 2:34:33 mark (or maybe at 2:34:32.9). The idea is to cut before reaching the end of the video track. This can be done using ffmpeg or FastFlix using the Copy mode option and setting an End time of 2:34:33. Then proceed with the "lossless" conversion. This does not reencode the file so the process should take a couple of minutes max depending on your input file size.

The resulting output file is exactly 2:34:33 long and can be processed perfectly in hdr10plus_tool:

video:27444754kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.000000%
Reordering metadata... Done.
Reading parsed dynamic metadata... Done.
Generating and writing metadata to JSON file... Done.