How to fast convert mp4 to webm using ffmpeg?

I have to convert 76 mp4 files to webm for the purpose of a website that uses HTML5 videos. I'm talking about 10 Gb of mp4 files... I know I can simply ask ffmpeg to do that using:

ffmpeg -i input_file.mp4 output_file.webm

Of course I'll do it recursively by:

find ./ -name '*.mp4' -exec bash -c 'ffmpeg -i "$0" "${0%%.mp4}.webm"' {} \;

I even tried something I found somewhere on the internet:

ffmpeg -i input_file.mp4 -cpu-used 4 -threads 8 output_file.webm

But the thing is that it won't take me less than a week!!! What am I doing wrong? Is there any possible way to speed that up? If I convert to ogg will I gain on speed? Please help!!!


Solution 1:

Transcoding video takes time. It also takes a lot more knowledge about encoding parameters; ffmpeg's defaults are unlikely to be suitable for you and may not even create a usable output file.

Here's a start:

Encoding webm using ffmpeg (Archived)

Those settings will encode to a particular average bitrate (video bitrate of 3900kbit), so there will be spikes in the bitrate.

MP4 and WebM use different video codecs, so there is no short-cut; video must be transcoded.

Encoding speed, of course, will vary immensely depending on the frame size, frame rate, and quality settings. For a 720p encode you might expect to be able to encode roughly 1:1 (ie 10 hours of video in 10 hours) on a CPU from the last couple of years. If you do two-pass ABR encoding like in the example given in the link, almost double that.

Solution 2:

Double that or half cut that? So it's a dead end.. I won't be playing with bitrates, I never know what to expect from quality or size.. I think I'll stick to this one and make the client hold on till conversion is over..

find ./ -name '*.mp4' -exec bash -c 'ffmpeg -i "$0" -vcodec libvpx -acodec libvorbis -cpu-used 5 -threads 8 "${0%%.mp4}.webm"' {} \;

I'm posting it for future users, actually I gained on speed but my CPU is working like hell: 60 to 80% on each core! Now I think it will take less time: 3 days instead of 6 or 7.. I hope it won't break it down.. ^_^

Thank you anyway man!

Edit: Removed the switch -sameq after comments from LordNeckbeard and neon_overload -sameq does not mean same "quality"