zmwangx / rust-ffmpeg

Safe FFmpeg wrapper.
Do What The F*ck You Want To Public License
1.3k stars 203 forks source link

Can't decode valid media files due to warnings from ffmpeg decoder #211

Open rkfox opened 1 month ago

rkfox commented 1 month ago

Running ffmpeg_next::format::input("/path/to/media.mp4") returns an error if ffmpeg displays any warnings during decoding. The warnings are also displayed in the console and can't be hidden.

Some of the warnings I have received are related to decoding GIF and animated WEBP files, but ffmpeg may return warnings from any valid media files depending on the settings that were used to encode it. Some of the decoding warnings may look like this:

Following up on these warnings with tests using ffmpeg binaries reveals that they are valid files that should be able to be decoded without any errors despite the warnings.

The webp issues are most likely due to ffmpeg not being able to decode animated webp, but these messages still should not be printed to the command line without the option to hide them; they should be in the Err(error) value and could be printed from there if desired.

There are two issues here. One is that all of these warnings are being printed to the console without the option to hide them; this shouldn't be the case even if they were errors. The second issue is that an error is being returned from ffmpeg_next::format::input() on valid media files.

I imagine that both issues should be easy to fix, but I haven't dug into the code to see if it is.