View Full Version : Detection of b-frames : how-to ?
Hi,
I was wondering how detect into an avi file, b-frames ? (and also p and i-frames).
I've got some informations on AVI file structure, but nothing on video stream like Xvid or Divx.
(if u got exemple, send me in Delphi ;) )
Moitah
4th July 2004, 02:20
After you have read a frame, search for the VOP startcode (4 bytes: 0x00 0x00 0x01 0xB6). The next 2 bits (bits, not bytes) will be the VOP type:
I_VOP = 0
P_VOP = 1
B_VOP = 2
S_VOP = 3
If packed bitstream was used, there will be more than 1 VOP startcode in some frames. Detecting N_VOPs is harder, the VOP type will be P_VOP (for XviD at least) but there is a "not coded" flag. Let me know if you want information on finding the "not coded" flag.
Hi,
I've looked into one avi file, with an hex editor, and I found, in a "one shot Xvid file" of mine with b-frame, first frame I, sec frame P and third frame B.. Nice
I supposed , that I must read at least 50-100 frames before saying this file really got b-frame ???
Because it depends on what I choose in codec property, for tweaking b-frame ??
I don't know really, how frames are distributed in xvid file, if I can do just a little looking with the first 10 frames of the file or if I must read at least 100 frames for saying : yeah, it's got b-frame!
Moitah
4th July 2004, 17:00
Originally posted by Dams
I supposed , that I must read at least 50-100 frames before saying this file really got b-frame ???Yeah, I think it's safe to say that if there are B-frames, you will see some within the first 50 frames.
Just last thing :
I've got procedures already written to read Avi file, in delphi; I supposed the stream represented by a frame, own the VOP startcode or the VOP startcode is not in the frame but between the frame ?
Moitah
6th July 2004, 21:46
I'm not sure if I understand your question. A VOP startcode (or 2 sometimes, with packed bitstream) will be inside the data of each '00dc' or '00db' chunk in the AVI.
Moitah
6th July 2004, 23:08
Yes.
Ok :cool:
(Excuse my poor english :p )
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.