Commit Graph

667 Commits

Author SHA1 Message Date
Sergio Garcia Murillo f9908362f8
Prevent seg fault if webm fragment is not initialized or last frame is EOS
Fixes #900
2021-03-07 15:01:08 -08:00
Sergio Garcia Murillo b8ce44aba0
Prevent seg fault if mp4 fragment is not initialized
Related to #900.
2021-03-02 23:53:58 -08:00
Jacob Trimble 00af192626 Cleanup HttpFile and related PR.
This implements many of the comments made on the PR and cleans up those
files.

Closes #149

Change-Id: Ice73fe3c04a6f595da6986a4c070e50cb20f9435
2021-03-02 17:43:47 +00:00
Jacob Trimble a0f3f2cd3a Add cc_index to stream descriptor.
This also allows setting the language of different text streams from
the same input.  Multiple streams can use the same input stream
using different cc_index values and can each use a different language.

This also will try to pull the language from the input if not
specified.

Change-Id: I7078710b509b7d77dad8cb4299a82f954af7e9e7
2021-02-17 18:33:53 +00:00
Jacob Trimble 78be14c092 Add DVB-sub parser
Note that this only supports a single page within the DVB-sub stream.
Multiple pages will be merged together.  A follow-up will allow
selecting a specific page.

This only supports outputting using TTML or MP4+TTML; you cannot have
DVB-sub output nor can you output it in WebVTT.  Since DVB-sub
uses images, it is hard to impossible to do this with WebVTT.

This also only supports interlaced images, not progressive images
nor text.

Closes #832

Change-Id: Id6dbb6393c7b9a05722e61c6bd255bef5e69a7d8
2021-02-17 18:32:03 +00:00
Jacob Trimble 95089593fc Don't re-open WebVTT file to determine size.
Change-Id: Id92226adce813b7d0c4c741e47e36dbf8f208797
2021-02-08 20:31:13 +00:00
JPeMu 36ef7ec945
[MPEG-TS] Fix PCR reserved bits not being set correctly
Fixes #893.
2021-02-03 12:09:07 -08:00
Ole Andre Birkedal aa17521268
HTTP PUT output support (#737)
Issue #149

Co-authored-by: Andreas Motl <andreas.motl@elmyra.de>
Co-authored-by: Rintaro Kuroiwa <rkuroiwa@google.com>
Co-authored-by: Ole Andre Birkedal <o.birkedal@sportradar.com>
2021-02-02 10:51:50 -08:00
Jacob Trimble 5bcda6b88b Use TsStreamType for MP2T parser.
This also changes some of the logs to error so the user can see why
the parsing failed.

Change-Id: Ib8b7a5076462bccc718e17ef9e0a57d172d1f7b4
2021-02-01 20:13:13 +00:00
Jacob Trimble 2eb32ee177 Propagate Flush errors in MP2T parser.
Issue #832

Change-Id: I59f31ff491437b81ffc22ab5760ad0c059e9933e
2021-01-20 18:27:31 +00:00
Jacob Trimble 89d407f9ae Add subtitle composition to DVB-sub parser.
Issue #832

Change-Id: Iababe884619e1e48f1abe0806e8b863c95a3c1ef
2021-01-20 18:26:28 +00:00
Jacob Trimble 32c5393fba Add helpers for DVB-sub colors.
Issue #832

Change-Id: I6350306c7d9a6450d82994bbd9a9a239986bc3fa
2021-01-20 18:25:43 +00:00
Vishal Shah 8e3e8d3e8e
[WEBVTT] Support both center and middle text alignments
Fixes #882.
2021-01-19 11:45:20 -08:00
KongQun Yang b231c36539 Properly handle SkipBytes with num_bytes as 0
Previously if there are no bytes remaining, SkipBytes(0) would fail,
which results in parsing error in
AACAudioSpecificConfig::ParseProgramConfigElement.

Fixes #875.

Change-Id: I271899a37303d0d3fa0cf1bf90f99227058b82df
2020-12-23 11:08:33 -08:00
KongQun Yang 10daa39901 [MP4] Allow not to generate 'sidx' box for single-segment too
I.e. the flag --generate_sidx_in_media_segments,
--nogenerate_sidx_in_media_segments work for both single-segment
and multi-segment mode with this change.

Related to #862.

Change-Id: Icd27fd00e8e036ba0c4709b48650372429cc0351
2020-12-11 19:08:37 +00:00
KongQun Yang 516430bde1 [MP4] Truncate segment references in 'sidx' if necessary
The reference count in 'sidx' box is a uint16 field, which allows at
most 0xFFFF entries, i.e. at most 0xFFFF subsegments, which is roughly
18 hours for one second segments.

Do not fail packaging when it happens. Instead, generate a warning and
truncate the number of references to 0xFFFF instead.

Note that the actual number of mp4 fragments in the mp4 file can still
be more than 0xFFFF. The stream will not play to the end in DASH, but
it will play successfully in HLS.

Workarounds #862.

Change-Id: Ib3930418d1528df1f9ea64cda0d0ebaa78d26abb
2020-12-11 19:07:56 +00:00
Jacob Trimble c4a11aaed4 Add support for text cue heights.
Issue #832

Change-Id: Ifccbd6c6c46916d3d28ac4afaba01fc158c9c361
2020-12-10 13:26:34 -08:00
Jacob Trimble fe44b5e13c Add background image to TextSample and TTML output
Issue #832

Change-Id: I50f23223fa4362559087ada9b40488c089594450
2020-12-08 19:24:31 +00:00
Jacob Trimble 9b036b764b Add TextSample handling to MP2T parser.
This also changes the callbacks a bit to (a) avoid passing references
for already ref-counted types, and (b) don't pass PID since the
parent knows this and gives it to the child parser.

Issue #832

Change-Id: I7dd44436c8d1ad81d42a813d16f850175b85ad1a
2020-12-08 10:30:29 -08:00
Jacob Trimble a93eeca5db Add TTML-in-MP4 output support.
This changes the default MP4 output to use TTML and adds a way to
choose which one is used.  This is done with 'format=ttml+mp4' or
'format=vtt+mp4'.

This also fixes the boxes output in WebVTT in MP4.

Change-Id: Ieaa7fc44fbf4dc020a5bb70cfa3578ec10e088ce
2020-11-20 15:10:33 -08:00
Jacob Trimble 4766654b4d Add TTML text output.
This only supports TTML output; meaning the user can convert WebVTT
into TTML, but not the other way around.  This will be useful for
DVB-sub subtitles that would be better supported within TTML.

This only adds text-based output; a follow-up will add MP4 support.

Change-Id: I0944b7df95d7765e55f203fc5e9a644f5c455dd8
2020-11-19 18:03:39 +00:00
Jacob Trimble 8e85862bda Ignore unsupported H26x streams.
This adds a new path when parsing MPEG2-TS streams to ignore unsupported
streams.  This allows extracting supported streams when some of the
streams are unsupported.  For example, you can extract audio from a
file that has unsupported video.

Change-Id: I608fcb19d0a573bfd35e9272f60b0b69346ae11a
2020-11-09 18:11:07 +00:00
Jacob Trimble 10e71680a1 Parse WebVTT regions and styles.
This adds more generic settings for regions and CSS styles.  These are
global settings, so they go on the StreamInfo object.

Change-Id: Ibb76c060206152ccf8e9a067c09877226f67c927
2020-11-09 18:08:42 +00:00
Jacob Trimble 1f21cc78cd Add style support for cue fragments.
Now text cues are composed of nested fragments that can be individually
styled.  This allows portions of the cue to be bold, etc.  The
WebVTT parser doesn't parse the inputs, but the original tags are
preserved in WebVTT output.  The WebVTT output will add tags if the
style elements are present in the cue object.

Change-Id: I6abba4175e376e4f753193f7d8cac63e958d3c89
2020-10-21 10:53:59 -07:00
Jacob Trimble 414f4589c8 Parse TextSettings from WebVTT.
Now the Cue settings are a generic object that is parsed in WebVTT.
This will allow setting the settings in different parsers without having
to use WebVTT-specifics.

Change-Id: I36689bec725bd2e515af962b7174fc5977f96fa2
2020-10-20 21:50:06 +00:00
Jacob Trimble b2220eb0c6 Add text fragment and setting types.
This sets the groundwork for more generic text cues by having a more
generic object for the settings and the body.  This also changes the
TextSample to be immutable and accepts the fields in the constructor
instead of using setters.

Change-Id: I76b09ce8e8471a49e6bf447e8c187f867728a4bf
2020-10-19 10:39:17 -07:00
Jacob Trimble 56908a83a7 Convert text WebVTT output to muxer.
Now text-based WebVTT also uses the generic media pipeline.  This
converts the WebVttTextOutputHandler to a WebVttMuxer to be more
consistent with the other muxer types.

This also allows choosing between single-segment text and multi-segment.
Before, we would generate both and use single-segment for DASH and
multi-segment for HLS; but now you can choose between either and either
are supported in both DASH and HLS.

Change-Id: I6f7edda09e01b5f40e819290d3fe6e88677018d9
2020-10-19 17:24:38 +00:00
Jacob Trimble 2909ca0c77 Handle segmented text same as audio/video.
Now the same pipeline for handling the audio/videos streams will handle
the segmented text streams too.  This doesn't apply to the text output,
only to the MP4 variants.  This also fixes a bug where we added the
X-TIMESTAMP-MAP tag even when there wasn't TS streams; this doesn't
otherwise change the behavior around that tag.

Change-Id: I03f7cea56efa42e96311c00841330629a14aa053
2020-10-07 17:49:03 +00:00
Jacob Trimble 9babfb883b Fix segmented WebVTT test.
The test added in the previous CL was broken due to a rebase on another
change.  This subtly changed some of the byte offsets that broke the
test.  This wasn't caught since I didn't rebase and re-run the tests
before merging.

Change-Id: Id7e4c7688278eae37da1a14f1648263b4dda98cd
2020-09-16 13:24:16 -07:00
Jacob Trimble e3bc85f12d Make WebVttParser a MediaParser.
This changes it from an OriginHandler to a MediaParser and moves the
handling of it to the Demuxer.  This will allow more generic handling
of text by giving it the same abstractions as video/audio handling.

Change-Id: Ibbde3c84d228ec8e83af1ed266ea97dbc9589c24
2020-09-16 20:12:48 +00:00
Jacob Trimble ba33a63693 Add TextSample to MediaParser.
In addition to the MediaSample handling of the MediaParser, this now
adds callbacks for TextSample.  This allows reading text streams from
the media files.

Change-Id: I6c00e286e98bc9aafe05b99cf2f7ce6f89d167a9
2020-09-16 20:09:28 +00:00
Jacob Trimble 748e7e0056 Make the text readers use streams.
Instead of having the text readers reading from the file directly, they
now accept the data as a stream.

Change-Id: Id1b32c867a8058a68ae7aab5c568f77672a4401d
2020-09-16 20:06:51 +00:00
koln67 5b9fd409a5
[MP4] Change major brand from isom to mp41
This fixes warnings that 'isom' can only be a compatible instead of major brand.

Issue #755.
2020-09-08 15:45:21 -07:00
koln67 562040e000
[TS] Calculate frame rate using the second sample
Related to #751.
2020-09-02 14:27:02 -07:00
koln67 54bf394c03
[HLS] Ensure playlists with TS streams include FRAME-RATE
It fixes the FRAME-RATE missing issue in #816.
2020-08-21 12:04:24 -07:00
akata01 6298f49d9e
Don't fail if input contents contain SampleGroupDescriptionBox with 0 entries
Fixes #812.
2020-08-09 18:44:16 -07:00
koln67 caa47e374d
Properly handle AVC profiles with SPS extension
Part of #755 to improve DASH spec compliance.
2020-08-05 17:08:53 -07:00
sr90 11d69896c0
Write to memory file before writing to file for WebM segments generation (#803)
The change is needed to address #554.
2020-07-27 21:32:56 -07:00
koln67 a8ea7fd085
Always set ES_ID to 0 when writing ES Descriptor in mp4 (#798)
Required by ISO/IEC 14496-14:2018 and ISO/IEC 23000-19:2018.

Issue #755.
2020-07-15 14:14:15 -07:00
sr90 db5413ed7a
Write to buffer before writing to file for TS segments generation. (#790)
The refactoring is needed to address #554.
2020-07-04 15:18:30 -07:00
Weiguo Shao 540c0aaffb
Added AC-4 codec support (#795)
Closes #754.
2020-07-04 14:55:28 -07:00
Joe Foraci 6b036b9bb1
Support different IVs for each track (#793)
This is supported by allowing IV to be specified in the "key_info_string".

Fixes #543.
2020-06-25 20:37:50 -07:00
Jacob Trimble 1911c1beaa Add flag for extra PlayReady header data.
Fixes #756

Change-Id: I4fa6328480130675a0257fd2c6663d91729cf72c
2020-06-22 22:55:25 +00:00
Jacob Trimble 665e784cbd Move PSSH generation to EncryptionHandler.
The KeySource now only handles fetching the keys and loading any PSSH
info from the license; it will not handle generating new PSSH info
based on the config.

This will allow the PSSH generation to access to the full
EncryptionConfig so we can add additional options to it.

Issue #756

Change-Id: Ia67387aa3d5ec0d723b7f5f21fc517f64c840393
2020-06-22 22:51:44 +00:00
Zajcev Evgeny 8913dbda85
Mpeg1 Audio: Support for iso-bmff output (#780)
Issue #779.
2020-06-06 17:18:00 -07:00
Jacob Trimble 7e41937bb1 Consolidate key system enums.
There were several enum types that all were used for key systems.  This
combines them into one to make it more clear and only needing to update
one.  This also uses a bit field to specify multiple key systems instead
of using a std::vector.

Change-Id: Ia88039835492a5bd47f449ba4b76187046deeec0
2020-06-04 17:19:18 +00:00
Weiguo Shao 4f068bfaa8
Support DD+JOC in DASH and HLS (#775)
Spec: ETSI TS 102 366 V1.4.1
HLS: https://developer.apple.com/documentation/http_live_streaming/hls_authoring_specification_for_apple_devices/hls_authoring_specification_for_apple_devices_appendices
DASH: https://github.com/Dash-Industry-Forum/DASH-IF-IOP/issues/268

Closes #753.
2020-06-03 22:02:49 -07:00
KongQun Yang f51e98c422 Fix possible incorrect resolutions with avc3
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
2020-06-03 22:59:30 +00:00
Zajcev Evgeny 98a9d1baf6
Support for MPEG-1 Audio in mpeg2ts I/O and packed-audio output (#778)
Implemented according to https://www.datavoyage.com/mpgscript/mpeghdr.htm.

Closes #779.
2020-06-02 17:32:19 -07:00
Alen Vrečko 15934d66c0
H265: Fixed inaccurate parsing of ref pic list modification (#773)
Fixes #717: playback issue of HEVC content with cbcs encryption in AVplayer.
2020-05-24 11:51:42 -07:00