I'm using ffmpeg to generate image previews from flv videos. The OS is Debian 5 and it's the apt version of ffmpeg. The flv files are located on a NAS share that is mounted as NFS. Getting the thumbnails from the beggining of the flvs is pretty fast but is very slow when seeking above 10 minutes into the video. I call ffmpeg from python like so:

os.system('ffmpeg -ss "%d"  -i %s -an  -r 1 -vframes 1   -bufsize 1835k -s 360x288 -f image2 -vcodec mjpeg -y "%s"'%(offset_seconds, video_file_path,  image_path))

Is there a way to speed the seeking process towards the end of the flvs? What could cause it to be so slow?

I've tried the same thing on my local machine (Mac OS X snow leopard with ffmpeg compiled from source) and I can't feel any difference in speed when capturing images from the begging of the video and 50 minutes into the video.

Edit: The mentioned debian server has a faster hardware configuration than my local machine.

  • If you use some other software, e.g. vlc, to playback video at the 10 min mark? Would it make a difference in speed? You can use the --start-time option to jump to specific time.
    – some user
    Aug 9 '19 at 22:23

You've narrowed the problem down to the NFS mount. ffmpeg itself isn't changing its behavior 10 minutes into the input video -- if it did, you'd have noticed when you tried reading a video on local disk.

I bet that installing and running ffmpeg on the NFS server (so it's again local disk) would not show a slowdown 10 minutes in.

There may be some way to adjust the NFS configuration (caching?), but it's probably simpler to just copy the entire video to local disk and then have ffmpeg read that. It won't be slower: the data needs to be moved over anyways, because although ffmpeg needs only the pixels of one frame per second to make the thumbnails, it needs to read plenty more in between (keyframes) to reach and decode those few frames.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.