ekisu / mpv-webm

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

Division error in scaling videos & incorrect output #29

Closed frozenpandaman closed 5 years ago

frozenpandaman commented 5 years ago

mpv version and platform

mpv 0.28.2 (C) 2000-2017 mpv/MPlayer/mplayer2 projects
 built on Sat Apr 21 19:39:49 BST 2018
ffmpeg library versions:
   libavutil       56.14.100
   libavcodec      58.18.100
   libavformat     58.12.100
   libswscale      5.1.100
   libavfilter     7.16.100
   libswresample   3.1.100
ffmpeg version: 4.0

Description

When scaling the height on some videos, mpv fails as the new width is not divisible by 2, e.g. scaling a 1280x720 video to be 480px in height. However, the output is still "Encoded successfully!" even though no file is created.

The underlying problem of being unable to scale it due to the new dimensions should be fixed by using lavfi-scale=-2:480 instead of -1:.

Log file

https://pastebin.com/r5eYzpUW

But if I run the command manually in Terminal, I get the following output:

[encode-lavc] Opening video encoder: libx264 H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10 [libx264]
[ffmpeg] libx264: width not divisible by 2 (853x480)
[encode-lavc] unable to open encoder (see above for the cause)
[encode-lavc] vo-lavc: encoded 0 bytes
[encode-lavc] ao-lavc: encoded 0 bytes
Could not initialize video chain.
Video: no video

Exiting... (Quit)
[encode-lavc] Called a function on a failed encoding context. Bailing out.
[ao/lavc] not even ready to encode audio at end -> dropped
frozenpandaman commented 5 years ago

Awesome. Thanks!

ekisu commented 5 years ago

I don't know if this is specific to libx264 or anything, but I think it won't hurt to change for all codecs anyway. Thanks!