Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Basic support for FLAC-in-MP4 audio tracks #272

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

bvibber
Copy link
Contributor

@bvibber bvibber commented Jun 1, 2019

Allows for creating an MP4 stream with FLAC contents using the MP4 box generation functions or AudioSegmentStream.

Use codec string 'fLaC' and specify a 'metadata' field in the track info with the FLAC METADATA_BLOCK_HEADER fields to go into the dfLa box.

See https://github.com/xiph/flac/blob/master/doc/isoflac.txt for details of the MP4 embedding of FLAC audio.

Significant speedup in (pre-Chromium) Edge, especially for high
bitrates such as uncompressed or lightly-compressed frames.

Previously, buffer.byteLength and buffer.length got looked up
multiple times per byte processed in Edge, leading to higher
CPU usage.
Allows for creating an MP4 stream with FLAC contents using
the MP4 box generation functions or AudioSegmentStream.

Use codec string 'fLaC' and specify a 'metadata' field in the
track info with the FLAC METADATA_BLOCK_HEADER fields to go
into the dfLa box.

See https://github.com/xiph/flac/blob/master/doc/isoflac.txt
for details of the MP4 embedding of FLAC audio.

Also allows variable-length audio packets in AudioSegmentStream

FLAC may have variable-length packets, so allow passing a
duration in samples on incoming frames.

This gets FLAC with, say, 960 samples per frame working
consistently in Firefox and Chrome.
@squarebracket
Copy link
Contributor

This is a cool feature, but we've got a lot on our plate right now so it might be a bit before we get a chance to review this.

@bvibber
Copy link
Contributor Author

bvibber commented Jun 11, 2019

No worries, no rush. :)

@gkatsev
Copy link
Member

gkatsev commented Feb 12, 2020

@Brion hey, do you have some test content readily available we can take a look at? Thanks.

@brandonocasey
Copy link
Contributor

@Brion I tested out your pull request and I do see how this would help us generate flac-in-mp4 content. Since this doesn't seem to break mpeg ts transmuxing on our end I think we could merge this easily enough. It would be really helpful to get two things from you here so that we can get this in:

  1. Do you have an example of how you are using the mp4-generator directly so that we can test it locally?
  2. Can you add a unit test that runs through the mp4-in-flac generation code paths?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants