-
Notifications
You must be signed in to change notification settings - Fork 831
Support variable length sgpd boxes in fMPEG
#3243
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -126,6 +126,22 @@ public void extract_h265WithoutGopParsingFlags() throws Exception { | |
| "extractordumps/mp4/fragmented_captions_h265.mp4_without_gop_parsing_flags"); | ||
| } | ||
|
|
||
| @Test | ||
| public void extract_h264WithVariableLengthSgpdBox() throws Exception { | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does this test fail for you without the fix? It seems to pass for me To show this, I checked out this PR, then ran: And then ran the tests in this file, and they all passed.
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hm, I see what is happening; the I had troubles getting any test to work with <SampleGroupBox Size="28" Type="sbgp" Version="0" Flags="0" Specification="p12" Container="stbl traf" grouping_type="roll">
<SampleGroupBoxEntry sample_count="94" group_description_index="1" group_description_in_traf="1"/>
</SampleGroupBox>
<SampleGroupDescriptionBox Size="30" Type="sgpd" Version="1" Flags="0" Specification="p12" Container="stbl traf" grouping_type="roll" default_length="0">
<RollRecoveryEntry roll_distance="-1"/>
</SampleGroupDescriptionBox>I'll try this again with a file with a |
||
| FragmentedMp4Extractor extractor = | ||
| new FragmentedMp4Extractor(SubtitleParser.Factory.UNSUPPORTED); | ||
| FakeExtractorOutput output = | ||
| TestUtil.extractAllSamplesFromFile( | ||
| extractor, | ||
| ApplicationProvider.getApplicationContext(), | ||
| "media/mp4/sample_fragmented_variable_length_sgpd.mp4"); | ||
|
|
||
| DumpFileAsserts.assertOutput( | ||
| ApplicationProvider.getApplicationContext(), | ||
| output, | ||
| "extractordumps/mp4/fragmented_variable_length_sgpd.mp4"); | ||
| } | ||
|
|
||
| private static FakeExtractorInput createInputForSample(String sample) throws IOException { | ||
| return new FakeExtractorInput.Builder() | ||
| .setData( | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i don't think the
>= 1check here is correct - I think it should be== 1.Looking at section 8.9.3.2 of ISO 14496-12:2015 it seems
default_lengthis present at v1 only, and the same 4 bytes aredefault_sample_description_indexon v2+:This also matches the previous code.
Same below on the condition gating the
description_lengthskip.Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have the 2022 and 2024 DIS versions of ISO 14496-12 here, and those both have the following:
I.e.
default_lengthexists forversion>=1, anddefault_group_description_indexexists forversion>=2. This is also how we writesgpdboxes in our own software.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting, thanks - aren't these two versions of the spec binary-incompatible with each other? My understanding was that this was generally avoided in these sort of specs. Was this an (unacknowledged?) bug in the 2012 to 2020 versions of the spec?
Given this is quite a fiddly change, and there's a risk that it's quite hard to find this PR comment thread in future when someone is going through the blame layer, I'm going to send a change that pretty much only changes
== 1to>= 1with an explanation - and then we can rebase this PR on top - hope that's OK.