webm videos from ffmpeg say "Video can't be played because the file is corrupt."
When I try to view the webm videos I've created with ffmpeg in firefox on android, I get this error message. These videos work in chrome on android, and on firefox on my desktop:
http://www.eternalmachinery.com/ecar/tbucket18crf55.webm http://www.eternalmachinery.com/ecar/ebucket4crf55_s.webm
This webm video plays fine on the same firefox browser on android:
http://downloads.webmproject.org/media/video/webmproject.org/big_buck_bunny_trailer_480p_logo.webm
Commands to create these files were: ffmpeg -framerate 60 -i ebucket%04d.png -c:v libvpx-vp9 -crf 55 -b:v 0 -s 800x450 -deadline best ebucket4crf55_s.webm ffmpeg -framerate 60 -i tbucket%04d.png -c:v libvpx-vp9 -crf 55 -b:v 0 tbucket18crf55.webm
Android 7.0
Firefox 57.0.1
2.8.11-0ubuntu0.16.04.1
Todas as respostas (4)
After more searching, it was looking like a problem with ffmpeg defaulting to yuv444p and firefox not supporting it, but when I encoded it with yuv420p, it sometimes works when loaded directly, and still says it's corrupt when viewed in a web page:
The file: http://www.eternalmachinery.com/ecar/tbucket18crf55yuv420p.webm
The web page it's embedded in: http://www.eternalmachinery.com/ecar/
When I first tried to view it directly, it didn't load. After rebooting my phone, and loading it directly, it played fine. Then, moments later, loading directly, it wouldn't load again.
This file was created with: ffmpeg -framerate 60 -i tbucket%04d.png -c:v libvpx-vp9 -crf 55 -b:v 0 -pix_fmt yuv420p tbucket18crf55yuv420p.webm
And that yuv420p version still works fine with chrome on android, and firefox on my desktop.
Summary: firefox on android does not work with vp9 *or* yuv444p chroma subsampling.
Okay, the reason the webmproject.org file worked and mine didn't is theirs was encoded with vp8, and I used vp9. I then checked the combinations, and verified that firefox on android does not work with vp9 *or* yuv444p. So I guess this is two bugs in one.
The ffmpeg command line that worked was:
ffmpeg -framerate 60 -i tbucket%04d.png -c:v libvpx -crf 55 -b:v 0 -pix_fmt yuv420p tbucket18crf55yuv420pvp8.webm
The important parts being:
"-c:v libvpx" to specify the vp8 codec (the older codec for webm), and
"-pix_fmt yuv420p" to specify 4:2:0 chroma subsampling instead of full chroma 4:4:4: https://en.wikipedia.org/wiki/Chroma_subsampling#4:2:0
ffmpeg defaults to 4:4:4 because the input (png images) is 4:4:4.
I determined the difference between the two files with: ffmpeg -hide_banner -stats -i filename
The results included:
Input #0, matroska,webm, from 'big_buck_bunny_trailer_480p_logo.webm':
Stream #0:0: Video: vp8, yuv420p, 852x480, SAR 1:1 DAR 71:40, 50 fps, 50 tbr, 1k tbn, 1k tbc (default)
Input #0, matroska,webm, from 'tbucket18crf55yuv420p.webm':
Stream #0:0: Video: vp9 (Profile 0), yuv420p(tv), 800x450, SAR 1:1 DAR 16:9, 60 fps, 60 tbr, 1k tbn, 1k tbc (default)
All these combinations (vp9 + yuv444p) work on chrome on android and firefox on my desktop.
Modificado por Darxus a
The phone I'm testing this on is an LG G6.