Lazarus
Programming => Graphics and Multimedia => Audio and Video => Topic started by: pcurtis on May 25, 2021, 11:05:19 am
-
How can I grab images from a video clip at random positions?
For example I have a clip of 600 seconds. I want to grab images after 10, 90, 300 and 550 seconds.
-
The source of the video is camera or a file?
/BlueIcaro
-
File
-
hello,
for example use lazvlc to use vlc as video reader. And use the position and snapshot functions to capture a video frame at a particular time.
Friendly, J.P
-
you have also paslibvlc
see attachments
-
Thanks. I don't like VLC, but I did the same thing with MPV.
-
You could use the ffmpeg library.
I think i have a snippet somewhere, where i fire up ffmpeg in a TProcess, extracting jpeg's from a video-file incl seeking to specific time-positions
-
If you have it I would like a look. I tried ffmpeg, but it was slow (probably due to my incorrect use) where it started to seek from 0 to the required frame. Doing this for each image.
-
hello,
If you have it I would like a look. I tried ffmpeg, but it was slow (probably due to my incorrect use) where it started to seek from 0 to the required frame. Doing this for each image.
you can try the RunFFmpeg Demo project from here (https://forum.lazarus.freepascal.org/index.php/topic,43411.msg303762.html#msg303762) in the zip file FFGrab4Laz_01.7z read instructions to install ffmpeg for that.
change the grab command to what you want.
For example to extract the frame at 10 seconds in my mp4 file Bear in the Woods :
-ss 00:00:10 -i "D:\temp\Bear In The Woods.mp4" -vframes 1 -q:v 2 screenhot.jpg
Friendly, J.P
-
Now I remember why I stopped using ffmpeg.
I couldn't figure out how to pass a list of unevenly spaced times to grab.