Recent

Author Topic: [SOLVED] Grab images from video  (Read 2854 times)

pcurtis

  • Hero Member
  • *****
  • Posts: 634
[SOLVED] Grab images from video
« 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.
« Last Edit: May 25, 2021, 05:52:09 pm by pcurtis »
Windows 10
Laz 2.0.10
FPC 3.2.0

BlueIcaro

  • Hero Member
  • *****
  • Posts: 655
    • My github
Re: Grab images from video
« Reply #1 on: May 25, 2021, 12:36:04 pm »
The source of the video is camera or a file?

/BlueIcaro

pcurtis

  • Hero Member
  • *****
  • Posts: 634
Re: Grab images from video
« Reply #2 on: May 25, 2021, 01:29:49 pm »
File
Windows 10
Laz 2.0.10
FPC 3.2.0

Jurassic Pork

  • Hero Member
  • *****
  • Posts: 987
Re: Grab images from video
« Reply #3 on: May 25, 2021, 01:44:27 pm »
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
Jurassic computer : Sinclair ZX81 - Zilog Z80A à 3,25 MHz - RAM 1 Ko - ROM 8 Ko

Jurassic Pork

  • Hero Member
  • *****
  • Posts: 987
Re: Grab images from video
« Reply #4 on: May 25, 2021, 05:30:45 pm »
you have also paslibvlc

see attachments
Jurassic computer : Sinclair ZX81 - Zilog Z80A à 3,25 MHz - RAM 1 Ko - ROM 8 Ko

pcurtis

  • Hero Member
  • *****
  • Posts: 634
Re: Grab images from video
« Reply #5 on: May 25, 2021, 05:50:42 pm »
Thanks. I don't like VLC, but I did the same thing with MPV.
Windows 10
Laz 2.0.10
FPC 3.2.0

Zvoni

  • Hero Member
  • *****
  • Posts: 627
Re: [SOLVED] Grab images from video
« Reply #6 on: May 26, 2021, 08:50:33 am »
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
One System to rule them all, One IDE to find them,
One Code to bring them all, and to the Framework bind them,
in the Land of Redmond, where the Windows lie
---------------------------------------------------------------------
People call me crazy, because i'm jumping out of perfectly fine aircraft

pcurtis

  • Hero Member
  • *****
  • Posts: 634
Re: [SOLVED] Grab images from video
« Reply #7 on: May 26, 2021, 10:01:21 am »
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.
Windows 10
Laz 2.0.10
FPC 3.2.0

Jurassic Pork

  • Hero Member
  • *****
  • Posts: 987
Re: [SOLVED] Grab images from video
« Reply #8 on: May 26, 2021, 10:44:29 am »
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 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 :
Quote
-ss 00:00:10 -i "D:\temp\Bear In The Woods.mp4" -vframes 1 -q:v 2 screenhot.jpg

Friendly, J.P
Jurassic computer : Sinclair ZX81 - Zilog Z80A à 3,25 MHz - RAM 1 Ko - ROM 8 Ko

pcurtis

  • Hero Member
  • *****
  • Posts: 634
Re: [SOLVED] Grab images from video
« Reply #9 on: May 26, 2021, 12:31:29 pm »
Now I remember why I stopped using ffmpeg.

I couldn't figure out how to pass a list of unevenly spaced times to grab.
Windows 10
Laz 2.0.10
FPC 3.2.0

 

TinyPortal © 2005-2018