Domanda

I am using ffmpeg to convert a set of images (bmps) with an audio track into Web ready video. Target formats are h.264 mp4, webm and flv. This is on a Windows Azure extra-large instance (8 proc) using the prebuilt zeranoe static builds ( http://ffmpeg.zeranoe.com/builds/).

Suppose I'm willing to sacrifice quality and size for raw speed. What options for each format will yield the quickest result?

My "baseline" command looks like this (swap the extension for the other formats):

ffmpeg -y -i frames%5d.bmp -i audio.mp3 -r 23.97 out.mp4

I can change the inputs to other formats if needed (jpg images, aac audio, etc).

È stato utile?

Soluzione

The major "knob" you change the quality/encoding speed balance for any format is the bitrate. In testing just now, a video that takes 97 seconds to encode with default settings, bitrate ~900k, took less than half that with the bitrate dialed down to 100k. The output video was much smaller, and the quality was noticeably worse.

In your case, coming from images, you can probably get a major speedup from turning off motion estimation as mentioned in FFmpeg's encoding tips:

If your computer is not fast enough, you can speed up the compression at the expense of the compression ratio. You can use ’-me zero’ to speed up motion estimation, and ’-g 0’ to disable motion estimation completely (you have only I-frames, which means it is about as good as JPEG compression). [Note that more recent versions of FFmpeg use -me_method in place of -me.]

In testing, the 97-second encode finished in 20 seconds with -g 0. There was much less compression, 63% the original size versus 25% with default settings, but the quality remains good unlike low-bitrate encodings.

Here are the complete results from my quick testing, time is real time used for encoding:
Baseline, 27M MOV to mp4, bitrate ~900k: 97s
with -me_method zero: 84s
with -flags2 fast: 84s
with -b 500k: 75s
with -b 100k: 43s
with -g 0: 20s

with -flags2 fast and -b 100k and -g 0: 12s (the output looks terrible)

There might be other format-specific tweaks, but I wouldn't expect significant speedups from those compared to the methods listed above..

Altri suggerimenti

What is the resolution of these images? Using as low as a resolution as possible will give you better performance. Also use the -threads option in ffmpeg to use the 8 cores optimally.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top