Log in

View Full Version : Edit AC3 header?


Barleyman
2nd June 2008, 23:25
I have an AC3 file that the mediainfo, eac3to and others insist is a stereo 384kbps file.

However when you play the file with either ffdshow or ac3filter, they say it's 6-channel (and yep, seems to have audio on all 6 channels too) ..

Is there a tool to edit the AC3 header without re-encoding the offending file?

setarip_old
2nd June 2008, 23:28
Hi!

I don't know whether it will "do the trick" for you but, you might try "AC3Fix"...

Barleyman
3rd June 2008, 17:15
Doesn't do anything about the headers.

In the end I simply decided to brute force it by using AC3 Filter to force output stream as 5.1 to make on-the-fly "conversion".

tebasuna51
3rd June 2008, 17:55
Try with DelayCut and put the log

SeeMoreDigital
3rd June 2008, 19:13
I have an AC3 file that the mediainfo, eac3to and others insist is a stereo 384kbps file.

However when you play the file with either ffdshow or ac3filter, they say it's 6-channel (and yep, seems to have audio on all 6 channels too) .. Does it run at 44.1Khz by any chance?

Barleyman
4th June 2008, 07:57
Does it run at 44.1Khz by any chance?

48kHz actually. And to make things better the stream changes to stereo a few times in the middle for 1 frame or so.

But like I said, I worked around it by setting ac3filter muxer to output 5.1 stream.

AFAIK there are no general purpose utilities to manipulate AC3 headers. I found one that lets you set EX flag but that's all.

tebasuna51
4th June 2008, 09:54
Capturing TV you can have a mix of stereo and 5.1 ac3 frames (commercials-movies).
You can't edit the headers because the frames are real stereo and real 5.1, change the headers produce a more severe error.

You need cut the not dominant frames. Is not simple but you can use DelayCut to do the job.

Barleyman
4th June 2008, 12:24
Capturing TV you can have a mix of stereo and 5.1 ac3 frames (commercials-movies).
You can't edit the headers because the frames are real stereo and real 5.1, change the headers produce a more severe error.

You need cut the not dominant frames. Is not simple but you can use DelayCut to do the job.

The problem is that the main header says it's 48kHz stereo file and that's that. 99.5% of the stream is 5.1, thought.

tebasuna51
4th June 2008, 17:55
The ac3 stream don't have main header, each frame have a header you must delete the first frames.

Use DelayCut and put the log (3th time).

Barleyman
5th June 2008, 07:54
The ac3 stream don't have main header, each frame have a header you must delete the first frames.

Use DelayCut and put the log (3th time).

You can repeat yourself as many times as you want, I already resolved the issue in 3rd post.

Barleyman
8th June 2008, 11:29
For what it's worth, I do believe the problem here was that the 1st frame of the AC3 stream was in stereo. Since all the codecs and most of the tools just check the first frame they freak out as 5.1 stream was expected. I was actually transcoding this to WMA 5.1 and the conversion tool quits with non-informative numeric error code. Also it was confusing when you checked the stream yourself as ffdshow said it's 5.1 because it shows real-time info.

Cutting out the stereo frames in the beginning would most likely have worked just fine but it was easier to make ac3filter to mix those few stereo frames to 5.1 instead. Plus no issues with audio synch this way.

nautilus7
8th June 2008, 11:46
You can repeat yourself as many times as you want, I already resolved the issue in 3rd post.This is the way you thank people trying to help?

Hardcore Legend
17th June 2008, 08:00
Well, since I'm having the same problem and choose not to be a jerk about it, here is the log I get:


[Input info]
Bitrate=384
Actual rate=384.000000
Sampling Frec=48000
TotalFrames=23926
Bytesperframe=1536.0000
Filesize=36750336
FrameDuration= 32.0000
Framespersecond= 31.2500
Duration=00:12:45.632
Channels mode=2/0: L+R
LFE=LFE: Not present
[Target info]
StartFrame=0
EndFrame=23925
NotFixedDelay= 0.0000
Duration=00:12:45.632
====== PROCESSING LOG ======================
Time 00:00:00.000; Frame#= 1. Some basic parameters changed between Frame #6 and this frame
Time 00:00:00.160; Frame#= 6. Some basic parameters changed between Frame #1 and this frame
Number of written frames = 23926
Number of Errors= 2


Now I know that the audio is actually 6ch (or 5.1), except for these stray, it appears 5 or 6 frames that make the file register as 2.0 Stereo.

As you told the person above, they need to cut these frames out. How do I go about doing that?

Hardcore Legend
17th June 2008, 08:49
By re-reading the thread, I think I figured it out.

I discovered the change was at frame 6, so I clipped the first 6 frames of the AC3. I then remuxed the m2v and the AC3, and with VideoReDo I adjusted the audio the difference of the lengths of my original file and the clipped file (160 ms).

This came out pretty close to the original. Close enough that I think I'm losing my mind thinking there is any difference in timing. :devil:

:thanks:to all those who helped in this thread. Now I can go back and correctly fix 900 HD recordings. Ha!

jeffnoone
27th June 2008, 06:05
Great thread, as I also have this problem. AC3Delay indicated problem at Frame #19 in the first of five clips - frame rate is 31.25 per sec
So I have a problem after about 0.61 sec into AC3 (19/31.25) - correct?

This a h264 HDTV .ts cap with AC35.1 sound

eac3to indicates the delay to be -752 msec: so minus means audio starts BEFORE the video - correct?

So that means the audio error is before the video even gets going - correct?

THis file is one of five (making up making up one of my favourite movies) - each of the five seems to have some error in the AC3 stream with each being reported as AC2.0 when the majority of the audio stream is 5.1

Now my my second question: if I join all five files together directly (leaving the faulty frames in place), then correct the start of the movie only - will this larger file play properly in 5.1 with players such as Zoom/AC3, or more inportantly if I stream to a PS3. I intend to join with eac3to which will fix delay automatically in two runs - correct?

So do I need to take out all faulty audio frames?

help appreciated

Thanks
Jeff

tebasuna51
27th June 2008, 10:20
... AC3Delay indicated problem at Frame #19 in the first of five clips - frame rate is 31.25 per sec
So I have a problem after about 0.61 sec into AC3 (19/31.25) - correct?
I don't know AC3Delay, I use DelayCut.
If ac3 is 48 KHz each frame is 32 ms. 19 frames -> 608 ms

eac3to indicates the delay to be -752 msec: so minus means audio starts BEFORE the video - correct?

So that means the audio error is before the video even gets going - correct?
Yep, you can use DelayCut to delete the first 23 or 24 frames (752/32 = 23.5). If you want join this part with other maybe you need adjust (adding ending silence with DelayCut also) the audio and video length.

Now my my second question: if I join all five files together directly (leaving the faulty frames in place),
Bad idea. Repeat the procedure with the five files.

... then correct the start of the movie only - will this larger file play properly in 5.1 with players such as Zoom/AC3, or more inportantly if I stream to a PS3. I intend to join with eac3to which will fix delay automatically in two runs - correct?
I don't know. Maybe. Eac3to can reject improper ac3 streams.
So do I need to take out all faulty audio frames?
Always recommended.