Commit Graph

394 Commits

Author SHA1 Message Date
Felicia Lim dc6196d3d1
feat: Add IAMF support (#1415) (#1416) 2024-10-25 09:56:28 -07:00
SteveR-PMP d88ed2798c
feat: EXT-X-SESSION-KEY support (#36) (#1427) 2024-10-25 09:55:27 -07:00
Cosmin Stejerean a99cfe036f
feat: support Dolby Vision profile 8.x (HEVC) and 10.x (AV1) in HLS and DASH (#1396)
Support Dolby Vision profile 8.1, 8.2, 8.4, 10.1, 10.4 signaling in HLS
and DASH.

Adds new option `--use_dovi_supplemental_codecs` (off by default) to use
SUPPLEMENTAL-CODECS in HLS and `scte214:supplementalCodecs` and
`scte214:supplementalProfiles` for DASH.

To maintain compatibility with existing players the current behavior of
using two entries in the manifest remains the default. This will be
changed in a future version where `use_dovi_supplemental_codecs` will
become on by default.

Adds Dolby Vision compatible brands, 'db1p', 'db2g', 'db4g', 'db4h',
'dby1' based on https://mp4ra.org/#/brands

---------

Co-authored-by: Xingzhao Yun <xyun@dolby.com>
2024-05-10 17:42:34 -07:00
Cosmin Stejerean 94db9c9db3
fix: adaptation set IDs were referenced by lowest representation ID (#1394)
After change to add forced command line ordering adaptation set IDs in
places were referenced by their sort index (the minimum representation
index they contained).

Instead always refer to adaptation sets by their own ID, and use the
index only as an optional sort key.

Fixes #1393
2024-05-10 17:24:04 -07:00
sr90 bb104fef5d
feat: get start number from muxer and specify initial sequence number (#879)
Set the start number in representation to the segment index that is sent by muxer.

With this enhancement, you can now specify the initial sequence number
to be used on the generated segments when calling the packager.
With the old implementation, it was always starting with "1".

---------

Co-authored-by: Cosmin Stejerean <cstejerean@meta.com>
2024-05-02 13:25:49 -07:00
Cosmin Stejerean fe885b3ade
feat: add missing DASH roles from ISO/IEC 23009-1 section 5.8.5.5 (#1390)
Fixes #1149

---------

Co-authored-by: Joey Parrish <joeyparrish@users.noreply.github.com>
2024-04-30 14:10:23 -07:00
Torbjörn Einarson 4b5e80d02c
feat: teletext formatting (#1384)
This PR adds parsing of teletext styling, and rendering of the styling
in output TTML and WebVTT subtitle tracks.

Beyond unit tests, I've used the sample
https://drive.google.com/file/d/19ZYsoeUfH85gEilQkaAdLbPhC4CxhDEh/view?usp=sharing
which has rather advanced subtitling with two separate rows at the same
time, where one is left aligned and another is right aligned. This
necessitates two parallel cues to be rendered. It also has some colored
text.

Solve #1335.

## parse teletext styling and formatting

Extend the teletext parser to parse the teletext styling and formatting.
This includes translating rows into regions, calculating alignment
from start and stop position of the text, and extracting text and
background colors.

The colors are limited to full lines.
Both lines and regions are propagated in the TextSample structures.
This is because the number of lines may differ from different sources.
For teletext, there are 24 rows, but they are essentially always
used with double height, so the number of output lines is 12
from 0 to 11.
There are also corresponding regions are denoted "ttx_R",
where R is an integer row number. A renderer can use either
the line number or the region ID to render the text.

## ttml generation for teletext to EBU-TT-D

Add support to render teletext input in EBU-TT-D (IMSC-1) format.
This includes appropriate regions ttx_0 to ttx_11 signalled
in the TextSamples, alignment and text and background colors.

The general TTML output has been changed to always include
metadata, layout, and styling nodes, even if they are empty.

EBU-TT-D is detected by the presence of "ttx_?" regions in the
samples. If detected, extra TTML elements will be added and
the EBU-TT-D linePadding used as well.

Appropriate styles for background and text colors are generated
depending on the color and backgroundColor attributes in the
text fragments.

## adapt WebVTT output to teletext TextSample.

Teletext input generates both a region with prefix ttx_
and a floating point line number (e.g. 9.5) in the
range 0 to 11.5 (due to input 0-23 as double lines).

The output is adopted to drop such regions
and convert the line number to an integer
since the standard only used floats for percent
values but not for plain line numbers.
2024-04-29 10:33:03 -07:00
Cosmin Stejerean 84009d82ef
build: turn on integration tests in ctest by default (#1381)
They can still be skipped by passing `-DSKIP_INTEGRATION_TESTS=ON` for
the build configuration. Fix integration tests so they run correctly when building out of tree.

Use FindPython3 in CMake to fix build and integration tests on Windows.
2024-04-19 07:56:49 -07:00
Cosmin Stejerean b7dd8562cf
test: fix TTML integration test where ordering was changed by #1364 (#1379) 2024-03-25 12:31:21 -07:00
Cosmin Stejerean 0fd815a160
fix: duplicate representation id for TTML when forced ordering is on (#1364)
Fixes #1362
2024-03-07 10:32:09 -08:00
Anthony Lu 56440413aa
fix: use a better estimate of frame rate for cases with very short first sample durations (#838)
Use the second sample in mp4 and webm formats. #835 had issues with
merging due to golden file conflicts. Because we cannot make dependent
pull requests, this is a replica of #835.

---------

Signed-off-by: Cosmin Stejerean <cstejerean@meta.com>
Co-authored-by: Cosmin Stejerean <cstejerean@meta.com>
2024-02-28 15:53:06 -08:00
Joey Parrish 6276584de7
fix: Fix missing newline at the end of usage (#1352)
Without this, the command prompt will not appear on its own line after
running `packager` with no arguments.
2024-02-26 19:56:16 -08:00
wjywbs b68ec87f6a
feat: Add support for ALAC codec (#1299)
Co-authored-by: Cosmin Stejerean <cstejerean@meta.com>
2024-02-26 13:39:30 -08:00
Joey Parrish 35c2f46428
fix: Always log to stderr by default (#1350)
This tweaks the default config for stderrthreshold from absl/log so that
we always get logs to stderr by default, as we did in v2. The --quiet
and --v flags that existed in v2 can still be used to modify the log
level, as well as the new --minloglevel from absl/log.

Issue #1325
2024-02-23 16:16:29 -08:00
Daniel Cantarín 89376d3c4d
feat: Allow LIVE UDP WebVTT input (#1349)
An updated version of PR #1027

That previous PR was done using 2021 code, and there were many changes
in the codebase from there, so a rebase was needed and also some minor
tweak here and there. But it's the same code, just reimplemented on a
newer codebase.

If you want to take a look at this in action, after building shaka
packager with this PR's code included, try this commands in 3 different
simultaneous bash sessions:

1. Video UDP input: `ffmpeg -f lavfi -re -i
"testsrc=s=320x240:r=30,format=yuv420p" -c:v h264 -sc_threshold 0 -g 30
-keyint_min 30 -r 30 -a53cc 1 -b:v 150k -preset ultrafast -r 30 -f
mpegts "udp://127.0.0.1:10000?pkt_size=1316"`
2. WebVTT UDP input: `for sec in $(seq 0 9999) ; do printf
"%02d:%02d.000 --> %02d:%02d.000\ntest second ${sec}\n\n" "$(( ${sec} /
60 ))" "$(( ${sec} % 60 ))" "$(( (${sec} + 1) / 60 ))" "$(( (${sec} + 1)
% 60 ))" ; sleep 1 ; done > /dev/udp/127.0.0.1/12345`
3. shaka packager command line: `timeout 60
path/to/build/packager/packager
'in=udp://127.0.0.1:10000?timeout=8000000,stream_selector=0,init_segment=240_init.m4s,segment_template=240_$Number%09d$.m4s,bandwidth=150000'
'in=udp://127.0.0.1:12345?timeout=8000000,stream_selector=0,input_format=webvtt,format=webvtt+mp4,init_segment=text_init.m4s,segment_template=text_$Number%09d$.m4s,language=eng,dash_roles=subtitle'
--mpd_output ./manifest.mpd --segment_duration 3.2
--suggested_presentation_delay 3.2 --min_buffer_time 3.2
--minimum_update_period 3.2 --time_shift_buffer_depth 60
--preserved_segments_outside_live_window 1 --default_language=eng
--dump_stream_info 2>&1`

Note the added `input_format=webvtt` to the shaka packager command's
second selector. That's new from this PR. If you don't use that, shaka's
format autodetection will not detect the webvtt format from the input,
as explained in
https://github.com/shaka-project/shaka-packager/issues/685#issuecomment-1029407191.
Try the command without it if you want to.

Fixes #685
Fixes #1017

---------

Co-authored-by: Daniel Cantarín <canta@canta.com.ar>
2024-02-23 16:02:19 -08:00
Cosmin Stejerean d23cce85b9
feat: add startwithSAP/subsegmentstartswithSAP for audio tracks (#1346)
Add startwithSAP/subsegmentstartswithSAP for aac, ac3, ec3 and ac4 audio tracks according to LIVE or VOD profile.

Replaces #1055
Partial solution for #364

---------

Co-authored-by: Xingzhao Yun <xyun@dolby.com>
Co-authored-by: Joey Parrish <joeyparrish@google.com>
2024-02-23 15:45:46 -08:00
wjywbs 96efc5aa70
feat: Add PlayReady support in HLS. (#1011)
Co-authored-by: Cosmin Stejerean <cstejerean@meta.com>
2024-02-23 15:29:13 -08:00
sr90 4aa4b4b9aa
feat: Add support for single file TS for HLS (#934)
This is based on comments at
https://github.com/google/shaka-packager/pull/891. The muxer is deciding
whether to write to a single file or a segment file based on the
configuration.

Example:
```
../packager 'in=TOS.ts,stream=video,output=tos_video.ts,playlist_name=tos_video.m3u8' \
            'in=TOS.ts,stream=audio,output=tos_audio.ts,playlist_name=tos_audio.m3u8' \
           --hls_master_playlist_output tos.m3u8
```
Tested the content using Exoplayer.

---------

Co-authored-by: Cosmin Stejerean <cstejerean@meta.com>
2024-02-23 15:28:11 -08:00
Marcus Wichelmann 76eb2c1575
feat: Add support for the EXT-X-START tag (#973)
adds an optional `--hls_start_time_offset` parameter, that, when
used, adds `EXT-X-START` tags to the HLS media playlists.

The EXT-X-START tag allows to specify the location where the player
starts playing, either from start (positive value) or from end (negative
value).
This is especially useful in case of livestreams where this tag can be
used to set the target latency of the playback.

Reference: https://datatracker.ietf.org/doc/html/rfc8216#section-4.3.5.2

The RFC says, that the `EXT-X-START` tag could also be added to the
master playlist, but my tests have shown that most players only respect
it when it's in the media playlists.

Fixes #970

---------

Co-authored-by: Joey Parrish <joeyparrish@google.com>
2024-02-15 12:06:06 -08:00
Roy-Funderburk 07f780dae1
feat: This patch adds support for DTS:X Profile 2 audio in MP4 files. (#1303)
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>
2024-02-14 23:03:03 -08:00
Vishal Shah f73ad0d961
feat: HLS / DASH support forced subtitle (#1020)
Closes #988

---------

Co-authored-by: Cosmin Stejerean <cstejerean@meta.com>
2024-02-14 20:27:57 -08:00
sr90 b1c5a7433e
feat(DASH): Add Label element. (#1175)
Add ability to set `Label` tag in MPD, see page 35 of DASH-IF IOP 4.3
https://dashif.org/docs/DASH-IF-IOP-v4.3.pdf

Implements #881 

---------

Co-authored-by: Cosmin Stejerean <cstejerean@meta.com>
2024-02-14 10:36:08 -08:00
SteveR-PMP aad2a12a9d
feat: order streams in manifest based on command-line order (#1329)
This will force the muxer to order streams in the order given on the
command-line.

Closes #560
Closes #1280
Closes #1313

---------

Co-authored-by: Joey Parrish <joeyparrish@users.noreply.github.com>
Co-authored-by: Cosmin Stejerean <cstejerean@meta.com>
2024-02-14 09:21:11 -08:00
Joey Parrish 15b27549a8
chore: Upgrade absl and protobuf (#1337)
protobuf depends on absl, so both needed an update.

Updating absl fixes issues on Alpine 3.19 (see PR #1327), and also
removes the need for hacks around vlog flags.
2024-02-09 20:57:12 -08:00
SteveR-PMP 2ba67bc24c
feat: default text zero bias (#1330)
A positive value, in milliseconds. It is the threshold used to determine
if we should assume that the text stream actually starts at time zero.
If the first sample comes before default_text_zero_bias_ms, then the
start will be padded as the stream is assumed to start at zero. If the
first sample comes after default_text_zero_bias_ms then the start of the
stream will not be padded as we cannot assume the start time of the
stream.
2024-02-08 10:39:50 -08:00
Cosmin Stejerean 56bd823339
fix: duration formatting and update mpd testdata to reflect new format (#1320)
As part of the CMake port we updated the duration formatting to contain
maximum of 6 decimal places but without trailing 0s. There was a bug
however where it used 6 significant digits rather than 6 decimal places
(`%g` rather than `%f`).

This fixes the bug and also updates the MPD sample files for the
integration tests to contain maximum of 6 decimal places.
2024-02-08 09:48:14 -08:00
Cosmin Stejerean e21519bb28
test: update webm samples to use 0.3.0 version number (#1319)
The current libwebm integration test samples contain `libwebm-0.2.1`
however we have updated to a newer version of libwebm so we need to
update the samples.

As of `libwebm-0.3.0` this signature has been frozen so we won't have to
do this again.
2024-02-08 09:47:36 -08:00
Joey Parrish 3e71302ba4
feat!: Rewrite build system and third-party dependencies (#1310)
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>
2023-12-01 09:32:19 -08:00
sr90 8465f5f020
feat(DASH): Add video transfer characteristics. (#1210)
This PR is related to https://github.com/shaka-project/shaka-packager/issues/1035
2023-09-08 14:41:41 -07:00
sr90 520926c27a
fix(MP4): Add compatible brand dby1 for Dolby content. (#1211)
This PR adds dby1 compatible brand to dolby content as per
https://professional.dolby.com/siteassets/content-creation/dolby-vision-for-content-creators/dolby_vision_bitstreams_within_the_iso_base_media_file_format_dec2017.pdf
2023-07-18 19:50:33 -07:00
sr90 ac47e529ad
fix: Update golden files for ttml tests and failing hls unit tests. (#1226)
Updating golden files for failing ttml tests in packager_test.py related
to https://github.com/shaka-project/shaka-packager/pull/1179 and
failing HLS unit tests related to
https://github.com/shaka-project/shaka-packager/pull/1170.
2023-07-12 09:01:55 -07:00
Mark Sargent 1ab6818832
fix: hls, set the DEFAULT explicitly to NO. Supports native HLS players. (#1170)
It appears that not all Apple implementations follow the HLS guidelines.

While the DEFAULT=NO for an audio track should be optional and default
to NO, in practice native HLS players Safari and iOS devices treat the
missing DEFAULT as a MAYBE.

Fixes #1169
2023-07-05 14:18:41 -07:00
Vishal Shah dc0395291a
fix: dash_roles add role=description for DVS audio per DASH-IF-IOP-v4.3 (#1054)
Fixes support for description role for audio DVS tracks as per spec.
2022-06-02 09:40:34 -07:00
Joey Parrish f577e2a0cf
chore: Update URLs after moving projects (#1042)
Since a project URL is encoded into outputs, this means also updating
the golden output files.

Closes #1043
2022-03-07 11:56:34 -08:00
Joey Parrish 249c83f14b build: Fix additional python2/3 issues
The generate_version_string script was only producing correct results
in python 2, not python 3.  The gyp file that references it explicitly
runs it in python3.  The shebang line of the script has been updated
to match.  The script itself has been updated such that it now works
correctly in both python2 and python3.

Scripts that are only used as modules (not executed directly) have had
their shebang lines removed.

This fixes CI failures on GitHub Actions.

Change-Id: I309bafd2fb05e8fb33f5e092ead179c8c42ea5d3
2021-08-26 12:22:20 -07:00
Caitlin O'Callaghan cd018a71c3
Low latency DASH support (#979)
# LL-DASH Support
These changes add support for LL-DASH streaming. 

**NOTE:** LL-HLS support is still in progress, but it's coming. :) 

## Testing
`./chunking_unittest --gtest_filter="ChunkingHandlerTest.LowLatencyDash"`

`./media_event_unittest --gtest_filter="MpdNotifyMuxerListenerTest.LowLatencyDash"`

`./mpd_unittest --gtest_filter="PeriodTest.LowLatencyDashMpdGetXml"`
`./mpd_unittest --gtest_filter="SimpleMpdNotifierTest.NotifyAvailabilityTimeOffset"`
`./mpd_unittest --gtest_filter="SimpleMpdNotifierTest.NotifySegmentDuration"`
`./mpd_unittest --gtest_filter="LowLatencySegmentTest.LowLatencySegmentTemplate"`

Note, packager_test must be run from the main project directory
`./out/Release/packager_test --gtest_filter="PackagerTest.LowLatencyDashEnabledAndUtcTimingNotSet"`
`./out/Release/packager_test --gtest_filter="PackagerTest.LowLatencyDashEnabledAndUtcTimingNotSet"`
2021-08-25 08:38:05 -07:00
Joey Parrish ac125564b9 build: Fix pylint 2.10 issues, use python3 where possible
The newest pylint release complained about several issues that the
older release did not.  This resolves those issues:

 - removes unneeded "u" prefix from strings
 - adds "encoding" parameter for all open() calls
 - because "encoding" is a python3-only parameter, use python3 in all
   the scripts that we control

Unfortunately, python2 is required for any scripts that import modules
from the ancient Chromium build system we're using (referenced by
DEPS), as well as kokoro scripts.

Change-Id: I2e9f97af508efe58b5a71de21740e59b1528affd
2021-08-24 12:27:03 -07:00
Joey Parrish cfbe5c08c2 cleanup: Convert all time parameters to signed
This converts all time parameters to signed, finishing a cleanup that
was started in 2018 in b4256bf0.  This changes the type of:
  - timestamps
    - PTS specifically
  - timestamp offsets
  - timescales
  - durations

This excludes:
  - MP4 box definitions
  - DTS specifically

This is meant to address signed/unsigned conversion issues on arm64
that caused some test cases to fail.

Change-Id: Ic752a20cbc6e31fea6bc0894d1771833171e7cbe
2021-08-05 18:24:15 +00:00
Joey Parrish 56e227267c Fix python linter errors and add linter checks to CI
Internal CI systems and the new GitHub CI system were out of sync,
with the external system not doing any linting.  Further, the internal
system was using an internal-only linter for Python.

This creates a script for Python linting based on the open-source
pylint tool, checks in the Google Style Guide's pylintrc file, creates
a custom action for linting and adds it to the existing workflows,
fixes pre-existing linter errors in Python scripts, and updates pylint
overrides.

b/190743862

Change-Id: Iff1f5d4690b32479af777ded0834c31c2161bd10
2021-06-21 21:46:48 +00:00
Joey Parrish a2e07a901e Refactor actions and workflows
It turns out that workflows were the wrong way to abstract reusable
pieces of work.  This turns common steps into custom actions (build
docs, build packager, test packager) which can be used as encapsulated
steps in multiple workflows.

This is a much more natural way to avoid duplication compared to the
previous approach of triggering one workflow from another.  This also
has the benefit of all of the steps of a release being represented on
GitHub as a single workflow, making it easier to understand what is
happening and what event triggered those steps.

Change-Id: Ife156d60069a39594c7b3bb3bc32080e6453b544
2021-06-17 10:32:24 -07:00
KongQun Yang 72ea5d30f0 Fix gpylint errors
Change-Id: I861cfe98d50867ab9ee9be69cd4ffc3a7157fbd8
2021-06-09 12:17:48 -07:00
Samidh 4686454a73
Add segment_list support for DASH on-demand profile
Configurable under flag --dash_force_segment_list, default to false.

Note that DASH live profile is not supported right now.
2021-05-25 12:08:58 -07:00
Vishal Shah d9124d6aaa
[WEBVTT] Fix missing text alignment tags from output
Legacy players, e.g. older versions of ExoPlayer, do not handle default webvtt text alignment correctly. Need to specify `align:center` explicitly cues without text alignment for backwards compatibility.

Fixes #925.
2021-05-04 22:57:43 -07:00
Joey Parrish d48bf0f48e fix: Explicitly signal the lack of CEA captions in HLS
Closes #922

Change-Id: If097a66642ca40c355a476655ff1394b7b937b17
2021-03-30 18:26:37 +00: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
JPeMu 36ef7ec945
[MPEG-TS] Fix PCR reserved bits not being set correctly
Fixes #893.
2021-02-03 12:09:07 -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
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