Closed dchatel closed 8 months ago
@zappityzap
@dchatel This looks like code to read a WebP video, but what is the request?
This extension uses the Gradio Video element to load source videos, and the Video element only appears to support loading MP4 and WebM.
Sorry, the request would be to be able to load animated webp files as a video input.
I've used the gradio video element before to load animated webp. The animated webp is shown as a plain black image on the frontend, but you still can load it just fine on the backend. It's not "perfect" on the frontend, of course, but it gets the job done and it's better than nothing.
I see what you mean. scripts/animatediff_cn.py uses OpenCV in function get_input_frames() to get the frames from the video file, and it doesn't load animated WebP correctly. It should be possible to replace OpenCV with ImageIO for getting frames from videos, but it's not a high-priority for me.
2023-11-30 14:32:46,025 - AnimateDiff - WARNING - entered get_input_frames()
2023-11-30 14:32:46,025 - AnimateDiff - WARNING - get_input_frames: params.video_source = /tmp/gradio/7491ad3ecc79bc9d790de4b0ccbd1886fba93289/00000-1046048558.webp
[webp @ 0x7f0ccbe96ec0] invalid TIFF header in Exif data
[webp @ 0x7f0ccbe96ec0] image data not found
2023-11-30 14:32:46,027 - AnimateDiff - WARNING - cap opened
2023-11-30 14:32:46,027 - AnimateDiff - WARNING - reading a frame
[webp @ 0x7f0cc3ebeb80] invalid TIFF header in Exif data
[webp @ 0x7f0cc3ebeb80] image data not found
2023-11-30 14:32:46,049 - AnimateDiff - WARNING - cap released
I have already implemented ffmpeg video extraction logic in another project. not sure if it will work for all the formats.
there is ffmpeg right now but I'm not sure if it will work for webp animation. Will close for now. let me know if it's not working
Expected behavior