DashCast

Overview

DashCast is an application which allows users to:

  1. transcode a live/non-live stream in multiple qualities (eg. bitrate and resolution).
  2. segment it in small chunks and packetize them for delivery via Dynamic Adaptive Streaming over HTTP (DASH) standard.

Installation

DashCast is an application which is shipped with GPAC. It is compiled and installed by compiling and installing GPAC source code. DashCast is currently implemented for Linux distributions and Windows. It depends on the following libraries:

  • libavcodec for transcoding
  • libavdevice for acquisition from devices
  • libavformat for parsing and demultiplexing
  • libswscale for scaling

Since DashCast needs to encode videos using H.264. encoder, before compilation, make sure that libavcodec-extra-53 is installed.

To get dependencies:

Before executing this command, please note that you may need to compile FFmpeg with x264 support by yourself. This is due to the fact most Linux distributions use a FFmpeg fork called libav.

Get x264:

or build it yourself:

Compile ffmpeg:

Get the other dependencies from your package manager:

To get the code:

To compile:

Usage

-a inasrc:str : input audio source named inasrc.
If input is from microphone, inasrc will be “plughw:[x],[y]” where x is the card number and y is the device number.
-v invsrc:str : input video source named invsrc.
If input is from a webcam, invsrc will be “/dev/video[x]” where x is the video device number.
If input is the screen video, invsrc will be “:0.0+[x],[y]” which captures from upper-left at x,y.
If input is from stdin, invsrc will be “pipe:”
-av inavsrc:str : a multiplexed audio and video source named inavsrc.
If this option is present, non of ‘-a’ or ‘-v’ can be present.
-vf invfmt:str : invfmt is the input video format.
To capture from a webcam invfmt will be video4linux2
To capture the screen invfmt will be x11grab
-v4l2f inv4l2f:str : inv4l2f is the input format for webcam acquisition.
It can be mjpeg, yuyv422, etc.
-vfr invfr:int : invfr is the input video framerate.
-vres invres:intxint : input video resolution.
-af inafmt:str : inafmt is the input audio format
To capture from a microphone, inafmt will be alsa.
-conf confname:str : confname is the configuration file.
The default value is dashcast.conf .

-seg-dur dur:int : dur is the segment duration in millisecond.
The default value is 1000.
-frag-dur dur:int : dur is the fragment duration in millisecond.
The default value is 1000.
-live : system is live and input is a camera.
-live-media : system is live and input is a media file.
Absence of -live or -live media indicates that the system is on-demand.
-no-loop : system does not loop on the input media file
-seg-marker marker:str : add a marker box named marker at the end of DASH segment.
-gdr : use Gradual Decoder Refresh feature for video encoding.

-out outdir:str : outdir is the output data directory.
The default value is output .
-mpd mpdname:str : mpdname is the MPD file name.
The default value is dashcast.mpd .
-ast-offset dur:int : dur is the MPD availabilityStartTime shift in milliseconds.
The default value is 1000.
-time-shift dur:int : dur is the MPD TimeShiftBufferDepth in seconds.
The default value is 10. Specify -1 to keep all files.
-min-buffer dur:float : dur is the MPD minBufferTime in seconds.
The default value is 1.0.

-switch-source confname:str : confname is the name of configuration file for source switching.

Configuration files

A configuration file (-conf) must be provided so that DashCast transcodes the stream accordingly. Configuration file contains several entries. Each entry can be of either video or audio type. Here are the possible options in configuration file:

Another configuration file (-switch-source) is used for source switching.

Examples

Here are some examples of how to use DashCast:

  • To transcode a live video from webcam and a live audio from microphone and to segment them in 1000-millisecond segments.

Note:

  1. ls /dev/video* gives you a list of all video capture devices. Insert /dev/video# as your input video stream source.
  2. arecord -l gives you a list of all audio capture devices. Look for the card and device number you want to use. Insert plughw:card#,device# as your input audio stream source.
  • To transcode a multiplexed video and audio and segment them in 500-millisecond segments for a live session:

  • To transcode a multiplexed video and audio and segment them in 1000-millisecond segments and 200-millisecond fragments for an on-demand service:

  • To capture the screen video and transcode and segment in 1000-millisecond segments for a live service:

The following configuration file is used:

3 thoughts on “DashCast

Comments are closed.