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

Feat/parse codec #14

Merged
merged 35 commits into from
Dec 16, 2020
Merged

Feat/parse codec #14

merged 35 commits into from
Dec 16, 2020

Conversation

brandonocasey
Copy link
Contributor

@brandonocasey brandonocasey commented Jun 5, 2020

Notes for code Review:

  • ignore all the files in formats/*
  • ignore bin/big-buck-bunny.mp4

Description/Features

Parse the following container formats and the codecs that they have:

  • mp4
  • avi
  • ts
  • mkv
  • webm
  • ogg
  • wav
  • aac
  • ac3
  • mp3
  • flac
  • h265
  • h264

Also parses specific codec parameters where available for:

  • vp09
  • avc (h264)
  • hevc (h265)
  • av1

Finally we handle:

  • skipping id3 tags for flac, mp3, and aac
  • discarding emulation prevention bits (in h264, h265)
  • parsing raw h264/h265 to get codec params for ts, avi, and even raw h264/h265 files

@brandonocasey brandonocasey changed the base branch from master to main December 4, 2020 16:15
Copy link
Member

@gkatsev gkatsev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only super minor stuff, granted I didn't investigate the internals too closely.
Is there a good way to verify this aside from trusting the tests?

];

const videoCodecs = [
// TODO: use another encoder, ffmpeg does not support codecPrivate for vp09
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this something important to have? Maybe we can just generate a one off file for it?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not super important, but it would certainly help verify that we are doing parsing correctly, it would be good to get eventually.

bin/parse-blocks.js Outdated Show resolved Hide resolved
bin/parse-container-codec.js Outdated Show resolved Hide resolved
Comment on lines 20 to 21
// ac3 sync byte
'ac3': toUint8([0x0b, 0x77]),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what about ec-3?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ec-3 is kind of like a codec contained within the ac3 container

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, that's what I thought but wasn't sure. I think it's worth adding a comment here saying that this covers ec-3 as well.

@brandonocasey
Copy link
Contributor Author

Once I write up the usage for parse-container-codec.js you can use that on init segments from advanced bitbop, ts segments, should support most video formats really. It should spit out the container and codecs contained in the file.

Copy link
Member

@gkatsev gkatsev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works well for me.

bin/parse-format.js Outdated Show resolved Hide resolved
@brandonocasey brandonocasey merged commit f7fe601 into main Dec 16, 2020
@brandonocasey brandonocasey deleted the feat/parse-codec branch December 16, 2020 17:28
brandonocasey added a commit that referenced this pull request Dec 16, 2020
…rsing codecs from files (#14)

BREAKING CHANGE: toUint8 in byte-helpers functions slightly differently
BREAKING CHANGE: getId3Offset is exported from id3-helpers rather than containers

We can now parse the container for and many of the codecs within (where applicable) for mp4, avi, ts, mkv, webm, ogg, wav, aac, ac3 (and ec3 which is contained in ac3 files), mp3, flac, raw h265, and raw h264.

Codec parsing has also been extended to parse codec details in a file for vp09, avc (h264), hevc (h265), av1, and opus

Finally we have the following additional features to our parsing of codec/container information:
* skipping multiple id3 tags at the start of a file for flac, mp3, and aac
* discarding emulation prevention bits (in h264, h265)
* parsing raw h264/h265 to get codec params for ts, avi, and even raw h264/h265 files
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.

2 participants