bgrins / videoconverter.js

[UNMAINTAINED] Convert videos in your browser
http://bgrins.github.io/videoconverter.js/
Other
2.35k stars 300 forks source link

Converting Gif to WebM creates a corrupted video #15

Open DawsonG opened 10 years ago

DawsonG commented 10 years ago

I'm attempting to create a .webm video from a gif. I was able to use this rather bloated command passed to a web worker to create a .mp4 from a gif.

-i $input -y -strict experimental -acodec acc -ac 2 -ab 160k -vcodec libx264 -s $size -pix_fmt yuv420p -preset slow -profile:v baseline -level 30 -maxrate 10000000 -bufsize 10000000 -b 1200k -f mp4 -threads 0 output.mp4

where $input is the name of the user file and $size is the size of the gif. For .webm conversion I'm using the following command.

-i $input -c:v libvpx -crf 12 -b:v 500k output.webm

This command works fine when run in the terminal of my local machine, but when run in my application or against the demo application it results in either an empty .webm file or one like this: screenshot 2014-10-19 18 13 33

Any help would be appreciated.

bgrins commented 10 years ago

Yes, I think there is something messed up with VP8 - I've tried changing a bunch of different options when compiling but never been able to get it to unscramble. As a workaround I think you could use: -c:v libvpx-vp9, but this will use the VP9 codec. I don't have any real pointers - but if you want to try to build it yourself using this script or a variation of it: https://github.com/bgrins/videoconverter.js/blob/master/build/build_all_codecs.sh maybe it will work - I'd love to see if you get different results.

For another example, run the demo app with:

-t 3 -i input.webm -vf showinfo -strict -2 output.webm

Notice that it's scrambled. But if you run with:

-t 3 -i input.webm -vf showinfo -strict -2 -c:v libvpx-vp9 output.webm

it works fine.

DawsonG commented 10 years ago

The vp9 codex works great, although it's a bit slow compared to other conversions -- including the broken vp8. I'm going to take a crack at building it; I'll let you know how it goes. In the meantime, thanks for your help.

ravendareriver commented 9 years ago

maybe this one can work better, I used it to convert mp4 to webM and between http://www.bigasoft.com/articles/convert-vp9-webm-to-mp4.html

duanyao commented 9 years ago

Using latest libvpx and ffmpeg in PR #30, vp8 encoder works fine for me. @DawsonG can you test it?

DawsonG commented 9 years ago

Sure, I've been using vp9 successfully for awhile, but I'll fire it up and see.

DawsonG commented 9 years ago

@duanyao I ran into problems completing the build process that I don't want to take the time to fix. Would you mind updating the pre-built .js files in your repo? I'll use those and tell you how it goes.

duanyao commented 9 years ago

I created a release that you can use: https://github.com/duanyao/videoconverter.js/releases/download/v0.2/ffmpeg_js-v0.2.zip

P.S. what are the problems you encountered? You need very recent emscripten (1.32.x) and run pull_source.sh and build.sh in build_edge.