ekisu / mpv-webm

Simple WebM maker for mpv, with no external dependencies.
MIT License
576 stars 33 forks source link

Encoding freezes on problematic videos if audio is enabled #86

Open mikamidd opened 4 years ago

mikamidd commented 4 years ago

Now this is most likely an mpv issue but posting this issue in case this may somehow offset by the script. Since this https://github.com/ekisu/mpv-webm/issues/81 issue is closed, I'm making a new one with more info. Encoding "problematic" videos with a script fails on mpv builds past mpv 0.32.0-288-gee70e8ce50. By problematic files I mean videos that throw up this kind of errors when scanned with ffmpeg for errors:

Application provided invalid, non monotonically increasing dts to muxer in stream 0: 2893 >= 2893
Application provided invalid, non monotonically increasing dts to muxer in stream 0: 2897 >= 2897
Application provided invalid, non monotonically increasing dts to muxer in stream 0: 2901 >= 2901

When trying to encode such video with audio enabled, encoding freezes at random point with console getting flooded with this error:

[webm] "[ao/lavc] audio frame pts went backwards (2375952 <- 49499), autofixed"
[webm] "[ao/lavc] audio frame pts went backwards (2376000 <- 49500), autofixed"
[webm] "[ao/lavc] audio frame pts went backwards (2376048 <- 49501), autofixed"

Potentially caused by commits made in response to this issue: https://github.com/mpv-player/mpv/issues/7524

To ensure encoding passes successfully it's necessary to mute the audio. However sometimes video encodes fine even with audio enabled, probably what happened to the author of https://github.com/ekisu/mpv-webm/issues/81 issue where script "fixed itself",

As I said in the beginning, mpv build mpv 0.32.0-288-gee70e8ce50 and older don't have any issues encoding "broken" files with mpv-webm script. I wonder if this is something that can be worked around by tweaking the script or possibly invoking an ffmpeg to do the encode instead?

Example file: Blade.Runner.2049.2017.1080p.BluRay.x265-RARBG.mp4