Skip to content

Complete bash script for generating DASH and HLS with FFMPEG, Shaka Packager and Shaka Player

Notifications You must be signed in to change notification settings

leodanisbi/streaming

Repository files navigation

Streaming

Complete bash script for generating DASH and HLS with FFMPEG, Shaka Packager and Shaka Player

Single file MP4 output with dash_only and hls_only options:

First clone this repository and grant execute permissions to the file encoder-single-file-mp4.sh and packager

> git clone https://github.com/leodanisbi/streaming.git
> cd streaming
> chmod +x encoder-single-file-mp4.sh
> chmod +x packager
  • The file encoder-single-file-mp4.sh must be executed passing as parameter the name of the video found in the videos folder.
> ./encoder-single-file-mp4.sh SampleVideo_1280x720_1mb.mp4
  • We need to install ffmpeg or use Static Builds from official ffmpeg page ffmpeg.
> apt install ffmpeg
  • The file encoder-single-file-mp4.sh encode the video input with ffmpeg to 6 qualities and extract all audios and subtitles stream automaticly, then with shaka-packager generate a VOD for DASH and HLS in the ouput folder.

  • In this example the shaka-packager binary is used which can be downloaded from the official repository shaka-packager-releases, below there is more information about other ways to use shaka-packager.

  • HLS and DASH outputs are located in the output folder as master.m3u8 for HLS and manifest.mpd for DASH

Shaka Player with Youtube theme:

  • Finally we can see the output of the shaka player, we need a web server to load the output of shaka packager.

  • The latest version of shaka player is included in this repository, but it can be used from any CDN like CDN.

  • Inside the shaka-player folder edit the youtube-script.js file the variable youtube_theme_manifestUri with the url of the manifest.mpd or master.m3u8.

  • A youtube theme was used from the repository https://github.com/lucksy/shaka-player-themes but you can use any other theme.

  • This is a simple example of shaka player, if you want to see some more advanced settings you can visit Shaka-Player-Demo-Docs.

FFmpeg

FFmpeg is a collection of libraries and tools to process multimedia content such as audio, video, subtitles and related metadata.

Official project

https://github.com/FFmpeg/FFmpeg

Shaka Packager

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.

There are several ways you can get Shaka Packager.

Official project

https://github.com/shaka-project/shaka-packager

Shaka Player

Shaka Player is an open-source JavaScript library for adaptive media. It plays adaptive media formats (such as DASH and HLS) in a browser, without using plugins or Flash. Instead, Shaka Player uses the open web standards MediaSource Extensions and Encrypted Media Extensions.

Official project

https://github.com/shaka-project/shaka-player

Shaka Player Themes

Themes for Shaka player.

Official project

https://github.com/lucksy/shaka-player-themes

About

Complete bash script for generating DASH and HLS with FFMPEG, Shaka Packager and Shaka Player

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published