user30803
user30803

Reputation: 875

ffmpeg frame grabbing slow on mp4 files

The following ffmpeg frame grab command takes a long time to grab an image from the mp4 file.

ffmpeg.exe -itsoffset -200 -i C:\93844428.mp4 -vcodec mjpeg -vframes 1 -y -an -f rawvideo -s 640x360 C:\test\out1.jpg

For a 20MB file (about 2 minutes of video) it takes up to about 6 seconds to find the image depending on what offset (in seconds) you ask to grab it.

For a 100MB it can anything in many minutes if you request a large offset.

This only appears to be an issue with mp4 files.

Is there anything that can be done to improve this?

Upvotes: 1

Views: 481

Answers (1)

av501
av501

Reputation: 6729

This logic is inefficient to do a frame grab. Don't use itsoffset. If you want frame at a particular location use the -ss switch to set the time offset you want the frame from.

Upvotes: 3

Related Questions