shaka-packager
A media packaging and development framework for VOD and Live DASH and HLS applications, supporting Common Encryption for Widevine and other DRM Systems.
Top Related Projects
JavaScript player library / DASH & HLS client / MSE-EME player
GPAC Ultramedia OSS for Video Streaming & Next-Gen Multimedia Transcoding, Packaging & Delivery
Full-featured MP4 format, MPEG DASH, HLS, CMAF SDK and tools
Mirror of https://git.ffmpeg.org/ffmpeg.git
A standalone library of the Fraunhofer FDK AAC code from Android.
Quick Overview
Shaka Packager is an open-source media packaging and encryption tool developed by Google. It is designed to prepare video content for adaptive streaming (DASH, HLS) and supports various forms of content protection, including common encryption schemes.
Pros
- Supports multiple streaming formats (DASH, HLS, Smooth Streaming)
- Handles various encryption schemes and DRM systems
- Command-line interface for easy integration into workflows
- Actively maintained by Google and the open-source community
Cons
- Steep learning curve for beginners
- Limited GUI options, primarily command-line based
- May require additional tools for a complete end-to-end streaming solution
- Documentation can be technical and challenging for non-experts
Code Examples
- Packaging an MP4 file for DASH:
packager \
input=input.mp4,stream=audio,output=audio.mp4 \
input=input.mp4,stream=video,output=video.mp4 \
--mpd_output manifest.mpd
- Encrypting content with Widevine:
packager \
input=input.mp4,stream=audio,output=audio.mp4 \
input=input.mp4,stream=video,output=video.mp4 \
--enable_widevine_encryption \
--key_server_url https://license.uat.widevine.com/cenc/getcontentkey/widevine_test \
--content_id 7465737420636f6e74656e74206964 \
--signer widevine_test \
--aes_signing_key 1ae8ccd0e7985cc0b6203a55855a1034afc252980e970ca90e5202689f947ab9 \
--aes_signing_iv d58ce954203b7c9a9a9d467f59839249 \
--mpd_output manifest.mpd
- Creating HLS output:
packager \
input=input.mp4,stream=audio,output=audio.m3u8 \
input=input.mp4,stream=video,output=video.m3u8 \
--hls_master_playlist_output master.m3u8
Getting Started
-
Install Shaka Packager:
# For Ubuntu/Debian sudo apt-get install shaka-packager # For macOS using Homebrew brew install shaka-packager
-
Basic usage:
packager <flags> [stream_descriptors]
-
For more detailed instructions and options, refer to the official documentation at https://google.github.io/shaka-packager/html/
Competitor Comparisons
JavaScript player library / DASH & HLS client / MSE-EME player
Pros of Shaka Player
- Comprehensive media player with support for adaptive streaming protocols
- Extensive browser compatibility and cross-platform support
- Rich API for customization and integration into web applications
Cons of Shaka Player
- Larger file size and potentially higher resource usage
- Steeper learning curve for basic implementation compared to Shaka Packager
Code Comparison
Shaka Player (client-side playback):
const video = document.getElementById('video');
const player = new shaka.Player(video);
player.load('https://example.com/video.mpd').then(() => {
console.log('The video has been loaded');
});
Shaka Packager (server-side packaging):
packager \
input=input.mp4,stream=audio,output=audio.mp4 \
input=input.mp4,stream=video,output=video.mp4 \
--mpd_output manifest.mpd
Key Differences
- Shaka Player is a client-side media player, while Shaka Packager is a server-side content preparation tool
- Shaka Player focuses on playback and user experience, whereas Shaka Packager handles content encoding and packaging
- Shaka Player is typically used in web applications, while Shaka Packager is used in content delivery workflows
Both projects are part of the Shaka ecosystem, with Shaka Packager preparing content that can be efficiently streamed using Shaka Player.
GPAC Ultramedia OSS for Video Streaming & Next-Gen Multimedia Transcoding, Packaging & Delivery
Pros of GPAC
- More comprehensive multimedia framework with broader functionality
- Longer development history and established community
- Supports a wider range of formats and standards
Cons of GPAC
- Steeper learning curve due to its extensive feature set
- May be overkill for simple packaging tasks
- Less focused on modern streaming formats compared to Shaka Packager
Code Comparison
GPAC (MP4Box command-line tool):
MP4Box -dash 4000 -frag 4000 -rap -segment-name segment_%s input.mp4
Shaka Packager:
packager input=input.mp4,stream=audio,output=audio.mp4 \
input=input.mp4,stream=video,output=video.mp4 \
--mpd_output manifest.mpd
Both tools can perform similar packaging tasks, but GPAC's MP4Box offers more options and flexibility, while Shaka Packager provides a more streamlined approach for modern streaming formats. GPAC is better suited for complex multimedia processing tasks, whereas Shaka Packager is optimized for packaging content for streaming platforms like DASH and HLS.
Full-featured MP4 format, MPEG DASH, HLS, CMAF SDK and tools
Pros of Bento4
- More comprehensive support for various MP4-based formats, including HLS and DASH
- Extensive command-line tools for manipulating and inspecting MP4 files
- Cross-platform compatibility (Windows, macOS, Linux)
Cons of Bento4
- Less focus on live streaming scenarios
- May have a steeper learning curve due to its extensive feature set
- Slower development cycle compared to Shaka Packager
Code Comparison
Bento4:
AP4_File* file = new AP4_File(*input);
AP4_Movie* movie = file->GetMovie();
AP4_Track* track = movie->GetTrack(AP4_Track::TYPE_VIDEO);
Shaka Packager:
std::unique_ptr<MediaHandler> demuxer =
std::make_unique<Mp4MediaHandler>();
std::unique_ptr<MediaHandler> muxer =
std::make_unique<Mp4Muxer>();
Both libraries provide APIs for handling MP4 files, but Bento4's API is more focused on direct manipulation of MP4 structures, while Shaka Packager's API is designed around a pipeline of media handlers for processing and packaging.
Mirror of https://git.ffmpeg.org/ffmpeg.git
Pros of FFmpeg
- Extremely versatile, supporting a wide range of audio and video formats
- Robust command-line interface with extensive options for complex operations
- Large and active community, providing extensive documentation and support
Cons of FFmpeg
- Steeper learning curve due to its vast array of features and options
- Can be more resource-intensive for certain operations
- May require additional tools or scripts for specific streaming-related tasks
Code Comparison
FFmpeg:
ffmpeg -i input.mp4 -c:v libx264 -preset slow -crf 22 -c:a aac -b:a 128k output.mp4
Shaka Packager:
packager input=input.mp4,stream=audio,output=audio.mp4
input=input.mp4,stream=video,output=video.mp4
--mpd_output manifest.mpd
Key Differences
- FFmpeg is a general-purpose multimedia framework, while Shaka Packager focuses on packaging for streaming
- Shaka Packager is designed specifically for DASH and HLS packaging, making it more streamlined for these tasks
- FFmpeg offers more comprehensive media processing capabilities, while Shaka Packager specializes in adaptive streaming preparation
Use Cases
- Choose FFmpeg for general media processing, transcoding, and format conversion
- Opt for Shaka Packager when specifically preparing content for DASH or HLS streaming
A standalone library of the Fraunhofer FDK AAC code from Android.
Pros of fdk-aac
- Specialized in AAC encoding and decoding
- Lightweight and focused on a single audio codec
- Widely used and well-maintained open-source project
Cons of fdk-aac
- Limited to AAC codec only, not suitable for other audio formats
- Lacks packaging and streaming features found in Shaka Packager
- Requires additional tools for complete media processing workflows
Code Comparison
fdk-aac (encoding example):
HANDLE_AACENCODER hAacEncoder;
AACENC_ERROR err;
err = aacEncOpen(&hAacEncoder, 0, 2);
err = aacEncoder_SetParam(hAacEncoder, AACENC_AOT, AOT_AAC_LC);
err = aacEncoder_SetParam(hAacEncoder, AACENC_SAMPLERATE, 44100);
Shaka Packager (packaging example):
PackagerOptions options;
options.output_media_info = true;
std::unique_ptr<Packager> packager = std::make_unique<Packager>();
Status status = packager->Initialize(options);
status = packager->Run();
The code snippets demonstrate the different focus areas of the two projects. fdk-aac is centered on AAC encoding, while Shaka Packager offers a broader range of media packaging functionalities.
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual CopilotREADME
Shaka Packager is a tool and a media packaging SDK for DASH and HLS packaging and encryption. It can prepare and package media content for online streaming.
Shaka Packager supports:
-
Both Video-On-Demand and Live.
-
Streaming formats:
-
Key systems:
-
Encryption standards:
-
Media Containers and codecs
Codecs ISO-BMFF WebM MPEG2-TS WVM Packed Audio² H264 (AVC) I / O - I / O I - H265 (HEVC) I / O - I - - VP8 I / O I / O - - - VP9 I / O I / O - - - AV1 I / O I / O - - - AAC I / O - I / O I O MP3 O - I / O - O Dolby AC3 I / O - I / O - O Dolby EAC3 I / O - O - O MPEG-H Audio I / O - - - - Dolby AC4 I / O - - - - DTS I / O - - - - FLAC I / O - - - - Opus I / O³ I / O - - - Vorbis - I / O - - - IAMF I / O - - - - NOTES:
- I for input and O for output.
- ²: https://tools.ietf.org/html/draft-pantos-http-live-streaming-23#section-3.4
- ³: Opus support in ISO-BMFF is experimental.
-
Subtitles
Format Input Output Text WebVTT Y Y WebVTT in MP4 #405 Y Text TTML â´ Y TTML in MP4 - Y DVB-SUB Y - Teletext #272 - - â´: TTML input is only supported with TTML output (pass-through, DASH only), see also #584.
- Platforms
- Linux
- Mac
- Windows
- Cross compiling for ARM is also supported.
1: Limited support
Getting Shaka Packager
There are several ways you can get Shaka Packager.
- Using Docker. Instructions are available here.
- Get prebuilt binaries from release.
- Built from source, see Build Instructions for details.
Useful Links
- Announcement List (join for infrequent announcements and surveys)
- Subscribe to releases by following instructions from this blog
- Documentation
- Tutorials
- Several open source players:
Contributing
If you have improvements or fixes, we would love to have your contributions. See https://github.com/shaka-project/shaka-packager/blob/main/CONTRIBUTING.md for details.
Top Related Projects
JavaScript player library / DASH & HLS client / MSE-EME player
GPAC Ultramedia OSS for Video Streaming & Next-Gen Multimedia Transcoding, Packaging & Delivery
Full-featured MP4 format, MPEG DASH, HLS, CMAF SDK and tools
Mirror of https://git.ffmpeg.org/ffmpeg.git
A standalone library of the Fraunhofer FDK AAC code from Android.
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual Copilot