[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: working with mp3 files



On Sat, Oct 31, 2020 at 12:32:24AM +0000, mick crane wrote:
> On 2020-10-29 23:30, Nicolas George wrote:
> >mick crane (12020-10-29):
> >>Is it correct that the concat works with the file but the demux
> >>streams it
> >>first through audio device and records?
> >
> >No, absolutely not. What on Earth could make you think that?!?
> >
> >The concat demuxer works through each file, outputting packets in them
> >in order, while taking care of shifting the timestamps of the later
> >files according to the duration of the earlier. Nothing more.
> 
> I may be a little intoxicated so there may be irregularities in my
> posting but is it possible you could help me out understanding how a
> static file gets to be a stream ( of packets ) ?

By squinting the right way :-)

Actually, in UNIX, every file is a stream of bytes. This view has
imposed itself so pervasively that only the old folks among us
remember those operating systems where files were, by default,
record oriented (I don't remember /that/ part fondly, mind you).

Back to topic, audio/video files have one common trait: their
content is time-related, and (at least when recording/playing
back), your machine has to access them (mostly) in time order.

Add to that that they tend to encapsulate several "things" (e.g.
left channel, right channel for audio; video and audio part for
films; perhaps several (human) languages; one track for each
orchestra instrument, yadda, yadda). At the beginning, for simple
cases, ad hoc solutions emerged: you alternate right and left
channel samples for a typical CD. With time, more complex requirements
emerged (you want "channels" with different bandwidth needs
"intertwined" in a way that their time bases stay in relation).

For that, you chop each channel in chunks of a convenient size.
You then shuffle your channels together (and call them streams,
just because). This shuffling together is called "multiplexing",
since why invent a new terminology, when engineers have got such
a handy one.

At the other end, you demultiplex.

That whole machinery is called the "container format" [1].
Whithin this, each stream has an own "codec", which typically
is (among other things) a lossy or a lossless (de-) compressor.

This works nicely whether the thing is on file or is coming in
via a socket. Yay abstraction layers!

Cheers
[1] https://en.wikipedia.org/wiki/Container_format
 - t

Attachment: signature.asc
Description: Digital signature


Reply to: