Ahmad.Masood
Ahmad.Masood

Reputation: 1309

ffmpeg: Speeding you frame extraction process.

I'm trying to extract frames from a video. The problem which i'm facing is process takes bit long. I want to know is there a way to speed up this process?

I'm using following command to extract frames.

ffmpeg -i output2.mp4 -vf fps=20 right%01d.tga

The above command gives me all the frames from video at 20 fps.

Upvotes: 0

Views: 539

Answers (1)

llogan
llogan

Reputation: 134173

There isn't that much you can do.

Threading

The FFmpeg encoder targa has no threading capabilities (see ffmpeg -h encoder=targa).

Compression

This encoder has one private option: -rle to enable/disable run-length compression. Default is -rle 1 which enables this compression. Compression can increase encoding time but may decrease the time to write the output files. Depending on the content, compression can also significantly decrease output file size which is why -rle 1 may be faster despite any overhead introduced by compression during encoding.

Bottlenecks

The first bottleneck is likely the writing of the output files followed by encoding: or vice-versa depending on your system and input, but you provided almost no information or details. You may see a performance increase if you output to another drive or if you use tmpfs. Once I/O bottleneck is averted you may see a performance increase with -rle 0, but with the likely downside of bigger files.

Do you need Targa?

Try a different format if speed is of utmost importance. You'll have to experiment to find what is fastest and fits your requirements.

Upvotes: 1

Related Questions