PDA

View Full Version : B frame a/sync.. unique question..


joelancer
7th December 2004, 03:52
1. i am a newb, other then what i have read about, i have no encoding experience.

2. iv read about mpeg 4's B frame decoder lag, and i understand most of it.

3. im not encoding anything, here is my situation - i have 2 xvid files. one is Xvid.ac3.avi (bitstream is packed, i get no DecoderLag warning in vdub). the second is Xvid.ogm (bitstream not packed, i get decoderLag)

the files are exactly the same content, 25fps pal. Except the .ogm encode has a slightly sharper image, and a slightly smaller bitrate/filesize. so i wont to keep the vid from the .ogm. And keep the .ac3 audio from the .avi version. So i demuxed the .ac3. But when i open the .ogm in Vdubmod, the vid is exactly 1 frame ahead of the .avi vid. My question is.. is the i frame difference because of the DecoderLag, or do i need to compensate for the 1 frame ontop of the DecoderLag.. 80ms audio delay, instead of just 40ms?

iv done this in the past with vid files were both had packed bitstreams, and i only had to compensate for the frame difference from the starting point to get perfect matching sync. but with this .ogm, i tryed both 40 and 80ms delay, and the 80 i think apears to sync better, but at such small intervals its hard to tell. thats y im asking for feedback. And id also like to know if the .ogm being 1 frame ahead in Vdubmod is just how the video is, or if its cause of the unpacked bitstream and DecoderLag? for my own reference.
-------------------------------------------
seperate question i was curious about..

i was also able to save aproximetly 1.5mbs of space off a 350mb Xvid.ac3.avi file, by de-interleaving the audio. However, when i de-interleaved the audio from a 400mb Dvix.mp3.avi file, i found no change in file size.

so i was just wondering... is the overhead from the interleaved Xvid file caused mostly cause the .ac3 is uncompressed, compaired to the .mp3?

Ark
7th December 2004, 09:40
Yes, the black "Decoder LAG" frame is added at the start of the movie, so the total is *movie frames*+1.

To avoid this you can import that video to Virtualdub and trim out that frame, than add audio and mux them (keeping "Direct stream copy" checked for both) to .AVI (or .MKV ;))

I don't know about audio overhead issue, i never used plain .ac3, so i can't answer your question...

stephanV
7th December 2004, 10:07
if it is CBR MP3 you should still save some space, but not as much. For VBR MP3 the difference would be weird. It is not caused by the difference in compression (ac3 is not uncompressed) but by the difference in interleaving.

AC3 is usually stored in chuncks that contain 2 frames which is 64 ms IIRC. CBR MP3 in VirtualDub is stored in chuncks of 500 ms (IIRC). Therefor AC3 audio requires more chunks to be stored and causes more overhead.

It is however advisable to keep your files interleaved as it will improve playback quality.

joelancer
7th December 2004, 18:46
iv read as much as i could b4 posting my question, and someone can correct me if im rong but... the 'B frame decoder lag' message isnt a frame, its generated by the decoder. and is not there when played back in a DirectShow divice. so if u try cutting it, it will just reapear, becuase it not acutally part of the file, just a message from the decoder.

and, im not encoding anything, just direct stream copying, the message apears in the first key frame of the file in Vdubmod, so unless i recompress, its impossible to do what u suggested. as stated above it threoretically wouldnt work anyway.

so im back to my original question... is the 1 frame ahead difference(in compairison to its (packed Bitstream).avi couterpart) a direct resault from the 'b frame decoder lag' message, or do i have to compensate for that 1 frame + the decoder lag when remuxing the audio?
-------------------------------
thx for the interleaving warning, but im only storing and playing these files back on HD, not CD or DVD. thats the reason i did that.

ChronoCross
7th December 2004, 20:47
you could remove the packed bitstream using mpeg4modifier. I think that would solve your problem. both of the streams whould then in theory have the same number of frames because the virtual decoder lag frame will no longer be in the formerly packed bitstream video

joelancer
7th December 2004, 22:58
its an idea, but since i cant do it at the moment, ill ask more questions...

1. is that operation in mpeg4modifier a Directstream copy mode?

2. i didnt know there was a program that can do this, if that operation is performed in Directstream copy Mode, is there a program out there that can pack an already encoded bitstream?(that would totaly solve my prob)

3. ur thinking of it backwards, i would need to pack the bitstream to get rid of the message, or unpack the Xvid.ac3.avi file so thy both have decoder lag. [problem - i no longer have the Xvid.avi file,just the .ac3 demuxed from it]

4. even if i unpacked the bitstream from the Xvid.ac3.avi file... wouldnt that just make it out of sync with its audio? and i would end up right back at my original question?