Best video file format?

Windows specific questions.
datwill310
Posts: 355
Joined: May 29, 2015 20:37

Best video file format?

Postby datwill310 » Jul 27, 2015 14:58

Hello all. I was wondering what format of video is the best to use for programming a game (at the moment, just for Windows - why I posted in the Windows topic). The format needs to have images (which I will draw on the computer), and sounds/music. These will be 'cutscenes' in the game to depict the story. And; of course; how would you implement that into the programme. Would a 'movie clip' file be appropriate, or are there more convenient video formats to use? Advice would be helpful!
EDIT: I don't mind if I require external functions or DLLs or what-not; as long as it's easy to understand/implement.
Tourist Trap
Posts: 2762
Joined: Jun 02, 2015 16:24

Re: Best video file format?

Postby Tourist Trap » Jul 27, 2015 16:16

datwill310 wrote: The format needs to have images (which I will draw on the computer), and sounds/music. These will be 'cutscenes' in the game to depict the story.

Hello

I wont enter in any technical issue since I'm not experimented enough but I can tell you how the things were made in a game like Diablo, and many others.

First the game screen, it's whatever you want. Use ScreenRes and set the parameters you want. If you want it to be full screen then, use ScreenControl to retrieve the desktop size and sreenres accordingly, or eventually with "Windows.bi" include file , make a classical windows screen to draw on.

Then for the cinematics, in the old games an external video player was launched. You could probably use VLC for this. The mechanism to launch this with the good parameters,and making so that you will returns to the program after the video has been played, is something I've never tested. But probably something like 'run "VLC.exe myingamevideo.avi"' should work.
datwill310
Posts: 355
Joined: May 29, 2015 20:37

Re: Best video file format?

Postby datwill310 » Jul 27, 2015 16:41

Tourist Trap wrote:Then for the cinematics, in the old games an external video player was launched.

Thank you for the help, but playing with an external player isn't what I really want. I tried doing it before but found problems with what I wanted immediately. There seems too much 'power' with an external player - i.e., power for the player. I want the player to watch it (there is a skip option), and I wish for the game to play afterwards without the player having to close windows ext. You could consider closing the window a skip option, but the player would have to manually closs the window ext. just so they could continue.
AVI files seem a great contender in the list of appropriate video formats, though. When I used to write in this other version of BASIC, I learnt that there was a Windows DLL which could display any video file which were available on the computer (i.e. the appropriate codec was installed). I am pretty sure AVI codecs will be installed on most Windows computers. Yes, this is just like a player, but I also learnt you could control what buttons could be displayed/created. This seems EXACTLY what I want.
Another idea I had in mind was to create a work page for cutscenes, and display the video (images and sounds) onto that page. What I asked for was which video format I could use appropriately, and how to code it so that I can achieve this. Sorry about not covering details before hand :( .
Tourist Trap
Posts: 2762
Joined: Jun 02, 2015 16:24

Re: Best video file format?

Postby Tourist Trap » Jul 27, 2015 16:55

datwill310 wrote: I learnt that there was a Windows DLL which could display any video file which were available on the computer (i.e. the appropriate codec was installed)

Probably it's the windows media player dll.

datwill310 wrote: Another idea I had in mind was to create a work page for cutscenes, and display the video (images and sounds) onto that page. What I asked for was which video format I could use appropriately, and how to code it so that I can achieve this.

Any video format fits, since you are sure you can use the decoder (you know the codecs). I've seen AVI and FLV being very much used. I suppose there compression scheme is fast on decoding.
Last edited by Tourist Trap on Jul 27, 2015 17:00, edited 1 time in total.
datwill310
Posts: 355
Joined: May 29, 2015 20:37

Re: Best video file format?

Postby datwill310 » Jul 27, 2015 16:58

Great! I'll look it up in MSDN. Thanks!
Tourist Trap
Posts: 2762
Joined: Jun 02, 2015 16:24

Re: Best video file format?

Postby Tourist Trap » Jul 27, 2015 17:18

datwill310 wrote:Great! I'll look it up in MSDN. Thanks!

I think also worth checking SDL, and LibVLC .



Seems rather advanced however.
datwill310
Posts: 355
Joined: May 29, 2015 20:37

Re: Best video file format?

Postby datwill310 » Jul 27, 2015 17:26

I don't think this is what I want :(
I remember it being extremely simple and easy to use.

EDIT: You could create a fully-functional media player in just several lines of the old language I used to use.
Tourist Trap
Posts: 2762
Joined: Jun 02, 2015 16:24

Re: Best video file format?

Postby Tourist Trap » Jul 27, 2015 19:54

datwill310 wrote:I don't think this is what I want :(
I remember it being extremely simple and easy to use.

EDIT: You could create a fully-functional media player in just several lines of the old language I used to use.

Which language was it?
datwill310
Posts: 355
Joined: May 29, 2015 20:37

Re: Best video file format?

Postby datwill310 » Jul 27, 2015 20:00

Well, it is a language which does things in deprecated ways (eg. you don't have to define variables) to make programming easier (and shorter): Liberty BASIC (http://www.libertybasic.com/)
datwill310
Posts: 355
Joined: May 29, 2015 20:37

Re: Best video file format?

Postby datwill310 » Jul 27, 2015 20:02

Even in another language, it shouldn't be that hard since all it need was a few, if not one DLL call, and a few other lines. I did not download the DLL, it was a part of Windows.
Tourist Trap
Posts: 2762
Joined: Jun 02, 2015 16:24

Re: Best video file format?

Postby Tourist Trap » Jul 27, 2015 20:16

datwill310 wrote:Even in another language, it shouldn't be that hard since all it need was a few, if not one DLL call, and a few other lines. I did not download the DLL, it was a part of Windows.

Was it about ATL? By the way you may show how you were doing what you say, in order to know if it is possible to do the same in freebasic. Since you were using a basic dialect it is probably the case.
datwill310
Posts: 355
Joined: May 29, 2015 20:37

Re: Best video file format?

Postby datwill310 » Jul 27, 2015 20:21

I think it was ATL; yes! Yet I no longer have the code to do this in Liberty BASIC, since I do not code with it any more and have deleted all the IDEs, code snippits ext. I used with it.
EDIT: Glad to know what I can and cannot post on this forum!
Tourist Trap
Posts: 2762
Joined: Jun 02, 2015 16:24

Re: Best video file format?

Postby Tourist Trap » Jul 27, 2015 20:38

datwill310 wrote:I think it was ATL; yes! Yet I no longer have the code to do this in Liberty BASIC, since I do not code with it any more and have deleted all the IDEs, code snippits ext. I used with it.
EDIT: Glad to know what I can and cannot post on this forum!

You can name the other programming languages, freebasic is still not a sect I think ;-)
I've found this link so ---> http://lbpe.wikispaces.com/ATL+Tutorial , it may remind you something or not. It is about loading ATL library and using it inside a window (a windows window...) and mix all that with microsoft ActiveX. A specialist may decrypt that in a few seconds, but I'll try to dig out a little more.

Following the tutorial I'm going there:

Code: Select all

Dim As Any Ptr atllib  = DylibLoad ("ATL.dll")
Dim AtlAxWinInit As Function() As Long
    AtlAxWinInit = DyLibSymbol( atllib, "AtlAxWinInit" )

#Include "windows.bi"

Dim hWndContainer As ulong
Dim _GWL_HINSTANCE As long   
Dim hInst As ulong             

hInst = GetWindowLongA(hWndContainer, _GWL_HINSTANCE)

Dim As Long _WS_EX_STATICEDGE
Dim As String Ptr fileName
Dim As Long style
Dim As Long leftxpos = 0
Dim As Long leftypos = 0
Dim As Long cw = 100
Dim As Long ch = 100
Dim As ULong hATL

hATL = CreateWindowExA ( _
                 _WS_EX_STATICEDGE, _
                 AtlAxWinInit, _       
                 fileName, _         
                 style, _           
                 0, _               
                 0, _               
                 cw, _               
                 ch, _               
                 hWndContainer, _
                 100, _           
                 hInst , _       
                 0)   

Sleep
Dim As Long r = DestroyWindow (hATL)

End 0
datwill310
Posts: 355
Joined: May 29, 2015 20:37

Re: Best video file format?

Postby datwill310 » Jul 28, 2015 9:38

Tourist Trap wrote:A specialist may decrypt that in a few seconds, but I'll try to dig out a little more.

Do you mean converting from Liberty BASIC code to Free BASIC code? I do know a lot about programming in Liberty BASIC: the basics of DLL programming in Liberty BASIC I understand, but in Free BASIC I do not. If I did, I bet I could decrypt this quite easily. Even though the code doesn't work, I think you've done a great job at translating it!
I thought making a window in Free BASIC was a lot harder - in the tutorial files it makes it look so difficult (however, that could be because it's reading signals continuously so it requires a big loop with lots of calls, or it was handling the programming in an OO manor, and just lengthened it a lot). I didn't know DLLs could be as easy as simply creating a pointer to the DLL, and simply calling functions from there!
So I was stupid enough to approach a DLL problem which Idek how to handle in Free BASIC X'D! Perfect!
Better find some tutorials with FB fast.
Tourist Trap
Posts: 2762
Joined: Jun 02, 2015 16:24

Re: Best video file format?

Postby Tourist Trap » Jul 28, 2015 11:35

datwill310 wrote: I didn't know DLLs could be as easy as simply creating a pointer to the DLL, and simply calling functions from there!

There is 2 ways for calling DLL as far as I know. #INCLIB "libname" or mylibpointer = DYLIBLOAD ("libname"). But if you have a BI file to include, that will make calls and declarations for you, just use #INCLUDE "mylibheaders.bi" since this last one will load the lib for you, as well as declaring correctly the functions.
    If you use #INCLIB, you'll have to declare everything you may import from the library with standard DECLARE myimportedfunction() ..etc...
    If you use DYLIBLOAD, you have to bind a pointer to the function you may load with function pointer = DYLIBSYMBOL...
Also, if you use dynamic style, you theorically would have to kill the pointers when you are done with them, which also has the advantage over static style to free memory on demand.
datwill310 wrote:So I was stupid enough to approach a DLL problem which Idek how to handle in Free BASIC X'D! Perfect!
Better find some tutorials with FB fast.

The harder here seems to understand how to use the windows API variable types to call the windows API functions. For me at least is mystery.

By the way, you may edit your title in order to get more answers. You're too much general in my opinion. Maybe you should better try something like "How to load ATL in order to embed window movie player" ?

Return to “Windows”

Who is online

Users browsing this forum: Baidu [Spider], Majestic-12 [Bot] and 18 guests