Ubuntu – How to fast convert mp4 to webm using ffmpeg

.mp4conversionffmpegvideowebm

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!!!

Best Answer

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.

Related Question