Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / Video playback question

Author
Message
Masqutti
16
Years of Service
User Offline
Joined: 8th Jan 2010
Location: insanity
Posted: 16th Mar 2012 00:50
Hi!

I've been wondering about video playback capabilities DBpro has. With those commands that are found in help, like load animation, play, pause, stop etc. You get the very basic control over video.

Is there a way to rewind video backwards, and what about jumping the video time as in normal media players, where you can click/drag the timeslider with your mouse and jump to different parts of a movie..??

Even manipulation of the video would be awesome, but hardly possible??? I'm talking about the very basic type, cutting, trimming and joining clips together as in movie editor.

hmmmh.. that didn't compile
MrValentine
AGK Backer
15
Years of Service
User Offline
Joined: 5th Dec 2010
Playing: FFVII
Posted: 17th Mar 2012 06:34
should be relatively easy... like have an sprite along the bottom and ave its horizontal [x-axis] represent the total frames of the video and then have that relay the frame position of the video...

I am just hinting on a concept...

But keep to see if this goes anywhere...

also try Divx encoded .avi clips for quality and compression...

Fallout
23
Years of Service
User Offline
Joined: 1st Sep 2002
Location: Basingstoke, England
Posted: 17th Mar 2012 18:07
You can play an animation to an image, which gives you all the control you need over manipulating the video. You could have it displayed on a 3D object, flipped, fades etc, once it's in an image file. I used that in Carnage for the background menu effect.

But he's right in saying you have no control over starting playback at a specific point. That's definitely a missed trick. If you wanted to, for example, have 8 video sections in one video file, and start playing the video half way through, I can't see how you'd do that with the command set available.

Masqutti
16
Years of Service
User Offline
Joined: 8th Jan 2010
Location: insanity
Posted: 17th Mar 2012 18:44
MrValentine you mean that like a.. "scrollbar" ? Yeah that'd do it.. But then yes, i'm looking more like Fallout's comment about controlling the blayback starting point.

Is there anyone that would know more about things going on behind the play animation/pause animation and animation commands overall?

Thanks for the input so far!


Ok, one way I just thought of might be exporting the video to be just image sequence. Most video editors are capable to do that! Tho, it might be if a vid has thousands of frames, loading them all into the memory might be quite the overload. Also, the playback may not be smooth?? I'll give it a try.

hmmmh.. that didn't compile
MrValentine
AGK Backer
15
Years of Service
User Offline
Joined: 5th Dec 2010
Playing: FFVII
Posted: 17th Mar 2012 21:39
DBPro has I believe a 32 image limit or something...

but yeah i like Fallout's idea of video slices...

nice call Fallout cheers will keep it in mind

[I had thought about it before when I was doing movies... but you refreshed my memory ]

Masqutti
16
Years of Service
User Offline
Joined: 8th Jan 2010
Location: insanity
Posted: 18th Mar 2012 22:05 Edited at: 19th Mar 2012 00:11
Quote: "DBPro has I believe a 32 image limit or something..."


That's actually is a limit for bitmaps. Images(used for textures etc) Doesn't have such limit. Image number should be integer as sais in DBPro help, so that in mind you should be able to load integer amount of images into the memory.

That kinda means you can load images as much you have memory in your computer.

I'll test this image sequence idea and let you know how it works. Ofc the sound will be missing in this so you need to load that separately and syncing vid&audio might be a problem. It's ok for my application.

hmmmh.. that didn't compile
Masqutti
16
Years of Service
User Offline
Joined: 8th Jan 2010
Location: insanity
Posted: 18th Mar 2012 23:58 Edited at: 19th Mar 2012 00:20
Hi!

So I wrote some code to work this image sequence. It's not actually cleaned up, and it messes abit that my video exporter uses the filename -format, that's like filename-000000.jpg to filename-000100.jpg for example, in order from frame 0 to 100. I had to code some string formatting so it works.

Source code is here:


But better example can be found in my attachment. It includes a small videoclip of my dog running in the forest

Note that the resolution is 384*280, that's rather small res, and still it loads 140 frames pretty slowly. That's bad. with DVD-quality the loading time was horrible, so if you need fast loading, this is not the way to do it. But hey, this works and gives you detailed access to frames! ^^

And another bad thing about this. 140 frames of 384*280 images suck ~100M of memory. that means a 1 GB with 1400 frames...


To test the sample vid, run the application, and when it asks dir/Path, type in just "sample" and the filename is just "dog"!


EDIT: Looks like load image's attribute "texture flag" set to 1(to retain pixel perfect quality) speeds up loading enormously. Also it actually lowers the memory needed abit. Somehow "divide texture" attribute doesn't lower the memory needed, even when DBPRO help says it should.

hmmmh.. that didn't compile
Fallout
23
Years of Service
User Offline
Joined: 1st Sep 2002
Location: Basingstoke, England
Posted: 19th Mar 2012 00:19
I was thinking that you could perhaps create your own video format using the image method. Once you've exported your separate images, you could load them in and then plug them into memblocks and generate 1 large file. You could then save that file as your own format (simply a memblock full of images in sequence). Load that puppy back in later, and then extract 1 frame at a time from the memblock, convert to an image and display it.

The only negatives to all this messing about are compression (it'll never be as good as the compression in a normal video format), and secondly you can't stream the file and load on the fly, since DBP runs in a single thread. Although, you could open a file for reading, read 1 frame from it, display it, read the next, display it etc. I would imagine the access rate would be fast enough for a 25fps video.

basjak
16
Years of Service
User Offline
Joined: 16th Apr 2010
Location: feel like signing up for mars
Posted: 19th Mar 2012 05:02
@ mrvalentine: all the images and bitmaps limits are lifted with update 7.7, now you're free to create as many images as you want.
the limit now is [1, 22000000] however animation is still limited to 32.
MrValentine
AGK Backer
15
Years of Service
User Offline
Joined: 5th Dec 2010
Playing: FFVII
Posted: 19th Mar 2012 06:46
Masqutti + basjak

Cheers

Masqutti
16
Years of Service
User Offline
Joined: 8th Jan 2010
Location: insanity
Posted: 19th Mar 2012 15:48
^^

Quote: "Although, you could open a file for reading, read 1 frame from it, display it, read the next, display it etc. I would imagine the access rate would be fast enough for a 25fps video."


Fallout, yes. Actually as I did a timer to measure loading times for my example, it took 38 seconds to load 900 jpg-images, that were DVD resolution. And it was raw loading file per file. that means, 1 image loaded in 0,0422 secs, that is 23,6 frames per second. So it's almost enough. Lowering the resolution of the images directly speeds things up. Alot. So, this is one way to do it.

Making a videofile from memblock full of images is really alot faster yes, but the memory consumption is as huge as in my example I think. Then only option is to make smaller images in resolution in order to speed things up and save memory. Hehe, what about interlaced pictures?

I'm afraid that saving a file of that kind of huge memoryblock of images would consume excessive amounts of hard disk space compared to JPG image-sequence, as those images are in uncompressed format inside memory when used by DBPro.

Actually one way to do it would be making 1 huge image from the frames It would be saved as a JPG, and later loaded back into memory as a raw material to be used That would save the hard disk space.

But I feel that the worst problem is the memory consumption with huge blocks..

hmmmh.. that didn't compile
mr Handy
18
Years of Service
User Offline
Joined: 7th Sep 2007
Location: out of TGC
Posted: 19th Mar 2012 16:11
Quote: "I'm talking about the very basic type, cutting, trimming and joining clips together as in movie editor.
"
I don't know what are you really planning to do, but inventing wheel once again...
You should try these FREE one-click progs: virtualdub and dvdvideostudio
basjak
16
Years of Service
User Offline
Joined: 16th Apr 2010
Location: feel like signing up for mars
Posted: 19th Mar 2012 18:20
Masqutti
16
Years of Service
User Offline
Joined: 8th Jan 2010
Location: insanity
Posted: 20th Mar 2012 01:02 Edited at: 20th Mar 2012 01:05
mrHandy, yeah.. I'm just interested on this matter. I myself do have proper editors, actually only one's missing is a good freeware video/audio -editor... I bet there's one out there too.. Somewhere.. Thanks for the tips.

basjak, that's interesting! Thanks for the link! Gotta check it later.

Ok. I tried this realtime -reading from disk, and I have pretty ok news! See more in attachment! It's similar to what I posted earlier, but the code is a bit cleaner, and well, now it works differently. Try the samples. The Bitrate calculator is not accurate. Just assumption. What FPS readings you get with sync rate 0 ? It's larger .rar now, I included DVD-quality clip also this time.

720p played @ 18 fps so that goes over capabilities with my comp.. No Hardrive-wise.. Interesting tho. More compression factor should give better results, if the bottleneck was my hardrive, not CPU. Memory should be fast enough..

Path: 'Sample' or 'Sample3', then filename: 'dog' or 'dog3'

hmmmh.. that didn't compile

Login to post a reply

Server time is: 2026-07-09 17:43:14
Your offset time is: 2026-07-09 17:43:14