Open Damix48 opened 1 year ago
ffmpeg -skip_frame nokey -i file -frame_pts true -vf scale=320:-1 -qscale:v 10 -vsync 0 -r 1000 kf-%10d.jpg
can produce files which have their timestamp in milliseconds. I suppose that could be used to find frames which are the closest to the prescribed interval. The question becomes how to deal with the gaps, as trickplay formats usually require there to not be holes in the series of images.
I have tested keyframes before when using the BIF format and my problem was that I didn't get nearly as many frames output which led to much less useful trickplay images. Generally, my goal is that if you're hovering over some point on the timeline the image previewed is going to be what you see when you skip there, but with keyframes that's usually not the case (at least from the very limited testing I did).
Is ffmpeg
requirement? Because I often use mplayer
(http://www.mplayerhq.hu) and it's very fast. I extract 1 frame each 10s in about 50s (same movie of the tests before). ~15x faster of standard and ~2x faster of keyframe only.
The only problem is that I'm not sure how precise mplayer is.:
mplayer $file -ss 1 -nosound -zoom -xy 320 -vo jpeg:outdir=./output -frames $frames -sstep $steps
where:
$steps
is 10 (10s)$frames
is duration of movie / $steps
This command generates ~200 same ending frames. I only tried it on Windows and maybe I do the wrong calculation.
I would be nice extracting the keyframes instead of any frames. This trick improves by 5x-7x the generation of the previews.
example:
-skip_frame nokey
to process only the keyframes-vf scale=320:-1
to scale the frames to be 320px width-qscale:v 10
quality?, not really necessary because the images are so smallThe keyframe methods is 7.7x faster!
The main drawback is that isn't not possible to specify exactly how many frames create or how many seconds from frame to frame.
references: