thecodejack
thecodejack

Reputation: 13379

Generate images at given time from flv video using ffmpeg

I am using the following command in ffmpeg to generate thumbnails. It is working perfect.

ffmpeg -i videofile.flv -an -ss 01:00:00 -an -r 1 -vframes 1 -y ".$outputdir."/".$groupid."_".$i.".jpg

But problem is I have different seek times of a video from where thumbnails have to be generated and right now Iam using a loop which is running very slow. I found the reason as ffmpeg seeks to the given time for every command. I tried forking the process but is not effective. Is there anyways i can optimise the command so the repetitive seeks can be avoided?

Upvotes: 0

Views: 460

Answers (3)

nauni77
nauni77

Reputation: 137

it makes a lot of difference if you first define -i and later -ss or the other way around. For more information look at the answer from this post:

another question at stack overflow.com: ffmpeg weird behaviour

hth

Upvotes: 0

thecodejack
thecodejack

Reputation: 13379

After lot of research, found that its not possible. FFMPEG should consider adding option for this...it saves lot of execution time...

Upvotes: 0

Fengari
Fengari

Reputation: 483

Try this:

ffmpeg -ss 01:00:00 -i videofile.flv ....

Using -ss as an input option is often faster but can be less accurate. FFmpeg will immediately seek first and then begin decoding at your desired -ss value; however it is potentially not frame accurate as using -ss as an output option which additionally decodes everything before your -ss value.

Upvotes: 2

Related Questions