Log in

View Full Version : Interleaving every frame or every 500 ms ??


Pages : 1 [2] 3

Chibi Jasmin
26th October 2002, 14:42
Well, this happens quite often here... :-) Also on a file (second cd again, but remember also some first cds have this) that has (probably) been muxed directly into 96ms/96ms without the intermediate 1fr/500ms.

Any chances to investigate on this? As Nandub shows these files having 5 channels 48000 Hz as it should be...maybe something still is screwed after remuxing the fracted frames from a 1fr/500 ms nandub mux into a 96ms/96ms one??? And splitting also screws something?

Originally posted by alexnoe
There's another issue with NanDub: If you use NanDub to split a file with AC3, then the AC3 stream will probably not begin with a AC3 frame, but with "the 2nd half" of a frame.
AVI-Mux GUI will *not* process such streams. I haven't implemented handling of corrupted AC3/MP3 streams yet, and I won't be able to do that at the moment (semester has begun :rolleyes: )

Well, maybe it's this issue? I never got a file that is totally rejected, they were all opened, but in case of audio chan 0 they were not processed...there must be a fracted frame at the beginning from the split process that is not removed by remuxing with 96/96 is that possible? I even have the feeling that even with direct 96/96 muxing nandub produces fracted frames when splitting, what do you think?

UPDATE: I ran some of the files making problems through Graphedit, saving the AC3-output of the AVISplitter directly to a file with dump filter...then ran that ac3 through BeSliced and always got an output like that:

[00:00:00:000] +------- BeSplit -----
[00:00:00:000] | Input : D:\Eigene Dateien\CD2.ac3
[00:00:00:000] | Output Prefix : D:\Eigene Dateien\CD2_Fixed
[00:00:00:000] +---------------------
[00:00:00:032] Stream error : Sync found after 382 bytes
[00:54:30:208] | Writing D:\Eigene Dateien\CD2_Fixed01.ac3
[00:54:30:208] +---------------------
[00:54:30:208] Operation Completed !
[00:00:13:000] <-- Process Duration

the after XXX bytes value actually differed from file to file...this also happened on a file that has been muxed to 96 ms / 96 ms directly and then split.

So it seems, all we have to deal with is the 'fracted frame at the beginning of nandub-muxed files' issue. Question is: Can you simply add some code to delete the corrupt frame at the beginning, or do we ran into av-sync issues then (what does the ac3-playback filter do with the corrupt frame is the question I guess)?

MaTTeR
26th October 2002, 15:50
alex,

I've come across a problem this morning and I've yet to figure it out. First of all, I noticed that if I deleted the config.ini file and then let avimuxgui recreate one that the settings don't seem to be the same defaults as I recall seeing the first time I used this app some days ago. Can you confirm?

Recreated config.ini-
[config]
format=%s (%d).avi
maxsize=2000
audiointerleave=75
preload=500
maxframes=0
maxchunksize=0
openfileoptionsflags=0
opendml=1
reclists=1
avoidseekops=1
usemaxsize=0
makelegacyindex=0

Original defaults from config.ini-
[config]
format=%s (%d).avi
maxsize=798
audiointerleave=75
preload=500
maxframes=0
opendml=0
reclists=1
avoidseekops=1
usemaxsize=0
makelegacyindex=0
maxchunksize=2000
openfileoptionsflags=299

Notice the differences, I'm pretty sure the first time I used the app that Open-DML was not turned on by default.

Edit- I can also confirm the problem with muxing a 2nd part of the movie that was done in Nandub. For now it seems we have to manually demux the 2nd part, run AC3 through AC3fix and then let avimuxGUI remux.

alexnoe
26th October 2002, 16:07
@Chibi: I've no idea what the filter does with these half frames. Removing such half frames should be no problem. AV-sync should be affected less than 32ms, so you won't notice the difference.
For values of 17-32, you can set a delay of +32ms in order to get it below 16ms.

@Matter: My AVI-Mux GUI doesn't activate Open-DML as default :confused: This should be the standard settings:
[config]
format=%s (%d).avi
maxsize=2000
audiointerleave=75
preload=500
maxframes=0
maxchunksize=0
openfileoptionsflags=0
opendml=0
reclists=1
avoidseekops=1
usemaxsize=1
makelegacyindex=1

There was a bug in the standard setting creation some time ago...

Chibi Jasmin
26th October 2002, 16:10
I made the following experiment...

I took a movie consisting of two files (cds), first file works fine in avimux, second file doesn't probably because of splitting and corrupt first ac3 frame.

I then joined the two together in VDub (96ms/96ms) with append function...the resulting file FULLY worked in AviMuxGUI.

So if there's one half of an ac3-frame at the end of the first file and the second half of that frame at the beginning of the second file, this particular frame is either reconstructed in the process of joining or deleted, I don't know.

But this got me the idea, that it should actually be possible to even keep this frame, if AviMux would support selecting more than one input file and could reconstruct the frame from the first and second file! At the moment, this does not work, because it still errors on the second file, when adding both...but if there's special code for that!?

alexnoe
26th October 2002, 16:12
rotfl!

Load both files, mark them with ctrl+left-click and add video source :)

Chibi Jasmin
26th October 2002, 16:12
Originally posted by alexnoe
@Chibi: I've no idea what the filter does with these half frames. Removing such half frames should be no problem. AV-sync should be affected less than 32ms, so you won't notice the difference.
For values of 17-32, you can set a delay of +32ms in order to get it below 16ms.


Well, sure, but it leaves a non-perfect feeling :-) Maybe look into the above post and my idea about even reconstructing that one screwed frame...

btw to know, if it's 17-32 I would have to know the size of an ac3-frame, as besplit only reports the number of bytes it has skipped not the duration...

Chibi Jasmin
26th October 2002, 16:16
Originally posted by alexnoe
rotfl!

Load both files, mark them with ctrl+left-click and add video source :)

I got two options:

1. Loading the two files, then adding one after another... result: Error Message about bad audio in second file.

2. Loading the two files, then marking them both as you said and then add -> avimuxgui crashes!

alexnoe
26th October 2002, 16:17
It shouldn't crash... *argh* I'll have a look at this

Chibi Jasmin
26th October 2002, 16:21
Well, it does not crash, if I try to join files, that do not fit together, in that case it spits out the 'cannot append' message... :-)

It was a nice option, if it worked, would help in all the cases, were the first cd is not screwed at least...but still we need the code to take care of the very first corrupt ac3-frame, if there's one in the first cd...

Anything I can do to help you investigate this crash?

alexnoe
26th October 2002, 16:29
Ah...now I know: It cannot append because it thinks the audio stream of the second file to be different from the audio stream of the first file :angry: Normally, it's not possible to append such streams, but in this case, they are not different :rolleyes:
At least, I now know what to do...I just don't know exactly when to do it :scared:

I will add an option which disabled check if ac3 audio streams are "compatible"

Chibi Jasmin
26th October 2002, 16:33
Well, fine...you now got 2 things on your to-do-list :-)

1. Add code to deal with one corrupt ac3-frame at beginning or end of a file.
2. Fix this join thing and if possible even keep the frame that has it's first half at the end of one and its second half at the beginning of the following file.

You would make at least one girl happy by doing this ;)

Chibi Jasmin
26th October 2002, 16:48
Originally posted by alexnoe
For MP3-VBR it is required that one frame (for 48 kHz: 24ms)
is one chunk. Otherwise scanning through the file won't work (if you scan through such a file, then the correct position within the audio stream will be found by calculating the number of the required chunk, assuming that every chunk has the same length in time. E.g. if you seek to 1h:00min:00sec, then chunk nbr 150.000 will be loaded).

Does Nandub at least do this correctly?

And what about MP3-CBR?

alexnoe
26th October 2002, 17:04
Yes, NanDub seems to handle MP3-VBR very well (btw AVI-Mux GUI does not handle MP3-VBR 44.1 kHz. Only 48 kHz works).

NanDub handles MP3-CBR as if it were VBR. This is no problem either.

Preserving the splitted AC3 frame is not a problem at all.
The other thing is more difficult

Chibi Jasmin
26th October 2002, 17:18
Okay, fine...thanx for explaining...and about that being difficult: I put all my trust into you, you'll make it! :D Have fun...

alexnoe
26th October 2002, 18:30
I've now produced some NanDub crap files. I can reproduces the 0-channel issue, but not the "cannot append..." message :confused: In fact, when the number of channels is displayed, then it is derived from the first frameheader (and if this is bad, it will show a crap value), while when checking if 2 files can be appended, then the only AVI stream headers are checked.
Nevertheless, I'll find out what the problem is.

Chibi Jasmin
26th October 2002, 18:33
'Cannot appendŽ only appeared, when I tried to join two totally different avis (different resolution or whatever). In case of the 0ch thing and trying to join, it is as described above: selecting both and clicking add -> crash..adding one after another -> audio error message...

alexnoe
26th October 2002, 18:41
Ah...so I must've misread you posting. I've already found a place which might've caused a crash and have fixed it.

Can you read some German? In this case I would not have to compile 2 different beta's for testing purposes :sly:

Chibi Jasmin
26th October 2002, 18:42
I can read German perfectly :-) Gimme your beta ! :)

alexnoe
26th October 2002, 18:58
Not ready yet; i'll post when it is (btw that's why i like it if people write their location into the profile...)

Chibi Jasmin
26th October 2002, 19:01
Yeah, okay, no problem...I'm not always at the comp, so once I get it and have some results I'll post back...would be nice, if you add some explanation then, what is supposed to be fixed (corrupt frame handling and/or joining avis etc.) Thanx for your work :)

One idea: If you make the code for a corrupt ac3 frame at the beginning of a movie, wouldn't it be nice to automatically add the correct delay according to the size of the corrupt frame? As I think one half frame at the beginning can't be reconstructed, or can it? So when deleting, the delay comes handy...just to make things perfect... :D

alexnoe
26th October 2002, 19:16
At first, I'll make it work at all...then I'll think about comfort :)

Chibi Jasmin
26th October 2002, 19:20
Sure :) In case you spit out how many bytes out of a total of how many have been discarded, I'd also be happy with setting the delay manually then... :D Great you find some time to work on this.

alexnoe
26th October 2002, 20:04
http://www-user.tu-chemnitz.de/~noe/Video-Zeug/AVIMux%20GUI/Pre-release/

This should now be able to append to files if the AC3 frame at the beginning of the 2nd file is splitted. It does not take care of bad first files.

Chibi Jasmin
26th October 2002, 20:25
Originally posted by alexnoe
http://www-user.tu-chemnitz.de/~noe/Video-Zeug/AVIMux%20GUI/Pre-release/

This should now be able to append to files if the AC3 frame at the beginning of the 2nd file is splitted. It does not take care of bad first files.

It works as described! Does it preserve the splitted ac3 frame in the middle (combine the first half of the frame from the end of first file and the second half of the frame from the beginning of second file into one frame)? Or does it simply delete it?

BTW: When you try to add a file that is corrupt at the beginning, it now pops up an error message, instead of displaying 0 channels, but I guess you know that already :-) Thanx so far...

alexnoe
26th October 2002, 20:30
It preserves the splitted frame.
Showing 0 channels was a bug.

Chibi Jasmin
26th October 2002, 20:37
Great stuff...thanx a lot...

if you now make it able to deal with split frames at the beginning (and maybe preserve the frame, if possible (guess not, or?) or do the delay thing manually or automatically), we got a great tool for ac3-avi handling!

Chibi Jasmin
31st October 2002, 09:25
I saw your new prerelease version from October 30th. What's new? Any tests I can do?

alexnoe
31st October 2002, 10:56
MP3's should now work even if the first frameheader is corrupt. Maybe I can add the same for AC3 today.

Chibi Jasmin
31st October 2002, 12:17
Great! What does(mp3)/will(ac3) do it with the first corrupt frame? Guess, it will just kill it?

Will there be any output of how many bytes/ms have been killed so one can think about playing with audio delay and stuff? Maybe even automatic suggestion?

You know what I mean, as always thanx for your continued effort...

alexnoe
31st October 2002, 12:40
It just kills the corrupt beginning of the file.
At the moment, it doesn't output that, but I'm going to add this as well.
Note that you will only be able to delay AC3 for +/- 32*n millisec, and MP3 for +/- 24*n millisec.

Chibi Jasmin
31st October 2002, 13:49
Originally posted by alexnoe
Removing such half frames should be no problem. AV-sync should be affected less than 32ms, so you won't notice the difference.
For values of 17-32, you can set a delay of +32ms in order to get it below 16ms.


So you can only adjust audio delay in steps of 32 ms (ac3)/24 ms (mp3), is that correct? So adjusting because of cut half-frame only makes sense in the case quoted above (17-32 -> 32 delay), if I get it right...!?

How does Nandub handle ac3(mp3)-delays that are not multiple of 32(24)? Fuck up the files? *g* Or just round the values?

alexnoe
31st October 2002, 13:58
I don't know, but it has the two possibilities you mentioned: It can fuck up the files or round.

Adding a delay to the audio stream is nothing more than duplicating / removing audio frames. Since AC3 has audio frames of 32ms, it's impossible to add delays which are no multiple of 32ms (of course, you can decode the whole stream to 5 or 6 wavs, set the delay for the wavs (possible in steps of 20,8”s), and reencode to AC3 :p) without screwing the file.

EDIT new beta is uploaded.
For source streams from an AVI file, it now displays "Begin: <number>". This is the amount of bytes which are cut off at the beginning of the stream.

Chibi Jasmin
31st October 2002, 15:18
Okay, I understand...

So begin: number displays the amount of bytes that have been cut off the first audio frame? We still need to know then how many bytes total a complete frame has? Well, will take a look at it...

alexnoe
31st October 2002, 15:32
The amount of bytes in one frame is the granularity.

Chibi Jasmin
31st October 2002, 15:50
I see....

So to sum it up: If we have

Begin > Granularity/2

we should add 32 ms delay for ac3 and 24 ms for mp3, right?

So all we should do is test functionality now, right?

alexnoe
31st October 2002, 15:53
For MP3, the granularity will be shown as "0", since the frames are not of constant size. You can only guess then.

For AC3, you're right.

Chibi Jasmin
31st October 2002, 15:57
Only true for vbr-mp3? Or maybe also for cbr-mp3?

Chibi Jasmin
31st October 2002, 16:03
I still have one problem with the program btw...if I open a video and add it, then remove all and open a video again and add it...then remove again and so on....repeating that a few times often leads to crash on file open after several files....

alexnoe
31st October 2002, 16:03
For MP3-CBR, granularity is 1 (this doesn't make sense in any way, but it seems to be required for proper replay. When writing the correct granularity into the header, replay doesn't work :confused: ). This will cause AVI-Mux GUI to add fracted frames if you set a delay!

I recommend setting the "force VBR for MP3 streams" option in the advanced options window if you intend to set a delay for an MP3 CBR stream. The stream will then be treated as VBR

Chibi Jasmin
31st October 2002, 16:06
okay, fine...maybe add some kind of protection then for granularity of 1 to avoid fracted frames?

Would you mind to explain what exactly the three mp3-cbr options in advanced dialog do? I played around with them but didn't get to it...

Chibi Jasmin
31st October 2002, 16:58
I don't know, if this intentional, but in the version, that displays the begin numbers, joining AC3-AVIs, where second file has a split ac3-frame at the beginning is broken (same old error message), worked in the version before!

alexnoe
31st October 2002, 17:51
About MP3-CBR:

These options are only for MP3 files, not for MP3 streams in AVI files.
There is no easy way to determine whether a MP3 file is CBR or not. The only way is to look into every single frame header (150.000 per hour) and check if all bitrates are the same. This requires to read the whole file.

At first, AVI-Mux GUI only checks the first 1000 frames. If all bitrate values are equal there, then there are 2 possibilities: (1) automatically check the whole file (2) ask the user if the whole stream shall be checked.

If you select "never", then all MP3 source files are assumed being VBR, without checking if they are CBR.
I don't know, if this intentional, but in the version, that displays the begin numbers, joining AC3-AVIs, where second file has a split ac3-frame at the beginning is broken (same old error message), worked in the version before! it should still work :confused: , and I don't get this error...does it report the correct number of channels etc for both files?

Chibi Jasmin
31st October 2002, 18:10
thanx for explanation...

About the joining issue.

Yes, it does show the correct number of channels for both parts of the movie...but when marked both with ctrl left click and added and then clicking start it fails in the middle of the file with audio stream error...

UPDATE: Damn, I am confused now...I now have versions from 26-oct, 30 oct and 31 oct failing!? I will see, what is going on and report back...

Originally posted by Chibi Jasmin
I still have one problem with the program btw...if I open a video and add it, then remove all and open a video again and add it...then remove again and so on....repeating that a few times often leads to crash on file open after several files....

Don't miss this one...although it's of minor importance...

alexnoe
31st October 2002, 18:25
About the crash: Certainly a memory leak. These are hard to track down...

An audio stream error...it doesn't do that here, really. What are the begin-values of your files?

Chibi Jasmin
31st October 2002, 18:34
Various values, always < granularity...but...I had the 26-oct version working, now it doesn't anymore...with same test files? Strange, I am confused...still testing...

okay, well, maybe you have to check 'don't check ac3s before joining' in advanced options? I will try that...

UPDATE: Okay, that's not it...I also tried unchecking open dml and rec-lists??? What is going on here??? Sorry for confusion I don't get anything at the moment...

alexnoe
31st October 2002, 18:39
That can't help.
Are you sure that your files are really "split" (and that there is no frame duplicated or missing)? If not, then I'd have to add resynchronisation...

Chibi Jasmin
31st October 2002, 18:46
They are split with Nandub and have AFTER THAT been remuxed to 96ms/96ms...but I reported that working...must have used other files? Can't remember....I can't get it to work at the moment...strange...will try some other files...

alexnoe
31st October 2002, 18:50
OK, i'll add resynch capability. I'm sure that one small part of the stream was lost.

Chibi Jasmin
31st October 2002, 18:52
yeah, seems so, I have it working now again on a stream, that has directly been muxed to 96ms/96ms with nandub and split...

What will resynchronisation do exactly? Would be happy to understand!

UPDATE: I also found a file that has been REmuxed with nandub from 1fr/500ms to 96ms/96ms and still worked with AviMuxGUI, but most that have been treated that way don't work, so there really seems to be an ac3-frame lost or something like that...how will your resynch deal with that? It shouldn't of course screw a/v-sync...just leave out one frame should be possible? or duplicate one to fill the gap?

alexnoe
31st October 2002, 18:59
At the moment, AVI-Mux GUI searches for the first frame header in an AC3 stream, but as soon as it finds one, the whole stream but be valid from then on.
Resynchronisation will search for the next frame header if there's an error in the middle of the stream.