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 Discussion / opening/closing cunks

Author
Message
freak
22
Years of Service
User Offline
Joined: 20th Jan 2003
Location:
Posted: 22nd May 2003 23:55
I'm still trying to write an avi file.

On this site ( http://www.opennet.ru/docs/formats/avi.txt ) there's more information about that.

It seems they are using special commands to open and close those chunks (grouped parts of data - which are also used in other file formats (this is also why I started a non-avi specific thread))...

For example, the first 8 bits in my self-made (not-working) avi file (when I open it in notepad) look like this:
"RIFFAVI "

When I look to a working avi file, there are some strange characters (which means it's non-ascii code) between those two 'tags'.
"RIFFjB AVI "
I think that could be the opening of the "AVI " chunck...

help!... :-s
[href]www.bernardfrancois.com[/href]
freak
22
Years of Service
User Offline
Joined: 20th Jan 2003
Location:
Posted: 22nd May 2003 23:55
I meant bytes instead of bits

[href]www.bernardfrancois.com[/href]
Hell IVIonkey
22
Years of Service
User Offline
Joined: 1st Apr 2003
Location: Outer Limits
Posted: 23rd May 2003 01:39
Oh boy...

My two cents: First, DarkBASIC is not anywhere near the optimal language for writing such types of files. With C++ it will still be quite difficult. Secondly, it appears that you're a beginner with such technology - writing an AVI encoder is a huge task! You don't seem to understand the mechanics of what you're writing; you seem to be just copying line by line from the instruction book. Maybe I'm wrong...

With that said, read this portion:


This is the beginning of a chunk as specified by the code. You can't just write in RIFF AVI.

freak
22
Years of Service
User Offline
Joined: 20th Jan 2003
Location:
Posted: 23rd May 2003 01:52
in fact these are multiple chunks... but I first thought that that code you posted was just to explain the structure of an AVI file...
and I indeed haven't much experience in writing files, but because it isn't explained that you have to write something to a file to open or close these chuncks I just thought it wasnt needed, and that the AVI reader would just recognise for example 'LIST' (in ascii)
but this is not the case because there appear to be multiple characters between "RIFF" and "AVI " (and not just a bracket and a quote in ascii)
anyway I might have to make a binary dump of an existing avi file to see what's between RIFF and AVI... then that might be the code to open a chunk...
what do you think?

anyway I think I do understand the mechanics of an avi file, I've read that 20 pages from that text file very closely. Indeed they use a command from a dll to open/close chuncks in C++
the writing of the titles of the chuncks and most of the data of the hdrl list is already done
I just sometimes use notepad to compare my created avi file with a working one...

[href]www.bernardfrancois.com[/href]
Ag3ntSm1th
22
Years of Service
User Offline
Joined: 13th May 2003
Location:
Posted: 23rd May 2003 02:11
don't let him discourage you freak, if you keep at it, you'll get it. in fact, i'll help. keep this post alive until we get it.

"The secret to creativity is knowing how to hide your sources." - Einstein
Hell IVIonkey
22
Years of Service
User Offline
Joined: 1st Apr 2003
Location: Outer Limits
Posted: 23rd May 2003 02:23
Heh, I simply wanted him to realize the magnitude of this project. If he has the drive to do it after realizing it won't be a walk through the park (to say the least), then go for it!

Hell IVIonkey
22
Years of Service
User Offline
Joined: 1st Apr 2003
Location: Outer Limits
Posted: 23rd May 2003 02:27 Edited at: 23rd May 2003 02:31
Quote: "anyway I might have to make a binary dump of an existing avi file to see what's between RIFF and AVI... then that might be the code to open a chunk...
what do you think?"


I think that would help. And I'd bet that those ASCII symbols are the opener to the chunk...

Ag3ntSm1th
22
Years of Service
User Offline
Joined: 13th May 2003
Location:
Posted: 23rd May 2003 07:26
here, i whipped this together. this should get you started on file structure.

I'll keep working on this but in the meantime keep studying and collecting docs.
good luck

"The secret to creativity is knowing how to hide your sources." - Einstein
freak
22
Years of Service
User Offline
Joined: 20th Jan 2003
Location:
Posted: 23rd May 2003 15:08
rem this program is freeware. enjoy, otherwise go fuck yourself trying
LOL

anyway coz I'm not at home this weekend I won't be able to do anything in DB. But I printed the code you just posted so I can have a look at it.

I have attached the code I already wrote (it's runnable), and this is the part in which I write things to the avi file. Sometimes I have added "op te zoeken" (Dutch) which means that I don't know yet what to place there and that I have to search it. But most comments are in English so it shouldn't be a problem to understand it.


[href]www.bernardfrancois.com[/href]
Ag3ntSm1th
22
Years of Service
User Offline
Joined: 13th May 2003
Location:
Posted: 23rd May 2003 18:29
i just started an AVI writing program but i need more specific info on header data. your example did help a little, but where did you find that info? (how many frmaes, size, etc.)
if you have found a decent specs doc, please lemme know where.

P.S. we will only be able to write uncompressed frames so i hope you have a big HDD.

"The secret to creativity is knowing how to hide your sources." - Einstein
freak
22
Years of Service
User Offline
Joined: 20th Jan 2003
Location:
Posted: 24th May 2003 17:05
this is where I found most of my information
[href]http://www.opennet.ru/docs/formats/avi.txt [/href]

its not that difficult to make compressed frames...
you just have to add the header of the file format you use for the video frames in the "strf" chunck, and you'll also have to use ##dc chuncks in the movie list instead of ##db cuncks

note that the source I posted was meant for avi without sound.
somewhere I coded this: write("vids")
then there also has to be a part with "auds"
but now I think there's something wrong with the structure of what I wrote... when I'm at home I'll have a closer look at this

[href]www.bernardfrancois.com[/href]
Ag3ntSm1th
22
Years of Service
User Offline
Joined: 13th May 2003
Location:
Posted: 24th May 2003 19:34 Edited at: 24th May 2003 23:22
trust me bro, we cannot implement compression. think about it...
just adding the header "strf" won't do anything because we don't know the specifics of any given compression method. it would take many more hours to make it so it codes compressed frames properly with whatever codec. it might be easy if we were using VB or c++ and included dll's but we chose to do this in DBC so we have to start from the ground up.
maybe later we can add support for compression but I was just going to convert as needed using external tools.

p.s. the url you are referenceing makes it difficult to understand file stucture. try here http://msdn.microsoft.com/library/default.asp?url=/library/en-us/directx9_c/directx/htm/avirifffilereference.asp

"The secret to creativity is knowing how to hide your sources." - Einstein
Ag3ntSm1th
22
Years of Service
User Offline
Joined: 13th May 2003
Location:
Posted: 25th May 2003 02:00
ive posted my updated AVI read/write code in a new topic...

"The secret to creativity is knowing how to hide your sources." - Einstein
freak
22
Years of Service
User Offline
Joined: 20th Jan 2003
Location:
Posted: 26th May 2003 02:25
just adding the header "strf" won't do anything because we don't know the specifics of any given compression method

ofcourse I don't mean you just have to add that header, I mean you'll have different contents in this strf chunck when you use compression or not

for example when you want uncompressed BMP frames, the BMP file header has to be in that strf chunck
when you want compressed (for example JPG) frames, the JPG file header has to be in that strf chunck

or am I wrong with that?

[href]www.bernardfrancois.com[/href]
freak
22
Years of Service
User Offline
Joined: 20th Jan 2003
Location:
Posted: 26th May 2003 02:55
ive posted my updated AVI read/write code in a new topic...

which topic and on which forum?

[href]www.bernardfrancois.com[/href]
Ag3ntSm1th
22
Years of Service
User Offline
Joined: 13th May 2003
Location:
Posted: 26th May 2003 07:05 Edited at: 26th May 2003 07:08
see, any given windows program that codes AVI uses an API to incorporate compression. it's all built in (probably using dll's). since my program is going to be copying a certain area of the screen into a bitmap, then writing that frame into a chunk, there is no compression.. to compress the data, we would have to know the specs of whatever compression method we want, and run those algorithms on the bitmap before writing it to the chunk. get it yet?

p.s. in the "reading writing raw AVI files in DB" topic

"The secret to creativity is knowing how to hide your sources." - Einstein
freak
22
Years of Service
User Offline
Joined: 20th Jan 2003
Location:
Posted: 26th May 2003 14:38
since my program is going to be copying a certain area of the screen into a bitmap

my program will do this too... check http://www.ping.be/groen/bernardfrancois/programming/lisajous_v1-00.zip

I think I'll grab bmp images from the screen and then use data from these files for the ##db chuncks
this means that I'll have to add the BMP headers into the strl chunck

[href]www.bernardfrancois.com[/href]
freak
22
Years of Service
User Offline
Joined: 20th Jan 2003
Location:
Posted: 26th May 2003 15:08
more about bmp headers:

this link gives the most clear information (on that site you can also find info about headers of many other file types
http://www.fastgraph.com/help/bmp_header_format.html
here they also have some data at offset 54, something about color map
http://perso.wanadoo.fr/ck/TrucsCool/PROG_bmp.html

for multiple possible values of the strh (stream handler):
http://www.fastgraph.com/help/avi_creation.html
(they also added the hex equivalent of it, so I'll check if it gives the same hex result)

[href]www.bernardfrancois.com[/href]

Login to post a reply

Server time is: 2025-05-19 01:22:13
Your offset time is: 2025-05-19 01:22:13