Arija Live Transcoder



About Livetranscoder



Live transcoder is a Linux utility that can download, transcode, and stream audio and video simultaneusly.


Software requirements

  • Linux with a 2.4 or later kernel.
  • The 2.6 kernel should have the correct V4L2 interface.
  • Drivers for sound and video devices


Other Libraries required
  • libamrnb
  • libamrwb
  • libogg
  • libvorbis
  • lame


Using LiveTranscoder

LiveTranscoder needs command line options. It needs the filepath which has to be downloaded, transcoded and streamed. The port number on which it has to be streamed and bit rate at which the streaming should be done. Multiple sessions of LiveTranscoders can be run simultaneously. Port number given as option is used for video streaming and the two next to that port number is used for audio streaming and then two next to that is used for text streaming. So for the next session port number should be differered by atleast 8.

Usage:

./LiveTranscoder <filepath> <port number> <bit rate>


1. Scope:

Live transcoder is a Linux based product that can download, transcode, and stream audio and video simultaneously. This document captures design of system and sub-components of the system and flow of the system. Ffmpeg, mp4live forms the key components of the system. The bridge between these components and enhancing and moulding of mp4live and ffmpeg to our requirements is key design.

2. Introduction:

Live transcoder is a Linux utility that can download, transcode, and stream audio and video simultaneusly.


3. Overview:

LiveTranscoder downloads the requested file and transcodes and streams.
  • ffmpeg+mp4live forms the RTPTransmitter(broadcaster)
  • DSS forms RTSP server
  • User makes a request to DSS, DSS responds by initiating the LiveTranscoder with required arguments.
    ( these needs to be done by System deployer).
  • LiveTranscoder starts d+t+rtp transmission
  • DSS receives the RTP packets
  • DSS services RTSP request based on RTP packets it received from LiveTranscoder.
  • LiveTranscoder and DSS forms the complete solution.
  • The deployer should install DSS, and LiveTranscoder.


4. LiveTranscoder:





4.1.1. Main Process:

LiveTranscoder is an executable file which has to be run using command line options for filepath,
port number and other optional parameters like bitrate, frame rate etc.
It is a wrapper over ffmpeg and mp4live.



4.1.2. Child process/tasks:

LiveTranscoder starts ffmpeg and mp4live in two separate threads with necessary configurations.
Both ffmpeg and mp4live share two queues, one for audio packets and one for video packets.



Ffmpeg

Ffmpeg starts with the options provided by the LiveTranscoder. It demuxes the input file into audio and video and decodes them. It initializes audio and video queues and puts the decoded audio and video packets into the audio queue and video queue respectively. If the queues are full , it will wait to get unfull

MP4live

Mp4live also starts simultaneuosly. It waits on a conditional message from ffmpeg which is sent once ffmpeg initializes the audio and video queues. Then mp4live resumes and the audio and video sources of mp4live reads the raw audio and video packets from the queues generated by ffmpeg. The raw audio and video samples are encoded into amr and h263 format respectively by audio and video encoders. The encoded packets of audio and video and transmitted by audio and video rtp transmitters respectively to a streaming server. When client requests the streaming server, the streaming server streams the both audio and video streams.

4.2. Data Structures

Both ffmpeg and mp4live share two queues. One for audio packets and other for video packets. Each queue is an array of structures. The structure has several fields. Packet type, data, packet size.

Testing



Server side Setup

DSS should be started before running LiveTranscoder.
cd /usr/local/sbin
perl streamingadminserver.pl

Go to /root/LiveTranscoder-1.0/sbin
cd /root/liveTranscoder-1.0/sbin
Run the LiveTranscoder with inputs filepath, portnumber and bit rate
./LiveTranscoder <filepatht> <port number> <bit rate>

Client Side setup
Type the link in the browser.
rtsp://<Server ip>/<portnumber>.sdp

Run the LiveTranscoder with inputs filepath, portnumber and other optional inputs like bitrate, framerate, frame size etc.
Frame size should be given in terms of cif, qcif,sqcif etc. '-da' is for disabling audio and '-dv' is for disabling video.
./LiveTranscoder <-f filepath> <-p port number> [-b bitrate] [-r framerate] [-s framesize] [-da] [-dv]
Filepath can be a local filepath or it can be an online file path or it can be a video stream.
For example the three test cases can be like the below.
  • ./LiveTranscoder -f /root/video2.flv -p 20580 -s qcif

  • ./LiveTranscoder -f http://ll.media.abc.com/video/icf/ABCDS_20070919_StartNow_DailyShow_HD
    _1406547_16x9.flv -p 21822 -b 200

  • ./LiveTranscoder -f http://youtube.com/get_video?video_id=nvfC6TBV9TA&l=38&sk=0RV_eIy4A8Q8A
    HBgsPTcjwC&t=OEgsToPDskJx0YTNrK8CjCVg-QopSmG9 -p 21290 -r 25 -da