Frames at a particular (interval) distance

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

Frames at a particular (interval) distance

oana1404
Hi,

I'm trying to extract key frames from a video using the following option: eq(pict_type\,I). However, there are lot of keyframes, and I wouldn't want to get all of them. Thus, I've been thinking to get the timestamps only for keyframes at a difference between 50 and 60 seconds. Is there a way to do that?
For example, if the timestamps are the following:  
t:18.320000
t:24.160000
t:35.880000
t:37.800000
t:47.040000
t:52.840000
t:55.840000
t:64.200000
t:66.080000
t:77.720000
t:80.320000
 I would like to have only t:52.840000.
Thank you!
Reply | Threaded
Open this post in threaded view
|

Re: Frames at a particular (interval) distance

Tom Evans
On Tue, Mar 18, 2014 at 2:57 PM, oana1404 <[hidden email]> wrote:
> Hi,
>
> I'm trying to extract key frames from a video using the following option:
> eq(pict_type\,I). However, there are lot of keyframes, and I wouldn't want
> to get all of them. Thus, I've been thinking to get the timestamps only for
> keyframes at a difference between 50 and 60 seconds. Is there a way to do
> that?

Yes, as listed in the docs for the select filter:

Select only I frames contained in the 10-20 time interval:


select=between(t\,10\,20)*eq(pict_type\,I)

http://ffmpeg.org/ffmpeg-filters.html#select_002c-aselect

Cheers

Tom
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user
Reply | Threaded
Open this post in threaded view
|

Re: Frames at a particular (interval) distance

Renato Santos
In reply to this post by oana1404
Can you test if using this work for you?

select=mod(n\, 10)*eq(pict_type\,I)

where 10 you change until you got

* works like AND
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user
Reply | Threaded
Open this post in threaded view
|

Re: Frames at a particular (interval) distance

oana1404
In reply to this post by oana1404
I managed to select the frames that I need. Now, I want to cut the video based on the frame numbers that I extracted earlier.
For this, I'm using the following command:
ffmpeg -i input -f segment -segment_frames 1283,2544,3793 -c copy -map 0 segment_%03d.mp4
However, instead of having 4 fragments, I get 5. The last part of the video splits into two. Also, for some videos this behavior doesn't happen.
Do you have any idea about this?