Commit Graph

1511 Commits

Author SHA1 Message Date
Shaka Bot 52647b900c
chore(main): release 3.1.0 (#1391)
🤖 I have created a release *beep* *boop*
---


##
[3.1.0](https://github.com/shaka-project/shaka-packager/compare/v3.0.4...v3.1.0)
(2024-05-03)


### Features

* add missing DASH roles from ISO/IEC 23009-1 section 5.8.5.5
([#1390](https://github.com/shaka-project/shaka-packager/issues/1390))
([fe885b3](fe885b3ade))
* get start number from muxer and specify initial sequence number
([#879](https://github.com/shaka-project/shaka-packager/issues/879))
([bb104fe](bb104fef5d))
* teletext formatting
([#1384](https://github.com/shaka-project/shaka-packager/issues/1384))
([4b5e80d](4b5e80d02c))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).
2024-05-03 17:32:27 -07:00
sr90 a54e745cf8
refactor: merge Period::ProtectedAdaptationSetMap into AdaptationSet (#844)
---------

Co-authored-by: Cosmin Stejerean <cstejerean@meta.com>
2024-05-02 19:11: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 62f861c9c2
docs: Fix missing graphviz outputs in generated docs (#1392)
Fixes #1388
2024-05-01 14:20:35 -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
Shaka Bot ceeb378a85
chore(main): release 3.0.4 (#1377)
🤖 I have created a release *beep* *boop*
---


## [3.0.4](https://github.com/shaka-project/shaka-packager/compare/v3.0.3...v3.0.4) (2024-03-27)


### Bug Fixes

* BaseURL missing when MPD base path is empty ([#1380](https://github.com/shaka-project/shaka-packager/issues/1380)) ([90c3c3f](90c3c3f9b3)), closes [#1378](https://github.com/shaka-project/shaka-packager/issues/1378)
* Fix NPM binary selection on ARM Macs ([#1376](https://github.com/shaka-project/shaka-packager/issues/1376)) ([733af91](733af9128d)), closes [#1375](https://github.com/shaka-project/shaka-packager/issues/1375)

---
This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
2024-03-27 13:39:26 -07:00
Cosmin Stejerean 90c3c3f9b3
fix: BaseURL missing when MPD base path is empty (#1380)
The check for `!mpd_dir.empty()` is not needed because MakePathRelative
handles the case where the parent path is empty. As a result of this
check the base url, segment url, or segment template URLs were all
missing in cases where the mpd output was in the current working
directory.

Fixes #1378
2024-03-27 12:03:10 -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
Vitaly Gashkov 733af9128d
fix: Fix NPM binary selection on ARM Macs (#1376)
Fixes #1375
2024-03-20 20:22:29 -07:00
Shaka Bot a87a0e0559
chore(main): release 3.0.3 (#1372) 2024-03-12 13:14:38 -07:00
Joey Parrish 4cb6536060
fix: Fix NPM binary publication (#1371)
The default .npmignore would disallow bin/, which contains binaries for
our NPM release. Every release before v3.0.3 was missing .npmignore, and
therefore had no binaries. These were unusable in NPM, and have been
marked as deprecated because of it.

Closes #1369
2024-03-12 13:09:56 -07:00
Joey Parrish d83c7b1d45
fix: Fix tags in official Docker images and binaries (#1370)
The release workflows did not run checkout with `fetch-tags: true`, so
the builds were unable to compute the correct release version number. I
audited all instances of `actions/checkout` to add `fetch-tags` where
needed and clean up unneeded options.

I also had to fix options to `docker/build-push-action`, which by
default ignores `actions/checkout` and tries to pull from git itself.
This led to the Docker build running in a context without the new tag.

Finally, to make verification easier and provide version info in the
build logs, this adds debugging info to the version-generation script
via stderr.

Closes #1366
2024-03-12 13:09:38 -07:00
Shaka Bot 5ee2b7f0de
chore(main): release 3.0.2 (#1365)
🤖 I have created a release *beep* *boop*
---


##
[3.0.2](https://github.com/shaka-project/shaka-packager/compare/v3.0.1...v3.0.2)
(2024-03-07)


### Bug Fixes

* duplicate representation id for TTML when forced ordering is on
([#1364](https://github.com/shaka-project/shaka-packager/issues/1364))
([0fd815a](0fd815a160)),
closes
[#1362](https://github.com/shaka-project/shaka-packager/issues/1362)

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).
2024-03-11 10:59:23 -04: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
Shaka Bot 6bff14f359
chore(main): release 3.0.1 (#1361) 2024-03-05 10:19:21 -08:00
Joey Parrish ebd608ae68
ci: Update actions (#1360)
This silences warnings about outdated node runtimes in CI jobs.

 - Trivial upgrades:
   - actions/checkout@v3 => v4
   - actions/deploy-pages@v2 => v4
   - actions/upload-pages-artifact@v2 => v3
   - mxschmitt/action-tmate@v3.6 => v3.17
   - mikepenz/action-junit-report@v3.8.0 => v4
 - Upgrades that required small changes or deeper testing:
   - actions/download-artifact@v3 => v4
   - actions/upload-artifact@v3 => v4
   - google-github-actions/release-please-action@v3 => v4
 - Replaced:
   - svenstaro/upload-release-action@v2 => gh CLI

See also:
- https://github.com/actions/upload-artifact/blob/main/docs/MIGRATION.md
2024-03-05 09:28:51 -08:00
Joey Parrish c456ad64d1
fix(CI): Add Mac-arm64 to build matrix (#1359)
Support for this came out in January, 2024. Explicit macos versions seem
to be necessary for now, until GitHub offers "latest" labels targeting
specific architectures.
2024-03-04 14:02:39 -08:00
Joey Parrish 9c033b9d40
ci: Add missing arm64 (self-hosted) builds on release (#1358)
The build invocation from the release workflow needs settings to trigger
self-hosted builds, including Linux arm64.
2024-03-04 11:06:43 -08:00
Shaka Bot 34dcf3bd34
chore(main): release 3.0.0 (#1312)
## [3.0.0](https://github.com/shaka-project/shaka-packager/compare/v2.6.1...v3.0.0) (2024-02-28)

### ⚠ BREAKING CHANGES

* Update all dependencies
* Drop Python 2 support in all scripts
* Replace glog with absl::log, tweak log output and flags
* Replace gyp build system with CMake

### Features & Bug Fixes

Too many to list... See CHANGELOG.md for a full accounting!

---
This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
2024-03-04 09:13:52 -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
Cosmin Stejerean 4d22e99f8e
fix: Restore support for legacy FairPlay system ID (#1357)
Fixes #1356 which was caused by the fix in #1281 which updated this to
use the correct FairPlay system ID. However since old versions
recognized the previous system ID this restores support for it to avoid
breaking clients.
2024-02-28 15:45:03 -08:00
Joey Parrish 9be7c2b1ac
feat: Portable, fully-static release executables on Linux (#1351)
This adds the option FULLY_STATIC to create fully-static executables.

To create portable, fully-static release executables on Linux, we need
to use musl instead of glibc. Static executables from glibc are not
portable.

The popular musl-gcc wrapper does not support C++, so instead we use a
full musl cross-compiler toolchain in the build workflow.

To build FULLY_STATIC, the user must point to the appropriate
cross-compiler, as we do in the workflow. On systems where musl is the
native libc (such as Alpine Linux), this is not necessary.

I have also read that musl's allocator is not very fast in
multi-threaded applications. So when FULLY_STATIC is enabled, we will
also enable mimalloc, a replacement allocator that is very fast.

I tested a very basic packaging command to compare speeds of dynamic
glibc, static musl, and static musl+mimalloc:

dynamic glibc:
runs: 2.527, 2.798, 2.703, 2.756, 2.959
avg = 2.749, std dev = 0.156s

static musl:
runs: 2.813, 2.920, 3.129, 3.003, 2.738
avg = 2.921s, std dev = 0.154s

static musl+mimalloc:
runs: 2.291, 2.034, 2.415, 2.303, 2.265
avg = 2.262s, std dev = 0.140s

The mimalloc build is 82% faster than musl default allocator, 77% faster
than glibc, and has more consistent runtime characteristics (lower
standard deviation).
2024-02-27 10:47:04 -08:00
Cosmin Stejerean 615720e7dd
fix: AudioSampleEntry size caluations due to bad merge (#1354)
from ALAC pull request
2024-02-27 08:57:48 -08:00
Joey Parrish 673e49d2bb
build: Disable warnings in third-party code (#1353)
We already disabled warnings-as-errors in third-party code, but this
goes futher to completely disable third-party warnings. They are mostly
noise, and distracting. If they aren't errors, we shouldn't have our
build logs flooded with them.
2024-02-26 19:57:13 -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
Cosmin Stejerean 71c175d4b8
feat: Add input support for EBU Teletext in MPEG-TS (#1344)
Replaces #1181

* Add support for EBU Teletext input following Level 1.5 of the core
specification ETSI EN 300 706 V1.2.1 (2003-04).
* Add support for webvtt in MP4 segments output.

Closes #272

---------

Co-authored-by: Marcus Spangenberg <marcus.spangenberg@eyevinn.se>
2024-02-23 15:31:48 -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
Peter Zebühr 6acdcc394a
fix: http_file: Close upload cache on task exit (#1348)
In some cases it can happen that the http server responds with a
non-successful status code without reading the response body. In this
case curl may decide not to read from the cache since there is really no
point in sending data to the server. In case some other thread of shaka
has already called HttpFile::Flush it may end up deadlocked there
waiting for the cache to either close or become empty. Thus, we close
the cache when leaving the main thread as no data will be read by curl
after it has finished anyways.

Closes #1347
2024-02-23 09:30:21 -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
Marcus Wichelmann f7b3986818
fix: misleading log output when HLS target duration updates (fixes #969) (#971)
Minor fix. The parameters were swapped.
2024-02-14 22:46:02 -08:00
Marcus Wichelmann 270888abb1
fix: set array_completeness in HEVCDecoderConfigurationRecord correctly (#975)
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>
2024-02-14 22:10:23 -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
Joey Parrish e19d73321d
build: Only ever build static or shared libraries, but never both (#1343)
Closes #1341
2024-02-14 16:20:59 -08:00
Joey Parrish 1f71fa0a0e
build: Fix absl log flags being stripped (#1340)
According to a comment in
packager/third_party/abseil-cpp/source/absl/log/CMakeLists.txt, many
linkers will strip the contents of absl::log_flags because its symbols
symbols are only used in a global constructor, and that for now, clients
should link using
$<LINK_LIBRARY:WHOLE_ARCHIVE,absl::log_flags>.

Closes #1325
2024-02-14 13:59:18 -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 df04d0ed6e
chore: Unfork zlib (#1339)
The issues we had with zlib and CMake have been resolved upstream.
2024-02-12 14:10:51 -08:00
Michał Idzikowski 9193a90f5a
chore: upgrade to alpine 3.19 (#1327)
Co-authored-by: Joey Parrish <joeyparrish@google.com>
2024-02-10 09:25:37 -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
Joey Parrish 9b384828c6
build: Do not treat third-party warnings as errors (#1338) 2024-02-09 19:10:08 -08:00
Joey Parrish 7ef51671f1
fix: Fix uninitialized value found by Valgrind (#1336) 2024-02-08 12:50:12 -08:00
modernletter c09eb831b8
feat: Parse MPEG-TS PMT ES language and maximum bitrate descriptors (#369) (#1311)
Part of https://github.com/shaka-project/shaka-packager/issues/369

This adds read support for some MPEG-TS PMT elementary stream
descriptors:
- ISO639 Language Descriptor providing language code and audio type
- Maximum Bitrate Descriptor providing peak stream bandwidth

Those metadata are propagated to StreamInfo structures:
- StreamInfo.language field
- AudioStreamMetadata.max_bitrate field for audio streams
- audio type is currently not propagated - corresponding field has to be
added to AudioStreamMetadata

Test vector file containing those descriptors is provided.
2024-02-08 11:58:26 -08:00