Author Topic: Creating a video from pictures - anything in a library somewhere?  (Read 3313 times)

0 Members and 1 Guest are viewing this topic.

Offline Richard

  • Seasoned Forum Regular
  • Posts: 364
    • View Profile
Suppose I have a series of pictures (screenshots) all of the same very common format (and frame size).

I wish to create a video (don't know which format - which ever is recommended) and play it back later with at least a single step through all the frames feature (as well as normal speed play).

Anything already in a library somewhere that I can program using QB64?

Offline _vince

  • Seasoned Forum Regular
  • Posts: 422
    • View Profile
Re: Creating a video from pictures - anything in a library somewhere?
« Reply #1 on: November 21, 2020, 05:21:10 am »
If it's a series of screenshots and not a compressed video file then have you tried simply using LOADIMAGE and then PUTIMAGE in a loop?

If you want to play a compressed video file (ie mpeg4) then what sort of video resolution (frame dimensions) and frame rate are you aiming for? If those are fairly low then there are tricks but otherwise you'd be looking at trying to get a video decoder working with DECLARE LIBRARY or perhaps you want to code it in QB64 yourself

Offline Richard Frost

  • Seasoned Forum Regular
  • Posts: 316
  • Needle nardle noo. - Peter Sellers
    • View Profile
Re: Creating a video from pictures - anything in a library somewhere?
« Reply #2 on: November 21, 2020, 06:12:53 am »
There's another option that might apply - an animated GIF.   I uploaded a series of
screenshots (taken using some picture save SUB I found in these Forums) to some
website which created the attached for me.   It's a clock, eh?
« Last Edit: November 21, 2020, 06:14:03 am by Richard Frost »
It works better if you plug it in.

Offline Richard

  • Seasoned Forum Regular
  • Posts: 364
    • View Profile
Re: Creating a video from pictures - anything in a library somewhere?
« Reply #3 on: November 21, 2020, 06:24:55 am »
If it's a series of screenshots and not a compressed video file then have you tried simply using LOADIMAGE and then PUTIMAGE in a loop?

If you want to play a compressed video file (ie mpeg4) then what sort of video resolution (frame dimensions) and frame rate are you aiming for? If those are fairly low then there are tricks but otherwise you'd be looking at trying to get a video decoder working with DECLARE LIBRARY or perhaps you want to code it in QB64 yourself


A glitch occurred while preparing my reply - the above quote was not selected by me and my reply message appears to be deleted and not sent
 

Offline _vince

  • Seasoned Forum Regular
  • Posts: 422
    • View Profile
Re: Creating a video from pictures - anything in a library somewhere?
« Reply #4 on: November 21, 2020, 06:45:02 am »
There's another option that might apply - an animated GIF.

Does QB64's LOADIMAGE support animated GIFs? I'm guessing not but it would be a damn neat feature. You could have some variant of LOADIMAGE return several image handles (as opposed to a single one) and then you'd be free to write your own purpose built 'player' with just PUTIMAGE

Offline Richard

  • Seasoned Forum Regular
  • Posts: 364
    • View Profile
Re: Creating a video from pictures - anything in a library somewhere?
« Reply #5 on: November 21, 2020, 06:46:45 am »
@ Vince  @ Richard   - thanks for reply


Have considered LOADIMAGE, PUTIMAGE, (even BSAVE/BLOAD), etc for LOSELESS high resolution (3200x1800) and concatenating images into single file (with index table for offset/length of each) possible even trying to use 7zip for compression of (.bmp -> .png) files used. PLAYBACK via file loaded onto 8Gbyte RAMDRIVE (configured from 32GB RAM). Expect to be able to do OK.

To be able to produce a standard AV file and playback same (have yet to try VLC record(?)/playback under QB64 control) would be nice. Possibly would benefit from separate modules dedicated for high/low resolutions/quality/speed.

.gif approach looks interesting for me to investigate.

Possibly might want to apply "very aggressive compressing" - eg if say have 100 frames and 50% each frame never changes, only save "DELTA" changes of the 100 frames (prior/after any of above processing) - maybe turning out to be a very large "movie .gif".

Offline Petr

  • Forum Resident
  • Posts: 1720
  • The best code is the DNA of the hops.
    • View Profile
Re: Creating a video from pictures - anything in a library somewhere?
« Reply #6 on: November 21, 2020, 07:17:03 am »
I don't know about anyone on the forum yet who could save a series of images in AVI / MP4 or MKV formats. And I'm not even talking about the need to store sound there. Of course, there are definitely a few excellent programmers who can do it, but I'm not one of them. So far, I've just seen the use of the above-mentioned procedure, where the individual images are inserted over each other using _PUTIMAGE. That's enough, thanks to the SaveImage library, you can create a container that can contain PNG images and an audio track, or, Dav showed a demonstration of how to add photos to an OGG file and then make a video from them. Of course, these are all functional paths, but they are not usable outside of QB64. Regarding the GIF format. There is - and is not - a limit of 256 colors. If someone wants to start with a GIF87a decoder (that is, an image, not an animation), I would probably try the reverse procedure of which SaveImage for GIF format works. Then, if you can load a GIF without LOADIMAGE, I assume it won't be such a big step to being able to read GIF 89a (with animation). Any documentation on the GIF format, as detailed as possible, is welcome, because I would also like to use the animated GIF format. So far, I have not gone further than a superficial study of this format. Also, if you are able to get detailed information about the internal structure of the uncompressed AVI format, which is compatible and should be the easiest to write, I would definitely try to look at it. Without promise.

Offline SMcNeill

  • QB64 Developer
  • Forum Resident
  • Posts: 3972
    • View Profile
    • Steve’s QB64 Archive Forum
Re: Creating a video from pictures - anything in a library somewhere?
« Reply #7 on: November 21, 2020, 09:37:11 am »
I don't know about anyone on the forum yet who could save a series of images in AVI / MP4 or MKV formats. And I'm not even talking about the need to store sound there. Of course, there are definitely a few excellent programmers who can do it, but I'm not one of them. So far, I've just seen the use of the above-mentioned procedure, where the individual images are inserted over each other using _PUTIMAGE. That's enough, thanks to the SaveImage library, you can create a container that can contain PNG images and an audio track, or, Dav showed a demonstration of how to add photos to an OGG file and then make a video from them. Of course, these are all functional paths, but they are not usable outside of QB64. Regarding the GIF format. There is - and is not - a limit of 256 colors. If someone wants to start with a GIF87a decoder (that is, an image, not an animation), I would probably try the reverse procedure of which SaveImage for GIF format works. Then, if you can load a GIF without LOADIMAGE, I assume it won't be such a big step to being able to read GIF 89a (with animation). Any documentation on the GIF format, as detailed as possible, is welcome, because I would also like to use the animated GIF format. So far, I have not gone further than a superficial study of this format. Also, if you are able to get detailed information about the internal structure of the uncompressed AVI format, which is compatible and should be the easiest to write, I would definitely try to look at it. Without promise.

https://www.qb64.org/wiki/GIF_Images
https://github.com/SteveMcNeill/Steve64 — A github collection of all things Steve!

Offline Petr

  • Forum Resident
  • Posts: 1720
  • The best code is the DNA of the hops.
    • View Profile
Re: Creating a video from pictures - anything in a library somewhere?
« Reply #8 on: November 21, 2020, 12:22:56 pm »
Thank you, Steve. I didn't know about this source code. I will study him now. I see a lack of my knowledge right at the beginning. Bit operations. I will have to make many attempts to understand what each bit operation is doing. That's why I've used very slow strings for this purpose so far. Definitely thank you. It's an absolutely great opportunity!

Offline Pete

  • Forum Resident
  • Posts: 2361
  • Cuz I sez so, varmint!
    • View Profile
Re: Creating a video from pictures - anything in a library somewhere?
« Reply #9 on: November 24, 2020, 03:44:07 am »
https://www.qb64.org/wiki/GIF_Images

Now I'm curious if Zom-B updated his gif routine for QB64, or if someone did that from his original QB45 code. I recall this from the QBasic Forum some 15 to 20 years back.

Pete
Want to learn how to write code on cave walls? https://www.tapatalk.com/groups/qbasic/qbasic-f1/