[Flac-dev] Lossless audio codecs for video editing
Josh Coalson
xflac at yahoo.com
Fri Feb 11 11:57:58 PST 2005
sorry about the delay... this it the first I'm seeing the message,
maybe it got stuck in moderation because of the cross posting.
--- Christian HJ Wiesner <chris at matroska.org> wrote
> I was wondering how suitable both are with respect to video editing,
> especially if it comes to sample precise cutting. What is the
> absolute minimal number of samples per frame in a FLAC stream ?
minimum is 1 sample per frame.
> Can we change the number of samples in the same track ?
do you mean can the number of samples vary from frame to frame?
if you are putting it in matroska and the container is managing
the sample numbering and seeking, the answer is an easy "yes".
if you are relying on libFLAC to tell you the sample number for
a frame: due to a flaw in the native codec design, if you vary
the number of samples per frame it will not always be possible
for the decoder to give an accurate sample number. then seeking
through libFLAC will also be a problem.
the flaw is that usually the frame number is encoded in the frame
header, not the sample number, so to get the sample number you
have to multiply the frame number by the block size. it is
possible to encode the sample number in the frame header but
there is not a bit in the header that tells you which way it is
encoded, you have to infer it from other data that is complicated
and flawed. and libFLAC only uses fixed blocksizes and only
writes frame numbers, so if you are editing such a thing in such
a way that you cut the first frame, the sample number calculation
will be off by the number of samples cut.
from this you can see though that if you are using your container
for the sample numbering and seeking, and ignoring libFLAC's
sample number there will be no problem. however if the stream
is exported to a native FLAC stream it will have to be reframed
which unfortunately means reencoded (unless/until I get to fixing
the format).
I am contemplating fixing this problem in the format eventually
(along with others) but older decoders will not be able to read
such streams, so if I do it, it will have to be done carefully
to avoid disrupting users. I would bundle it up with other
format changes and compression increases.
Josh
__________________________________
Do you Yahoo!?
Yahoo! Mail - You care about security. So do we.
http://promotions.yahoo.com/new_mail
More information about the Flac-dev
mailing list