Re: [linux-audio-user] AC3 file structure question

From: Joshua Boyd <jdboyd@email-addr-hidden>
Date: Fri Mar 24 2006 - 00:56:33 EET

On Wed, Mar 22, 2006 at 06:51:01PM -0800, Florin Andrei wrote:
> I have a large AC3 file:
>
> $ file chicken.ac3
> chicken.ac3: ATSC A/52 aka AC-3 aka Dolby Digital stream, 48 kHz,,
> complete main (CM) 3 front/2 rear, LFE on,, 448 kbit/s reserved Dolby
> Surround mode
>
> I want to create a much smaller file with the same parameters, ideally
> silent, with a duration of about 2 sec, then concatenate the small file
> at the beginning of the existing large file.
>
> If I'm not mistaken, an AC3 file is made out of independent frames of
> fixed size. Is that correct? If yes, what is the size of a frame?

> If the frames are fixed-size, I could simply use dd to generate a small
> fragment out of the existing file, then use cat to glue the fragment and
> the original file.

Frames vary in size based on the parameters chosen. In a stream, the
frames should stay the same size. If they don't, then that probably
means that there was a cut from one stream to another, like if you were
recording AC3 over spdif from a satalite reciever while changing
channels.

Using dd to generate a fragment will be non-trivial if you aren't
intimately familiar with AC3. Or at least thoroughly aquainted with
it. The ATSC spec is available online. I wouldn't call it easily
readable, but you can work your way through it.

A better technique might be to make a silent wav file, then use ffmpeg
to convert it to AC3, using the parameters of the original file. If
the parameters match (or are at least close enough, which is a little
bit decoder dependant), you can just cat them together. I don't know
that ffmpeg will allow you to actually tinker with all the parameters
though. For safest results (which is technically degraded, but is how
the professionals would usually do it), it might be best to just convert
from the AC3 to .wav or .aiff, then place your silences, then convert
back.

-- 
Joshua D. Boyd
jdboyd@email-addr-hidden
http://www.jdboyd.net/
http://www.joshuaboyd.org/
Received on Fri Mar 24 04:15:07 2006

This archive was generated by hypermail 2.1.8 : Fri Mar 24 2006 - 04:15:08 EET