QB64 Phoenix Edition
generating an AVI file from still images? - Printable Version

+- QB64 Phoenix Edition (https://qb64phoenix.com/forum)
+-- Forum: QB64 Rising (https://qb64phoenix.com/forum/forumdisplay.php?fid=1)
+--- Forum: Code and Stuff (https://qb64phoenix.com/forum/forumdisplay.php?fid=3)
+---- Forum: Help Me! (https://qb64phoenix.com/forum/forumdisplay.php?fid=10)
+---- Thread: generating an AVI file from still images? (/showthread.php?tid=3508)



generating an AVI file from still images? - madscijr - 03-02-2025

With @SpriggsySpriggs' webcam code, we can capture still images as they come in at 30 FPS. Then QB64PE can further manipulate each frame as an image and display it to the screen & write to an image file. I find the lag to be minimal at 320x240 resolution. The one thing we don't have is the ability to output it to a video file (AVI or some common format), ideally appending to the file from QB64PE images as they come in?

I googled making an AVI file from still images, and didn't find anything in QB64. Everything I found indicated that making an AVI from scratch from frame data is a non-trivial task, but there is a Microsoft API for it, with an example at
https://www.wischik.com/lu/programmer/avi_utils.html that references "avi_utils.h". However Spriggsy looked at it and said it uses an interface, which he had not had any luck with in QB64PE.

I also found people talking about generating AVI from a bunch of image files using FFMPEG, so my low-hanging-fruit workaround would be to save still frames to a folder, then shell out to FFMPEG to make it a video.

I figure it can't hurt to ask, does anyone have any idea for generating a video file from a stream of images, say 320x240 at 30 FPS? If someone can figure out that API interface that might be a way, but that is way beyond me...


RE: generating an AVI file from still images? - SpriggsySpriggs - 03-02-2025

I guess I ain't moving fast enough for you lol. If you want to just dump them all to image sequences and then turn them into an AVI, just do it with ffmpeg until I can get something together.


RE: generating an AVI file from still images? - madscijr - 03-02-2025

(03-02-2025, 07:03 PM)SpriggsySpriggs Wrote: I guess I ain't moving fast enough for you lol. If you want to just dump them all to image sequences and then turn them into an AVI, just do it with ffmpeg until I can get something together.
Oh no worries... it just sounded like you thought it wasn't possible, because interfaces. 
But if you think maybe it's doable after all, by all means, at your leisure! 

Meanwhile I think I'll play with the 2 laptops over the network thing - I had this crazy idea that placing 2 cameras as far apart as a pair of eyes, where camera #1 renders its image in varying levels of brightness of cyan, and camera #2 in varying levels of red, and the 2 images superimposed, it could result in the old school 3D effect when you watch it with red/blue glasses...  Cool

But back to the AVI thing, another thought I had was that maybe FFMPEG has a command line switch to tell it to "append" a frame to the end of an existing movie, so as each frame comes in, it could add it on to the end of the file (as opposed to just saving all the still images first and making them into a movie later)...