Author Topic: AVI to BMP extraction  (Read 3465 times)


  • Newbie
  • Posts: 1
AVI to BMP extraction
« on: August 01, 2016, 02:24:04 pm »

Does anybody know the easiest way how to extract bmp frames from avi in Lazarus. I want to know how to read   information from videostream (from the texture) into twodimensional array of byte where the array will represent bmp texture without bitmap header. Thank you.


  • Full Member
  • ***
  • Posts: 151
Re: AVI to BMP extraction
« Reply #1 on: September 28, 2016, 05:33:56 am »
Take a look my LibFFPlay ->,33105.0.html
Modify the Cb_display function to fit your propose.
Notice: LibFFPlay is a player, it decodes real-time. If you want dump all frames in a video file, it will take time same as the video length.

Or you can directly deal with FFmpeg ->
Maybe you can find something in this example ->\examples\filtering_video.dpr


  • Full Member
  • ***
  • Posts: 154
Re: AVI to BMP extraction
« Reply #2 on: December 03, 2018, 02:13:49 pm »

At least the easiest Way to save VideoFrames to ImageFiles - with a little Help of FFmpeg's 'ffmpeg.exe' CommandLine Tool - is here:,43411.0.html
-> GoTo "[Grab]+[-i "grabbed.mkv" -map v frame%08d.png] will save the File's VideoFrames to PNG-ImageFiles.".

In Your Case, write  -i "videofile.avi" -map v frame%08d.bmp  into the first Line of 'RunFFmpeg' and click [Grab].

If You want to obtain the VideoFrames themselves and furthermore as fast as possible, there is no easy Way.
You have to open/read/close the VideoFile by Yourself.

The Dranger-Tutorial explains very well how to do it with C and FFmpeg-Libraries:
For how to read out FrameData, see
'Tutorial 01: Making Screencaps' -> GoTo: "the SaveFrame function" -> "Write pixel data".
For how to assign FrameData to BMP, see
'Tutorial 04: Spawning Threads' -> GoTo "copy the frame into the overlay" -> "/* point pict at the queue */.

For how to read out FrameData with FPC, see e.g.
attached '' -> 'mpegpas02\PacketRead5.pas' -> procedure 'SaveFrame()' -> "Write pixel data".
For how to assign FrameData to BMP with FPC, see here,26666.msg196377.html#msg196377
-> Dnload attached '' and GoTo "//* point pict at the queue */".

« Last Edit: December 05, 2018, 03:34:45 pm by metis »
Life could be so easy, if there weren't those f*** Details.