flv: taking screenshot at keyframe?

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

flv: taking screenshot at keyframe?

Timothee Groleau-3
Hi,

I am working on an application where we need to extract screenshots from
a flv file to act as seek thumbnails.

Dividing the flv duration to get timestamps and using the command below
works fine to get the thumbnails BUT seeking does not always work
because the flash player flv seeking can only seek to keyframes.

The command we use is this:
ffmpeg -y -i input.flv -f image2 -ss 12 -vframes 1 -an thumb1.jpg


Is it possible to instruct ffmpeg to take a screenshot of the nearest
(earlier) keyframe of a given timestamp? If not, can ffmpeg return the
keyframe timestamps for us to pick one before we pass that timestamp as
the 'ss' parameter?

Thanks,
Tim.
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://lists.mplayerhq.hu/mailman/listinfo/ffmpeg-user
Reply | Threaded
Open this post in threaded view
|

Re: flv: taking screenshot at keyframe?

Stefano Sabatini
On date Monday 2007-12-17 14:31:18 +0800, Timothee Groleau encoded:

> Hi,
>
> I am working on an application where we need to extract screenshots from
> a flv file to act as seek thumbnails.
>
> Dividing the flv duration to get timestamps and using the command below
> works fine to get the thumbnails BUT seeking does not always work
> because the flash player flv seeking can only seek to keyframes.
>
> The command we use is this:
> ffmpeg -y -i input.flv -f image2 -ss 12 -vframes 1 -an thumb1.jpg
>
>
> Is it possible to instruct ffmpeg to take a screenshot of the nearest
> (earlier) keyframe of a given timestamp?

I think you can't (without to hack ffmpeg.c).

> If not, can ffmpeg return the keyframe timestamps for us to pick one
> before we pass that timestamp as the 'ss' parameter?

Check ffprobe -show_frames (you need to download and compile it from
the sourceforge SVN).

[...]

HTH, regards.
--
ffmpeg-user random tip #18
G-mane ffmpeg-user archive:
http://dir.gmane.org/gmane.comp.video.ffmpeg.user
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://lists.mplayerhq.hu/mailman/listinfo/ffmpeg-user
Reply | Threaded
Open this post in threaded view
|

Re: flv: taking screenshot at keyframe?

Michel Bardiaux-2
Stefano Sabatini a écrit :

> On date Monday 2007-12-17 14:31:18 +0800, Timothee Groleau encoded:
>> Hi,
>>
>> I am working on an application where we need to extract screenshots from
>> a flv file to act as seek thumbnails.
>>
>> Dividing the flv duration to get timestamps and using the command below
>> works fine to get the thumbnails BUT seeking does not always work
>> because the flash player flv seeking can only seek to keyframes.
>>
>> The command we use is this:
>> ffmpeg -y -i input.flv -f image2 -ss 12 -vframes 1 -an thumb1.jpg
>>
>>
>> Is it possible to instruct ffmpeg to take a screenshot of the nearest
>> (earlier) keyframe of a given timestamp?
>
> I think you can't (without to hack ffmpeg.c).
>
>> If not, can ffmpeg return the keyframe timestamps for us to pick one
>> before we pass that timestamp as the 'ss' parameter?
>
> Check ffprobe -show_frames (you need to download and compile it from
> the sourceforge SVN).
>
But beware: I am not at all sure -ss is frame-accurate.
--
Michel Bardiaux
R&D Director
T +32 [0] 2 790 29 41
F +32 [0] 2 790 29 02
E mailto:[hidden email]

Mediaxim NV/SA
Vorstlaan 191 Boulevard du Souverain
Brussel 1160 Bruxelles
http://www.mediaxim.com/
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://lists.mplayerhq.hu/mailman/listinfo/ffmpeg-user
Reply | Threaded
Open this post in threaded view
|

Re: flv: taking screenshot at keyframe?

Timothee Groleau-3
On Mon, 2007-12-17 at 11:32 +0100, Michel Bardiaux wrote:

> Stefano Sabatini a écrit :
> > On date Monday 2007-12-17 14:31:18 +0800, Timothee Groleau encoded:
> >> Hi,
> >>
> >> I am working on an application where we need to extract screenshots from
> >> a flv file to act as seek thumbnails.
> >>
> >> Dividing the flv duration to get timestamps and using the command below
> >> works fine to get the thumbnails BUT seeking does not always work
> >> because the flash player flv seeking can only seek to keyframes.
> >>
> >> The command we use is this:
> >> ffmpeg -y -i input.flv -f image2 -ss 12 -vframes 1 -an thumb1.jpg
> >>
> >>
> >> Is it possible to instruct ffmpeg to take a screenshot of the nearest
> >> (earlier) keyframe of a given timestamp?
> >
> > I think you can't (without to hack ffmpeg.c).
> >
> >> If not, can ffmpeg return the keyframe timestamps for us to pick one
> >> before we pass that timestamp as the 'ss' parameter?
> >
> > Check ffprobe -show_frames (you need to download and compile it from
> > the sourceforge SVN).


Thanks Stefano and Michel,

I found a PHP utility (http://code.google.com/p/flv4php/) which lets me
get the keyframes timestamps. This works for me since our project is
web-based.

 

> But beware: I am not at all sure -ss is frame-accurate.

I'll test that out and hopefully it will work in most cases.

In case I do hit problems again though, is there another option to
specify the frame number to extract, instead of a timestamp?

Thanks!
Tim.

_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://lists.mplayerhq.hu/mailman/listinfo/ffmpeg-user