Cleanup README
Moved build instructions and docker instructions to separate docs. Removed command samples which are no longer needed as we have better tutorials now. Change-Id: I340c5653a6553158325970dd86d76fa11e69bcbd
This commit is contained in:
parent
327cb8df88
commit
21b0ca6ea5
407
README.md
407
README.md
|
@ -1,373 +1,72 @@
|
||||||
# ![Shaka Packager](docs/shaka-packager.png)
|
![Shaka Packager](docs/shaka-packager.png)
|
||||||
|
|
||||||
[![Build Status](https://travis-ci.org/google/shaka-packager.svg?branch=master)](https://travis-ci.org/google/shaka-packager)
|
[![Build Status](https://travis-ci.org/google/shaka-packager.svg?branch=master)](https://travis-ci.org/google/shaka-packager)
|
||||||
[![Build status](https://ci.appveyor.com/api/projects/status/3t8iu603rp25sa74?svg=true)](https://ci.appveyor.com/project/shaka/shaka-packager)
|
[![Build status](https://ci.appveyor.com/api/projects/status/3t8iu603rp25sa74?svg=true)](https://ci.appveyor.com/project/shaka/shaka-packager)
|
||||||
|
|
||||||
Media packaging SDK intended for C++ programmers writing DASH/HLS packager
|
Shaka Packager is a tool and a media packaging SDK for
|
||||||
applications with common encryption support, Widevine DRM support, Live, and
|
[DASH](http://dashif.org/) and [HLS](https://developer.apple.com/streaming/)
|
||||||
Video-On-Demand.
|
packaging and encryption. It can prepare and package media content for online
|
||||||
|
streaming.
|
||||||
|
|
||||||
This document provides the information needed to create a DASH/HLS packager
|
Shaka Packager supports:
|
||||||
that is able to remux and encrypt a video into fragmented ISO BMFF format with
|
|
||||||
common encryption (CENC) support. The DASH/HLS packaging API is also designed
|
|
||||||
in such a way for easy extension to more source and destination formats.
|
|
||||||
|
|
||||||
Current supported codecs:
|
- Both Video-On-Demand and Live.
|
||||||
|
- Streaming formats:
|
||||||
|
- [DASH](http://dashif.org/)
|
||||||
|
- [HLS](https://developer.apple.com/streaming/)
|
||||||
|
- Key systems:
|
||||||
|
- [Widevine](http://www.widevine.com/)
|
||||||
|
- [Playready](https://www.microsoft.com/playready/)<sup>1</sup>
|
||||||
|
- [Fairplay](https://developer.apple.com/streaming/fps/)<sup>1</sup>
|
||||||
|
- Encryption standards:
|
||||||
|
- [CENC](https://en.wikipedia.org/wiki/MPEG_Common_Encryption)
|
||||||
|
- [SAMPLE-AES](https://developer.apple.com/library/content/documentation/AudioVideo/Conceptual/HLS_Sample_Encryption/Intro/Intro.html)
|
||||||
|
- Media Containers and codecs
|
||||||
|
| Codecs | ISO-BMFF | WebM | MPEG2-TS | WVM |
|
||||||
|
|:-----------------:|:------------:|:------------:|:------------:|:-----------:|
|
||||||
|
| H264 (AVC) | I / O | - | I / O | I |
|
||||||
|
| H265 (HEVC) | I / O | - | I | - |
|
||||||
|
| VP8 | I / O | I / O | - | - |
|
||||||
|
| VP9 | I / O | I / O | - | - |
|
||||||
|
| AAC | I / O | - | I / O | I |
|
||||||
|
| Dolby AC3/EAC3 | I / O | - | - | - |
|
||||||
|
| DTS | I / O | - | - | - |
|
||||||
|
| Opus | *I / O* | I / O | - | - |
|
||||||
|
| Vorbis | - | I / O | - | - |
|
||||||
|
** I for input and O for output.
|
||||||
|
** Opus support in ISO-BMFF is experimental.
|
||||||
|
- Platforms
|
||||||
|
- Linux
|
||||||
|
- Mac
|
||||||
|
- Windows
|
||||||
|
- Cross compiling for ARM is also supported.
|
||||||
|
|
||||||
| Codecs | ISO-BMFF | WebM | MPEG2-TS | WVM |
|
<sup>1: Limited support</sup>
|
||||||
|:-----------------:|:------------:|:------------:|:------------:|:-----------:|
|
|
||||||
| H264 (AVC) | I / O | - | I / O | I |
|
|
||||||
| H265 (HEVC) | I / O | - | I | - |
|
|
||||||
| VP8 | *I / O* | I / O | - | - |
|
|
||||||
| VP9 | *I / O* | I / O | - | - |
|
|
||||||
| AAC | I / O | - | I / O | I |
|
|
||||||
| Dolby AC3/EAC3 | I / O | - | - | - |
|
|
||||||
| DTS | I / O | - | - | - |
|
|
||||||
| Opus | *I / O* | I / O | - | - |
|
|
||||||
| Vorbis | - | I / O | - | - |
|
|
||||||
** I for input and O for output.
|
|
||||||
** VP8/VP9/Opus support in ISO-BMFF is experimental.
|
|
||||||
|
|
||||||
This project is supported on Linux, Windows and MacOSX platforms.
|
# Getting Shaka Packager
|
||||||
|
|
||||||
|
There are several ways you can get Shaka Packager.
|
||||||
|
|
||||||
# Useful Links #
|
- Using [Docker](https://www.docker.com/whatisdocker).
|
||||||
|
Instructions are available [here](docs/source/docker_instructions.md).
|
||||||
|
- Get prebuilt binaries from
|
||||||
|
[release](https://github.com/google/shaka-packager/releases).
|
||||||
|
- Built from source, see [Build Instructions](docs/source/build_instructions.md)
|
||||||
|
for details.
|
||||||
|
|
||||||
|
# Useful Links
|
||||||
|
|
||||||
- [API Documentation](https://google.github.io/shaka-packager/docs)
|
|
||||||
- [Mailing List](https://groups.google.com/forum/#!forum/shaka-packager-users)
|
- [Mailing List](https://groups.google.com/forum/#!forum/shaka-packager-users)
|
||||||
(join for release announcements or problem discussions)
|
(join for release announcements or problem discussions)
|
||||||
- [Docker Builds](https://hub.docker.com/r/google/shaka-packager/tags/)
|
- [Documentation](https://google.github.io/shaka-packager/)
|
||||||
|
- [Tutorials](https://google.github.io/shaka-packager/tutorials/tutorials.html)
|
||||||
- Several open source players:
|
- Several open source players:
|
||||||
- [Web: Shaka Player](https://github.com/google/shaka-player)
|
- [Web: Shaka Player](https://github.com/google/shaka-player)
|
||||||
- [Web: dash.js](https://github.com/Dash-Industry-Forum/dash.js)
|
- [Web: dash.js](https://github.com/Dash-Industry-Forum/dash.js)
|
||||||
- [Android: ExoPlayer](https://github.com/google/ExoPlayer)
|
- [Android: ExoPlayer](https://github.com/google/ExoPlayer)
|
||||||
|
|
||||||
|
# Contributing
|
||||||
|
|
||||||
# Setting Up For Development #
|
If you have improvements or fixes, we would love to have your contributions.
|
||||||
|
See https://github.com/google/shaka-packager/blob/master/CONTRIBUTING.md for
|
||||||
1. Packager source is managed by Git at
|
details.
|
||||||
https://www.github.com/google/shaka-packager. We use gclient tool from Chromium
|
|
||||||
to manage third party libraries. You will need Git (v1.7.5 or above) installed
|
|
||||||
on your machine to access the source code.
|
|
||||||
|
|
||||||
2. Install Chromium depot tools which contains gclient and ninja
|
|
||||||
|
|
||||||
See http://www.chromium.org/developers/how-tos/install-depot-tools for
|
|
||||||
details.
|
|
||||||
|
|
||||||
3. Get the source
|
|
||||||
|
|
||||||
```Shell
|
|
||||||
mkdir shaka_packager
|
|
||||||
cd shaka_packager
|
|
||||||
gclient config https://www.github.com/google/shaka-packager.git --name=src
|
|
||||||
gclient sync
|
|
||||||
```
|
|
||||||
To sync to a particular commit or version, use 'gclient sync -r \<revision\>', e.g.
|
|
||||||
```Shell
|
|
||||||
# Sync to commit 4cb5326355e1559d60b46167740e04624d0d2f51
|
|
||||||
gclient sync -r 4cb5326355e1559d60b46167740e04624d0d2f51
|
|
||||||
# Sync to version 1.2.0
|
|
||||||
gclient sync -r v1.2.0
|
|
||||||
```
|
|
||||||
|
|
||||||
4. Build
|
|
||||||
|
|
||||||
We use ninja, which is much faster than make, to build our code:
|
|
||||||
```Shell
|
|
||||||
cd src
|
|
||||||
ninja -C out/{Debug,Release} [Module]
|
|
||||||
```
|
|
||||||
Module is optional. If not specified, build all, e.g.
|
|
||||||
```Shell
|
|
||||||
ninja -C out/Debug # build all modules in Debug mode
|
|
||||||
ninja -C out/Release # build all modules in Release mode
|
|
||||||
ninja -C out/Release mp4 # build mp4 module in Release mode
|
|
||||||
```
|
|
||||||
Refer to ninja manual for details.
|
|
||||||
|
|
||||||
We also provide a mechanism to change build configurations, for example,
|
|
||||||
developers can change build system to “make” by overriding *GYP_GENERATORS*.
|
|
||||||
```Shell
|
|
||||||
GYP_GENERATORS='make' gclient runhooks
|
|
||||||
```
|
|
||||||
Another example, developers can also enable clang by overriding *GYP_DEFINE*.
|
|
||||||
```Shell
|
|
||||||
GYP_DEFINES='clang=1' gclient runhooks
|
|
||||||
```
|
|
||||||
|
|
||||||
5. Updating the code
|
|
||||||
|
|
||||||
Update your current branch with *git pull* followed by *gclient sync*. Note
|
|
||||||
that if you are not on a branch, *git pull* will not work, and you will need
|
|
||||||
to use *git fetch* instead.
|
|
||||||
|
|
||||||
6. Contributing
|
|
||||||
|
|
||||||
See https://github.com/google/shaka-packager/blob/master/CONTRIBUTING.md for
|
|
||||||
details.
|
|
||||||
|
|
||||||
|
|
||||||
# Using Docker For Testing / Development #
|
|
||||||
|
|
||||||
[Docker](https://www.docker.com/whatisdocker) is a tool that can package an
|
|
||||||
application and its dependencies in a virtual container to run on different
|
|
||||||
host operating systems.
|
|
||||||
|
|
||||||
1. Install [Docker](https://docs.docker.com/installation/).
|
|
||||||
|
|
||||||
2. Pull prebuilt image from Dockerhub or build an image locally
|
|
||||||
|
|
||||||
2.a. Pull prebuilt image from Dockerhub
|
|
||||||
|
|
||||||
```Shell
|
|
||||||
docker pull google/shaka-packager
|
|
||||||
```
|
|
||||||
|
|
||||||
2.b. Build an image locally
|
|
||||||
|
|
||||||
```Shell
|
|
||||||
docker build -t google/shaka-packager github.com/google/shaka-packager.git
|
|
||||||
```
|
|
||||||
|
|
||||||
3. Run the container (`your_media_path` should be your media folder)
|
|
||||||
|
|
||||||
```Shell
|
|
||||||
docker run -v /your_media_path/:/media -it --rm google/shaka-packager
|
|
||||||
```
|
|
||||||
|
|
||||||
4. Testing
|
|
||||||
|
|
||||||
```Shell
|
|
||||||
# Make sure you run step 3 and you're inside the container.
|
|
||||||
cd /media
|
|
||||||
|
|
||||||
# VOD: mp4 --> dash
|
|
||||||
packager input=/media/example.mp4,stream=audio,output=audio.mp4 \
|
|
||||||
input=/media/example.mp4,stream=video,output=video.mp4 \
|
|
||||||
--mpd_output example.mpd
|
|
||||||
|
|
||||||
# Leave the container.
|
|
||||||
exit
|
|
||||||
```
|
|
||||||
Outputs are available in your media folder `your_media_path`.
|
|
||||||
|
|
||||||
|
|
||||||
# Design Overview #
|
|
||||||
|
|
||||||
Major modules are described below:
|
|
||||||
|
|
||||||
Demuxer is responsible for extracting elementary stream samples from a
|
|
||||||
multimedia file, e.g. an ISO BMFF file. The demuxed streams can be fed into a
|
|
||||||
muxer to generate multimedia files. An optional KeySource can be provided to
|
|
||||||
Demuxer to decrypt CENC and WVM source content.
|
|
||||||
|
|
||||||
Demuxer reads from source through the File interface. A concrete LocalFile
|
|
||||||
class is already implemented. The users may also implement their own File class
|
|
||||||
if they want to read/write using a different kinds of protocol, e.g. network
|
|
||||||
storage, http etc.
|
|
||||||
|
|
||||||
Muxer is responsible for taking elementary stream samples and producing media
|
|
||||||
segments. An optional KeySource can be provided to Muxer to generate encrypted
|
|
||||||
outputs. Muxer writes to output using the same File interface as Demuxer.
|
|
||||||
|
|
||||||
Demuxer and Muxer are connected using MediaStream. MediaStream wraps the
|
|
||||||
elementary streams and is responsible for the interaction between Demuxer and
|
|
||||||
Muxer. A demuxer can transmits multiple MediaStreams; similarly, A muxer is
|
|
||||||
able to accept and mux multiple MediaStreams, not necessarily from the same
|
|
||||||
Demuxer.
|
|
||||||
|
|
||||||
MpdBuilder is responsible for the creation of Media Presentation Description as
|
|
||||||
specified in ISO/IEC 23009-1 DASH MPD spec.
|
|
||||||
|
|
||||||
Refer to [Design](docs/design.md),
|
|
||||||
[API](https://google.github.io/shaka-packager/docs) for details.
|
|
||||||
|
|
||||||
|
|
||||||
# DASH-IF IOP Compliance #
|
|
||||||
|
|
||||||
We try out best to be compliant to [Guidelines for Implementation: DASH-IF
|
|
||||||
Interoperability Points](http://dashif.org/wp-content/uploads/2015/04/DASH-IF-IOP-v3.0.pdf).
|
|
||||||
|
|
||||||
We are already compliant to most of the requirements specified by the document,
|
|
||||||
with two exceptions:
|
|
||||||
- ContentProtection elements are still put under Representation element instead
|
|
||||||
of AdaptationSet element;
|
|
||||||
- Representations encrypted with different keys are still put under the same
|
|
||||||
AdaptationSet.
|
|
||||||
|
|
||||||
We created a flag '--generate_dash_if_iop_compliant_mpd', if enabled,
|
|
||||||
- ContentProtection elements will be moved under AdaptationSet;
|
|
||||||
- Representations encrypted with different keys will be put under different
|
|
||||||
AdaptationSets, grouped by `@group` attribute.
|
|
||||||
|
|
||||||
Users can enable the flag '--generate_dash_if_iop_compliant_mpd' to have these
|
|
||||||
features. This flag will be enabled by default in a future release.
|
|
||||||
|
|
||||||
Please feel free to file a bug or feature request if there are any
|
|
||||||
incompatibilities with DASH-IF IOP or other standards / specifications.
|
|
||||||
|
|
||||||
|
|
||||||
# Driver Program Sample Usage #
|
|
||||||
|
|
||||||
Sample driver programs **packager** and **mpd_generator** are written using the
|
|
||||||
SDK.
|
|
||||||
|
|
||||||
Some sample usages:
|
|
||||||
|
|
||||||
Run the program without arguments will display the help page with the list of
|
|
||||||
command line arguments:
|
|
||||||
```Shell
|
|
||||||
packager
|
|
||||||
```
|
|
||||||
|
|
||||||
Dump stream info:
|
|
||||||
```Shell
|
|
||||||
packager input=sintel.mp4 --dump_stream_info
|
|
||||||
```
|
|
||||||
|
|
||||||
Demux audio from the input and generate a fragmented mp4:
|
|
||||||
```Shell
|
|
||||||
packager input=sintel.mp4,stream=audio,output=fragmented_sintel.mp4
|
|
||||||
```
|
|
||||||
|
|
||||||
Demux streams from the input and generates a mpd with fragmented mp4:
|
|
||||||
```Shell
|
|
||||||
packager \
|
|
||||||
input=sintel.mp4,stream=audio,output=sintel_audio.mp4 \
|
|
||||||
input=sintel.mp4,stream=video,output=sintel_video.mp4 \
|
|
||||||
--mpd_output sintel_vod.mpd
|
|
||||||
```
|
|
||||||
|
|
||||||
Includes a subtitle input from webvtt:
|
|
||||||
```Shell
|
|
||||||
packager \
|
|
||||||
input=sintel.mp4,stream=audio,output=sintel_audio.mp4 \
|
|
||||||
input=sintel.mp4,stream=video,output=sintel_video.mp4 \
|
|
||||||
input=sintel_english_input.vtt,stream=text,output=sintel_english.vtt \
|
|
||||||
--mpd_output sintel_vod.mpd
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
You may also generate mpd with live profile by specifying segment_template in
|
|
||||||
stream descriptors. Here is an example with IPTV input streams:
|
|
||||||
```Shell
|
|
||||||
packager \
|
|
||||||
'input=udp://224.1.1.5:5003,stream=audio,init_segment=live-audio.mp4,segment_template=live-audio-$Number$.mp4,bandwidth=130000' \
|
|
||||||
'input=udp://224.1.1.5:5003,stream=video,init_segment=live-video-sd.mp4,segment_template=live-video-sd-$Number$.mp4,bandwidth=2000000' \
|
|
||||||
'input=udp://224.1.1.5:5002,stream=video,init_segment=live-video-hd.mp4,segment_template=live-video-hd-$Number$.mp4,bandwidth=5000000' \
|
|
||||||
--mpd_output live.mpd
|
|
||||||
```
|
|
||||||
|
|
||||||
A UDP url is of the form udp://ip:port[?options]. Here is an example:
|
|
||||||
udp://224.1.1.5:5003?reuse=1&interface=10.11.12.13&timeout=1234567.
|
|
||||||
|
|
||||||
Three options are supported right now:
|
|
||||||
- reuse=1|0
|
|
||||||
Allow or disallow reusing UDP sockets. Default to 0.
|
|
||||||
- interface=interface_ip_address
|
|
||||||
Address of the interface over which to receive UDP multicast streams.
|
|
||||||
- timeout=microseconds
|
|
||||||
Timeout in microseconds. Default to unlimited.
|
|
||||||
|
|
||||||
To generate static mpd with live profile. An additional flag needs to be
|
|
||||||
specified:
|
|
||||||
```Shell
|
|
||||||
packager \
|
|
||||||
'input=sintel.mp4,stream=audio,init_segment=audio.mp4,segment_template=audio-$Number$.mp4' \
|
|
||||||
'input=sintel.mp4,stream=video,init_segment=video.mp4,segment_template=video-$Number$.mp4' \
|
|
||||||
--mpd_output live_static.mpd \
|
|
||||||
--generate_static_mpd
|
|
||||||
```
|
|
||||||
|
|
||||||
Demux video from the input and generate an encrypted fragmented mp4 using
|
|
||||||
Widevine encryption with RSA signing key file *widevine_test_private.der*:
|
|
||||||
```Shell
|
|
||||||
packager input=sintel.mp4,stream=video,output=encrypted_sintel.mp4 \
|
|
||||||
--enable_widevine_encryption \
|
|
||||||
--key_server_url "https://license.uat.widevine.com/cenc/getcontentkey/widevine_test" \
|
|
||||||
--content_id "3031323334353637" \
|
|
||||||
--signer "widevine_test" \
|
|
||||||
--rsa_signing_key_path "widevine_test_private.der"
|
|
||||||
```
|
|
||||||
|
|
||||||
The program also supports AES signing. Here is an example with encryption key
|
|
||||||
rotates every 1800 seconds:
|
|
||||||
```Shell
|
|
||||||
packager \
|
|
||||||
'input=udp://224.1.1.5:5003,stream=audio,init_segment=live-audio.mp4,segment_template=live-audio-$Number$.mp4,bandwidth=130000' \
|
|
||||||
'input=udp://224.1.1.5:5003,stream=video,init_segment=live-video-sd.mp4,segment_template=live-video-sd-$Number$.mp4,bandwidth=2000000' \
|
|
||||||
'input=udp://224.1.1.5:5002,stream=video,init_segment=live-video-hd.mp4,segment_template=live-video-hd-$Number$.mp4,bandwidth=5000000' \
|
|
||||||
--mpd_output live.mpd \
|
|
||||||
--enable_widevine_encryption \
|
|
||||||
--key_server_url "https://license.uat.widevine.com/cenc/getcontentkey/widevine_test" \
|
|
||||||
--content_id "3031323334353637" \
|
|
||||||
--signer "widevine_test" \
|
|
||||||
--aes_signing_key "1ae8ccd0e7985cc0b6203a55855a1034afc252980e970ca90e5202689f947ab9" \
|
|
||||||
--aes_signing_iv "d58ce954203b7c9a9a9d467f59839249" \
|
|
||||||
--crypto_period_duration 1800
|
|
||||||
```
|
|
||||||
Note that key rotation is only supported for live profile.
|
|
||||||
|
|
||||||
Demux and decrypt video from a WVM container, and generate encrypted fragmented
|
|
||||||
mp4 using Widevine encryption with RSA signing key file
|
|
||||||
*widevine_test_private.der*:
|
|
||||||
```Shell
|
|
||||||
packager input=sintel.wvm,stream=video,output=encrypted_sintel.mp4 \
|
|
||||||
--enable_widevine_decryption \
|
|
||||||
--enable_widevine_encryption \
|
|
||||||
--key_server_url "https://license.uat.widevine.com/cenc/getcontentkey/widevine_test" \
|
|
||||||
--content_id "3031323334353637" \
|
|
||||||
--signer "widevine_test" \
|
|
||||||
--rsa_signing_key_path "widevine_test_private.der"
|
|
||||||
```
|
|
||||||
|
|
||||||
The program can be told to generate MediaInfo files, which can be fed to
|
|
||||||
**mpd_generate** to generate the mpd file.
|
|
||||||
```Shell
|
|
||||||
packager \
|
|
||||||
input=sintel.mp4,stream=video,output=sintel_video.mp4 \
|
|
||||||
input=sintel.mp4,stream=audio,output=sintel_audio.mp4 \
|
|
||||||
--output_media_info
|
|
||||||
|
|
||||||
mpd_generator \
|
|
||||||
--input "sintel_video.mp4.media_info,sintel_audio.mp4.media_info" \
|
|
||||||
--output "sintel.mpd"
|
|
||||||
```
|
|
||||||
|
|
||||||
Output MPEG2-TS video.
|
|
||||||
```Shell
|
|
||||||
packager \
|
|
||||||
'input=bear-1280x720.mp4,stream=video,segment_template=bear$Number$.ts'
|
|
||||||
```
|
|
||||||
|
|
||||||
Output HLS playlists with MPEG2-TS video. The following outputs a Master
|
|
||||||
Playlist as `master.m3u8`. And the Media Playlist for the video as
|
|
||||||
`playlist.m3u8`. The optional `--hls_base_url` specifies the prefix for the
|
|
||||||
generated TS segments.
|
|
||||||
```Shell
|
|
||||||
packager \
|
|
||||||
'input=bear-1280x720.mp4,stream=video,segment_template=bear$Number$.ts,playlist_name=playlist.m3u8' \
|
|
||||||
--hls_master_playlist_output="master.m3u8" \
|
|
||||||
--hls_base_url="http://localhost:10000/"
|
|
||||||
```
|
|
||||||
|
|
||||||
For audio Media Playlists, the name and group for EXT-X-MEDIA tag must be
|
|
||||||
specified.
|
|
||||||
```Shell
|
|
||||||
packager \
|
|
||||||
'input=input.mp4,stream=video,segment_template=output$Number$.ts,playlist_name=video_playlist.m3u8' \
|
|
||||||
'input=input.mp4,stream=audio,segment_template=output_audio$Number$.ts,playlist_name=audio_playlist.m3u8,hls_group_id=audio,hls_name=ENGLISH' \
|
|
||||||
--hls_master_playlist_output="master_playlist.m3u8" \
|
|
||||||
--hls_base_url="http://localhost:10000/"
|
|
||||||
```
|
|
||||||
|
|
||||||
Create DASH trick play, a.k.a. trick mode, stream. The `trick_play_factor` in
|
|
||||||
the stream descriptor specifies the sampling rate among the key frames in the
|
|
||||||
video. For example, 1 means every key frame and 2 means every other key frame.
|
|
||||||
```Shell
|
|
||||||
packager \
|
|
||||||
'input=bear-1280x720.mp4,stream=video,output=bear-1280x720_video.mp4' \
|
|
||||||
'input=bear-1280x720.mp4,stream=video,output=bear-1280x720_video_trick_play.mp4,trick_play_factor=1' \
|
|
||||||
--mpd_output bear_trick_play.mpd
|
|
||||||
```
|
|
||||||
|
|
|
@ -0,0 +1,314 @@
|
||||||
|
# Build Instructions
|
||||||
|
|
||||||
|
Shaka Packager supports building on Windows, Mac and Linux host systems.
|
||||||
|
|
||||||
|
## Linux build dependencies
|
||||||
|
|
||||||
|
Most development is done on Ubuntu (currently 14.04, Trusty Tahr). The
|
||||||
|
dependencies mentioned here are only for Ubuntu. There are some instructions
|
||||||
|
for [other distros below](#notes-for-other-linux-distros).
|
||||||
|
|
||||||
|
```shell
|
||||||
|
sudo apt-get update
|
||||||
|
sudo apt-get install build-essential curl git python
|
||||||
|
```
|
||||||
|
|
||||||
|
Note that `Git` must be v1.7.5 or above.
|
||||||
|
|
||||||
|
## Mac system requirements
|
||||||
|
|
||||||
|
* [Xcode](https://developer.apple.com/xcode) 7.3+.
|
||||||
|
* The OS X 10.10 SDK or later. Run
|
||||||
|
|
||||||
|
```shell
|
||||||
|
$ ls `xcode-select -p`/Platforms/MacOSX.platform/Developer/SDKs
|
||||||
|
```
|
||||||
|
|
||||||
|
to check whether you have it.
|
||||||
|
|
||||||
|
## Windows system requirements
|
||||||
|
|
||||||
|
* Visual Studio 2015 Update 3, see below (no other version is supported).
|
||||||
|
* Windows 7 or newer.
|
||||||
|
|
||||||
|
Install Visual Studio 2015 Update 3 or later - Community Edition should work if
|
||||||
|
its license is appropriate for you. Use the Custom Install option and select:
|
||||||
|
|
||||||
|
- Visual C++, which will select three sub-categories including MFC
|
||||||
|
- Universal Windows Apps Development Tools > Tools (1.4.1) and Windows 10 SDK
|
||||||
|
(10.0.14393)
|
||||||
|
|
||||||
|
## Install `depot_tools`
|
||||||
|
|
||||||
|
### Linux and Mac
|
||||||
|
|
||||||
|
Clone the `depot_tools` repository from Chromium:
|
||||||
|
|
||||||
|
```shell
|
||||||
|
$ git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git
|
||||||
|
```
|
||||||
|
|
||||||
|
Add `depot_tools` to the end of your PATH (you will probably want to put this
|
||||||
|
in your `~/.bashrc` or `~/.zshrc`). Assuming you cloned `depot_tools` to
|
||||||
|
`/path/to/depot_tools`:
|
||||||
|
|
||||||
|
```shell
|
||||||
|
$ export PATH="$PATH:/path/to/depot_tools"
|
||||||
|
```
|
||||||
|
|
||||||
|
### Windows
|
||||||
|
|
||||||
|
Download the
|
||||||
|
[depot_tools bundle](https://storage.googleapis.com/chrome-infra/depot_tools.zip)
|
||||||
|
and extract it somewhere.
|
||||||
|
|
||||||
|
*** note
|
||||||
|
**Warning:** **DO NOT** use drag-n-drop or copy-n-paste extract from Explorer,
|
||||||
|
this will not extract the hidden “.git” folder which is necessary for
|
||||||
|
depot_tools to autoupdate itself. You can use “Extract all…” from the context
|
||||||
|
menu though.
|
||||||
|
***
|
||||||
|
|
||||||
|
Add depot_tools to the start of your PATH (must be ahead of any installs of
|
||||||
|
Python). Assuming you unzipped the bundle to C:\src\depot_tools, open:
|
||||||
|
|
||||||
|
Control Panel → System and Security → System → Advanced system settings
|
||||||
|
|
||||||
|
If you have Administrator access, Modify the PATH system variable and
|
||||||
|
put `C:\src\depot_tools` at the front (or at least in front of any directory
|
||||||
|
that might already have a copy of Python or Git).
|
||||||
|
|
||||||
|
If you don't have Administrator access, you can add a user-level PATH
|
||||||
|
environment variable and put `C:\src\depot_tools` at the front, but
|
||||||
|
if your system PATH has a Python in it, you will be out of luck.
|
||||||
|
|
||||||
|
Also, add a DEPOT_TOOLS_WIN_TOOLCHAIN system variable in the same way, and set
|
||||||
|
it to 0. This tells depot_tools to use your locally installed version of Visual
|
||||||
|
Studio (by default, depot_tools will try to use a google-internal version).
|
||||||
|
|
||||||
|
From a cmd.exe shell, run the command gclient (without arguments). On first
|
||||||
|
run, gclient will install all the Windows-specific bits needed to work with
|
||||||
|
the code, including msysgit and python.
|
||||||
|
|
||||||
|
* If you run gclient from a non-cmd shell (e.g., cygwin, PowerShell),
|
||||||
|
it may appear to run properly, but msysgit, python, and other tools
|
||||||
|
may not get installed correctly.
|
||||||
|
* If you see strange errors with the file system on the first run of gclient,
|
||||||
|
you may want to
|
||||||
|
[disable Windows Indexing](http://tortoisesvn.tigris.org/faq.html#cantmove2).
|
||||||
|
|
||||||
|
## Get the code
|
||||||
|
|
||||||
|
Create a `shaka_packager` directory for the checkout and change to it (you can
|
||||||
|
call this whatever you like and put it wherever you like, as long as the full
|
||||||
|
path has no spaces):
|
||||||
|
|
||||||
|
```shell
|
||||||
|
$ mkdir shaka_packager && cd shaka_packager
|
||||||
|
```
|
||||||
|
|
||||||
|
Run the `gclient` tool from `depot_tools` to check out the code and its
|
||||||
|
dependencies.
|
||||||
|
|
||||||
|
```shell
|
||||||
|
$ gclient config https://www.github.com/google/shaka-packager.git --name=src --unmanaged
|
||||||
|
$ gclient sync
|
||||||
|
```
|
||||||
|
|
||||||
|
To sync to a particular commit or version, add the '-r \<revision\>' flag to
|
||||||
|
`gclient sync`, e.g.
|
||||||
|
|
||||||
|
```shell
|
||||||
|
$ gclient sync -r 4cb5326355e1559d60b46167740e04624d0d2f51
|
||||||
|
```
|
||||||
|
|
||||||
|
```shell
|
||||||
|
$ gclient sync -r v1.2.0
|
||||||
|
```
|
||||||
|
|
||||||
|
If you don't want the full repo history, you can save some time by adding the
|
||||||
|
`--no-history` flag to `gclient sync`.
|
||||||
|
|
||||||
|
When the above commands completes, it will have created a hidden `.gclient` file
|
||||||
|
and a directory called `src` in the working directory. The remaining
|
||||||
|
instructions assume you have switched to the `src` directory:
|
||||||
|
|
||||||
|
```shell
|
||||||
|
$ cd src
|
||||||
|
```
|
||||||
|
|
||||||
|
### Build Shaka Packager
|
||||||
|
|
||||||
|
#### Linux and Mac
|
||||||
|
|
||||||
|
Shaka Packager uses [Ninja](https://ninja-build.org) as its main build tool,
|
||||||
|
which is bundled in depot_tools.
|
||||||
|
|
||||||
|
To build the code, run `ninja` command:
|
||||||
|
|
||||||
|
```shell
|
||||||
|
$ ninja -C out/Release
|
||||||
|
```
|
||||||
|
|
||||||
|
If you want to build debug code, replace `Release` above with `Debug`.
|
||||||
|
|
||||||
|
We also provide a mechanism to change build settings, for example,
|
||||||
|
you can change build system to `make` by overriding `GYP_GENERATORS`:
|
||||||
|
|
||||||
|
```shell
|
||||||
|
$ GYP_GENERATORS='make' gclient runhooks
|
||||||
|
```
|
||||||
|
|
||||||
|
Another example, you can also disable clang by overriding `GYP_DEFINES`:
|
||||||
|
|
||||||
|
```shell
|
||||||
|
$ GYP_DEFINES='clang=0' gclient runhooks
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Windows
|
||||||
|
|
||||||
|
The instructions are similar, except that Windows allows using either `/` or `\`
|
||||||
|
as path separator:
|
||||||
|
|
||||||
|
```shell
|
||||||
|
$ ninja -C out/Release
|
||||||
|
$ ninja -C out\Release
|
||||||
|
```
|
||||||
|
|
||||||
|
Also, unlike Linux / Mac, 32-bit is chosen by default even if the system is
|
||||||
|
64-bit. 64-bit has to be enabled explicitly and the output directory is
|
||||||
|
configured to `out/%CONFIGURATION%_x64`, i.e.:
|
||||||
|
|
||||||
|
```shell
|
||||||
|
$ GYP_DEFINES='target_arch=x64' gclient runhooks
|
||||||
|
$ ninja -C out/Release_x64
|
||||||
|
```
|
||||||
|
|
||||||
|
### Build artifacts
|
||||||
|
|
||||||
|
After a successful build, you can find build artifacts including the main
|
||||||
|
`packager` binary in build output directory (`out/Release` or `out/Release_x64`
|
||||||
|
for release build).
|
||||||
|
|
||||||
|
See [Shaka Packager Documentation](https://google.github.io/shaka-packager/)
|
||||||
|
on how to use `Shaka Packager`.
|
||||||
|
|
||||||
|
### Update your checkout
|
||||||
|
|
||||||
|
To update an existing checkout, you can run
|
||||||
|
|
||||||
|
```shell
|
||||||
|
$ git pull origin master --rebase
|
||||||
|
$ gclient sync
|
||||||
|
```
|
||||||
|
|
||||||
|
The first command updates the primary Packager source repository and rebases on
|
||||||
|
top of tip-of-tree (aka the Git branch `origin/master`). You can also use other
|
||||||
|
common Git commands to update the repo.
|
||||||
|
|
||||||
|
The second command syncs dependencies to the appropriate versions and re-runs
|
||||||
|
hooks as needed.
|
||||||
|
|
||||||
|
## Cross compiling for ARM on Ubuntu host
|
||||||
|
|
||||||
|
The install-build-deps script can be used to install all the compiler
|
||||||
|
and library dependencies directly from Ubuntu:
|
||||||
|
|
||||||
|
```shell
|
||||||
|
$ ./pacakger/build/install-build-deps.sh
|
||||||
|
```
|
||||||
|
|
||||||
|
Install sysroot image and others using `gclient`:
|
||||||
|
|
||||||
|
```shell
|
||||||
|
$ GYP_CROSSCOMPILE=1 GYP_DEFINES="target_arch=arm" gclient runhooks
|
||||||
|
```
|
||||||
|
|
||||||
|
The build command is the same as in Ubuntu:
|
||||||
|
|
||||||
|
```shell
|
||||||
|
$ ninja -C out/Release
|
||||||
|
```
|
||||||
|
|
||||||
|
## Notes for other linux distros
|
||||||
|
|
||||||
|
### Arch Linux
|
||||||
|
|
||||||
|
Instead of running `sudo apt-get install` to install build dependencies, run:
|
||||||
|
|
||||||
|
```shell
|
||||||
|
$ sudo pacman -S --needed python2 git curl gcc gcc-libs make
|
||||||
|
$ sudo ln -sf python2 /usr/bin/python
|
||||||
|
```
|
||||||
|
|
||||||
|
Clang requires libtinfo.so.5 which is not available by default on Arch Linux.
|
||||||
|
You can get libtinfo from ncurses5-compat-libs in AUR:
|
||||||
|
|
||||||
|
```shell
|
||||||
|
$ git clone https://aur.archlinux.org/ncurses5-compat-libs.git
|
||||||
|
$ cd ncurses5-compat-libs
|
||||||
|
$ gpg --keyserver pgp.mit.edu --recv-keys F7E48EDB
|
||||||
|
$ makepkg -si
|
||||||
|
```
|
||||||
|
|
||||||
|
### Debian
|
||||||
|
|
||||||
|
Same as Ubuntu.
|
||||||
|
|
||||||
|
### Fedora
|
||||||
|
|
||||||
|
Instead of running `sudo apt-get install` to install build dependencies, run:
|
||||||
|
|
||||||
|
```shell
|
||||||
|
$ su -c 'yum install -y git python git curl gcc-c++ findutils bzip2 \
|
||||||
|
ncurses-compat-libs'
|
||||||
|
```
|
||||||
|
|
||||||
|
### OpenSUSE
|
||||||
|
|
||||||
|
Use `zypper` command to install dependencies:
|
||||||
|
|
||||||
|
```shell
|
||||||
|
sudo zypper in git python python-xml git curl gcc-c++ tar
|
||||||
|
```
|
||||||
|
|
||||||
|
## Tips, tricks, and troubleshooting
|
||||||
|
|
||||||
|
### Xcode license agreement
|
||||||
|
|
||||||
|
If you're getting the error
|
||||||
|
|
||||||
|
> Agreeing to the Xcode/iOS license requires admin privileges, please re-run as
|
||||||
|
> root via sudo.
|
||||||
|
|
||||||
|
the Xcode license hasn't been accepted yet which (contrary to the message) any
|
||||||
|
user can do by running:
|
||||||
|
|
||||||
|
```shell
|
||||||
|
$ xcodebuild -license
|
||||||
|
```
|
||||||
|
|
||||||
|
Only accepting for all users of the machine requires root:
|
||||||
|
|
||||||
|
```shell
|
||||||
|
$ sudo xcodebuild -license
|
||||||
|
```
|
||||||
|
|
||||||
|
## Contributing
|
||||||
|
|
||||||
|
If you have improvements or fixes, we would love to have your contributions.
|
||||||
|
See https://github.com/google/shaka-packager/blob/master/CONTRIBUTING.md for
|
||||||
|
details.
|
||||||
|
|
||||||
|
We have continue integration tests setup on pull requests. You can also verify
|
||||||
|
locally by running the tests manually.
|
||||||
|
|
||||||
|
If you know which tests are affected by your change, you can limit which tests
|
||||||
|
are run using the `--gtest_filter` arg, e.g.:
|
||||||
|
|
||||||
|
```shell
|
||||||
|
$ out/Debug/mp4_unittest --gtest_filter="MP4MediaParserTest.*"
|
||||||
|
```
|
||||||
|
|
||||||
|
You can find out more about GoogleTest at its
|
||||||
|
[GitHub page](https://github.com/google/googletest).
|
|
@ -0,0 +1,43 @@
|
||||||
|
# Using Docker
|
||||||
|
|
||||||
|
[Docker](https://www.docker.com/whatisdocker) is a tool that can package an
|
||||||
|
application and its dependencies in a virtual container to run on different
|
||||||
|
host operating systems.
|
||||||
|
|
||||||
|
## Get Shaka Packager from Dockerhub
|
||||||
|
|
||||||
|
To pull latest Shaka Packager:
|
||||||
|
|
||||||
|
```shell
|
||||||
|
$ docker pull google/shaka-packager
|
||||||
|
```
|
||||||
|
|
||||||
|
You can pull a specific version, e.g. v1.6.2:
|
||||||
|
|
||||||
|
```shell
|
||||||
|
$ docker pull google/shaka-packager:release-v1.6.2
|
||||||
|
```
|
||||||
|
|
||||||
|
The full list of tags is available
|
||||||
|
[here](https://hub.docker.com/r/google/shaka-packager/tags/).
|
||||||
|
|
||||||
|
## Run the container
|
||||||
|
|
||||||
|
Assume you have your media files stored in `host_media_path` in the host
|
||||||
|
machine.
|
||||||
|
|
||||||
|
This runs the container and maps `host_media_path` to `media` in the container:
|
||||||
|
|
||||||
|
```shell
|
||||||
|
$ docker run -v /host_media_path/:/media -it --rm google/shaka-packager
|
||||||
|
```
|
||||||
|
|
||||||
|
Then in the container, run the packager command, e.g.:
|
||||||
|
|
||||||
|
```shell
|
||||||
|
$ packager input=/media/example.mp4,stream=audio,output=/media/audio.mp4 \
|
||||||
|
input=/media/example.mp4,stream=video,output=/media/video.mp4 \
|
||||||
|
--mpd_output /media/example.mpd
|
||||||
|
```
|
||||||
|
|
||||||
|
Outputs are available in the host's media folder `host_media_path`.
|
|
@ -87,7 +87,7 @@ const char kUsage[] =
|
||||||
" If specified, the output is a trick play stream.\n"
|
" If specified, the output is a trick play stream.\n"
|
||||||
" - hls_name: Required for audio when outputting HLS.\n"
|
" - hls_name: Required for audio when outputting HLS.\n"
|
||||||
" name of the output stream. This is not (necessarily) the same as\n"
|
" name of the output stream. This is not (necessarily) the same as\n"
|
||||||
" output. This is used as the NAME attribute for EXT-X-MEDIA\n"
|
" output. This is used as the NAME attribute for EXT-X-MEDIA.\n"
|
||||||
" - hls_group_id: Required for audio when outputting HLS.\n"
|
" - hls_group_id: Required for audio when outputting HLS.\n"
|
||||||
" The group ID for the output stream. This is used as the GROUP-ID\n"
|
" The group ID for the output stream. This is used as the GROUP-ID\n"
|
||||||
" attribute for EXT-X-MEDIA.\n"
|
" attribute for EXT-X-MEDIA.\n"
|
||||||
|
|
|
@ -15,9 +15,9 @@
|
||||||
|
|
||||||
DEFINE_bool(enable_widevine_encryption,
|
DEFINE_bool(enable_widevine_encryption,
|
||||||
false,
|
false,
|
||||||
"Enable encryption with Widevine license server/proxy. User should "
|
"Enable encryption with Widevine key server. User should provide "
|
||||||
"provide either AES signing key (--aes_signing_key, "
|
"either AES signing key (--aes_signing_key, --aes_signing_iv) or "
|
||||||
"--aes_signing_iv) or RSA signing key (--rsa_signing_key_path).");
|
"RSA signing key (--rsa_signing_key_path).");
|
||||||
DEFINE_bool(enable_widevine_decryption,
|
DEFINE_bool(enable_widevine_decryption,
|
||||||
false,
|
false,
|
||||||
"Enable decryption with Widevine license server/proxy. User should "
|
"Enable decryption with Widevine license server/proxy. User should "
|
||||||
|
|
Loading…
Reference in New Issue