feat: Added audio specific configuration udts box to AudioSampleEntry
for MP4 input/output. DASH tags for DTS audio as specified in ETSI TS
103 491 and ETSI TS 102 114.
Closes#1301
---------
Co-authored-by: Cosmin Stejerean <cstejerean@meta.com>
ISO/IEC 14496-15 says about the `HEVCDecoderConfigurationRecord`:
> **array_completeness** when equal to 1 indicates that all NAL units of
> the given type are in the following array and none are in the stream;
> when equal to 0 indicates that additional NAL units of the indicated type
> may be in the stream; the default and permitted values are constrained
> by the sample entry name;
This PR sets `array_completeness` to 0 if parameter NAL units may appear
in the stream when they are not stripped by
`--strip_parameter_set_nalus`.
This should increase player-compatibiltity for streams with mid-stream
SAR changes.
---------
Co-authored-by: Cosmin Stejerean <cstejerean@meta.com>
This work was done over ~80 individual commits in the `cmake` branch,
which are now being merged back into `main`. As a roll-up commit, it is
too big to be reviewable, but each change was reviewed individually in
context of the `cmake` branch. After this, the `cmake` branch will be
renamed `cmake-porting-history` and preserved.
---------
Co-authored-by: Geoff Jukes <geoffjukes@users.noreply.github.com>
Co-authored-by: Bartek Zdanowski <bartek.zdanowski@gmail.com>
Co-authored-by: Carlos Bentzen <cadubentzen@gmail.com>
Co-authored-by: Dennis E. Mungai <2356871+Brainiarc7@users.noreply.github.com>
Co-authored-by: Cosmin Stejerean <cstejerean@gmail.com>
Co-authored-by: Carlos Bentzen <carlos.bentzen@bitmovin.com>
Co-authored-by: Cosmin Stejerean <cstejerean@meta.com>
Co-authored-by: Cosmin Stejerean <cosmin@offbytwo.com>
As per the AV1 spec, the codec string may contain optional color values.
This extracts the missing color information from the mp4 `colr` atom, if
present, and generates the full AV1 codec string.
Closes#1007
Note:
* An xHE-AAC capable encoder will auto adjust the user-specified SAP/RAP
value to the allowed grid where SAP/RAPs can occur.
e.g.: `-rapInterval 5000` (5s) may result in actual SAPs/RAPs every
4.984s.
* To ensure SAP/RAP starts a new segment, Shaka needs to executed with a
"--segment_duration" is less than or equal to that adjusted value.
* If every SAP/RAP should trigger a new segment, just set the segment
length to a very low value e.g.: `--segment_duration 0.1`
The resolution values are uninitialized when parsing AVC decoder
configuration record if it does not contain parameter sets (SPS/PPS),
thus they could contain undefined values.
Fixes#750.
Change-Id: I6d54ec9f8740acd45a67b4b7d69031e097fbacc1
Remove custom constructors, which is no longer needed with C++11. Use
C++ struct zero initialization instead.
Fixes#686.
Change-Id: I512da9f23a250e8b9ebf8bb8e0a39ad0f822d0d3
- Parse and extract transfer_characteristics from H264/H265 VUI
parameters.
- Set VIDEO-RANGE attribute in HLS according to HLS specification:
https://tools.ietf.org/html/draft-pantos-hls-rfc8216bis-02#section-4.4.4.2
- Also added an end to end test.
Fixes#632.
Change-Id: Iadf557d967b42ade321fb0b152e8e7b64fe9ff3e
- Add relevant FOURCCs for Dolby Vision.
- Parse DOVIDecoderConfigurationRecord (dvcC, dvvC) to generate
Dolby Vision codec string.
- Propagate Dolby Vision configs (dvcC, dvvC, hvcE) from Demuxer
to Muxer.
- Add a Dolby Vision end to end test.
Support for backward compatibility signaling in DASH and HLS will be
added in a later CL.
Issue #341
Change-Id: If1385df5f48e04b59cb7661130bea48e26b453bf
- Parses parameter set NAL units in the samples.
- Calculate pixel width and height from track width and height.
Fixes#621, #627.
Change-Id: Ic1e120dccbd220b01168f7bf4effeaa43f95b055
This is needed for Dolby Vision as Dolby Vision uses NAL unit type 62
to carry private information.
Issue #341.
Change-Id: Ib3f06d8f36ef3d89c33162dd74c012a0c3a805e5
- Define BaseDescriptor and generic read / write operations.
- Define descriptors: ESDescriptor, DecoderConfigDescriptor,
DecoderSpecificInfoDescriptor, SLConfigDescriptor.
DecoderSpecificInfoDescriptor and all other descriptors can now
handle arbitrary length size, not limiting to 64 byte for
DecoderSpecificInfoDescriptor, which was placed to limit
ESDescriptor length size to one byte.
- Now DecoderConfigDescriptor is able to handle reading and writing
of all fields including buffer_size_db, which was not handled
earlier.
Fixes#536.
Change-Id: Ia8a775f8bf6e90e3343a85f0e643bc44cd017c7a
Implemented according to bitstream spec at
https://aomediacodec.github.io/av1-spec/.
It will be used to do AV1 subsample encryption later.
Issue #453.
Change-Id: I84d8a2a780d95f2c9f430ee598838b97474cc0af
The VP9 level is computed when the container is missing a codec config
or if the level is missing from the codec config.
This fixes VP9 in ISO-BMFF files generated by FFmpeg v4.0.2 or earlier
which does not have level set in the codec config.
Fixes#469.
Change-Id: I685bfd48be16ee6b2209da1c3173f7d6bb02b36a
Implemented per AV1 Codec ISO Media File Format Binding at
https://aomediacodec.github.io/av1-isobmff/
And AOM AV1 codec mapping in Matroska/WebM at
https://github.com/Matroska-Org/matroska-specification/blob/av1-mappin/codec/av1.md
Note that AV1 specific boxes are not supported in this CL, i.e.
AV1 Forward Key Frame sample group entry 'av1f', AV1 Multi-Frame
sample group entry 'av1m' etc are not supported. These boxes are optional.
We will add support later if they are useful to the clients / players.
Encryption is not supported yet.
Issue #453.
Change-Id: I630432d0a9bf82d263ffaf40e57f67fc65eee902
- Also fixed compilations in Alpine Linux and other flavors of Linux.
- Added container versions in docker files to always use a verified
version.
Closes#164.
Change-Id: I949a8709e4d70c49129c9c2e8608dd78193d964c
This is a more faithful implementation of more_rbsp_data().
There could be trailing null bytes in NAL units. This isn't valid per
H264 specification, but the referenced bug includes a sample where the
PPS in the avcC record includes a trailing null byte.
Workaround the problem so packager does not fail.
A similar problem is workarounded in Chrome:
https://codereview.chromium.org/1107593004Closes#418
Change-Id: I28cb8a9371945dc094f766c3e559d7a66859b451
Instead of failing immediately, ignore unsupported audio codec when
parsing the source file, as there may be more than one stream in the
source file. This allows the supported streams to be packaged.
Closes#395.
Change-Id: I01005a93a19012c19065251647c9b06dd25c673a
In H265Parser::ParseSliceHeader, the parser does not handle
byte_alignment() from the spec. byte_alignment() reportedly contains
at least one bit, which is not handled right now.
See Section 7.3.2.12 Rec. ITU-T H.265 v3 (04/2015).
Also added a few size sanity checks in H265Parser to make sure the
code does not crash if an invalid input is provided.
Fixes#383.
Change-Id: I33b31396058fc5ba67a0fc119be5fe56ec9443b0
Fixes#387.
Note that the output will not play in Chrome until the Chrome bug
https://crbug.com/837832 is fixed.
Change-Id: Ic3e917161cedfa773c0a18b4a5d7b1254c6f1313
When converting from NAL unit stream to byte stream.
The packager should not assume the parameter sets in the sample is the
same as the parameter sets in sample entry (decoder configuration).
Fixes#327.
Change-Id: I7e84d28a296f4b33db0523cca5eabd62f623e852
When transmuxing from TS to MP4 if there is emulation prevention
bytes in general_profile_tier_level_data.
Fixes#312
Change-Id: I48857046c1ea4bed4f455d03d060551e3ef4bec8
Seeing some failures on some platforms when compiled with clang
disabled:
GYP_DEFINES="clang=0" gclient runhooks
Several changes to make it work:
1. Mark packager code with packager_code=1 in GYP definitions.
2. Disable a few checks in non-packager code, which we do not have
direct control: dangling-else, deprecated-declarations,
unused-function
3. Fix the relevant errors in packager code.
4. Revert HAVE_STROPTS_H in curl config which is not available in
all linux distributions.
Fixes#286Fixes#293
Change-Id: I729b41f99403c5ad9487c6cc4a7dc06f6323cef8
- This fixes the issue when one NAL unit has multiple
subsamples, which is allowed in spec and could happen
when the clear_bytes exceeds 2^16 bytes.
- The new algorithm updates the subsample entries in
following steps:
1) When NaluReader parses a new NAL unit, the
function splits subsamples and align them with the
NAL unit. It also finds the range of subsamples
for that NAL unit.
2) Drop or update subsamples of that NAL unit,
based on the type. Other inserted bytes are treated
as a new all-clear subsample.
3) Merge those subsamples if possible.
- This addresses #237.
Change-Id: I2cab47cd00d90e29ec52b90d4fde057c632193ac
Shared libpackager can be built by setting libpackager_type to
shared_library, e.g.
GYP_DEFINES='libpackager_type=shared_library' gclient runhooks
ninja -C out/Debug
will generate libpackager.so in out/Debug/lib directory.
Here is a few other changes to make shared_library builds and
tests pass:
- Add several test parameters to packager.h, which is needed for
testing.
- Create a protoc.gypi from build/protoc.gypi but depending on
protobuf_full_do_not_use instead of protobuf_lite, since we need
protobuf_full_do_not_use for text parsing and generation of media
info proto. Somehow shared_library build does not allow mixed use
of protobuf_full_do_not_use and protobuf_lite.
- Remove the use of LazyInstance in version/version.cc and use static
variable directly. This is because LazyInstance needs AtExitManager
which may not be easy to setup when calling GetVersion.
- Allow skipping testPackageWvmInputWithoutStrippingParameterSetNalus
with flag --shared_library, which is needed as shared_library build
does not support --strip_parameter_set_nalus flag yet.
Fixes#227
Change-Id: Iff05a50baa28134faa7218664c96114cb9e70329
- Implemented according to v1.0 spec @ https://www.webmproject.org/vp9/mp4/
- v0 is no longer supported
Change-Id: I189c813d788400beda797eea7da943a83dfa7d79
- The flags were overwritten in a loop and therefore only stored the
last value of the flag.
- Change the fields into arrays so that the flags are not overwritten.
Change-Id: I59762d7c84bc3d81bf3b0b5e85ffe689260d970a
Added a flag --strip_parameter_set_nalus. When enabled, parameter
set NAL units, SPS/PPS for H264 and SPS/PPS/VPS for H265, are stripped
from frames when converting NAL byte stream (AnnexB stream) to NAL
unit stream, which generates avc1/hvc1; otherwise they are not
stripped, and avc3/hev1 is generated.
Parameter set NAL units should not be stripped if they are varying
in the frames otherwise the frames may fail to be decoded.
The flag is enabled by default as we don't usually see varying
SPS/PPS/VPS and it is more space efficient with them stripped.
Set --strip_parameter_set_nalus=false to disable the flag if there
are varying SPS/PPS/VPS in the frames. This addresses #206.
Change-Id: I34bde6f33069f9f77d51a510b39f58a0f0e141aa