Using Mplayer With Video API

From ElphelWiki
Jump to: navigation, search

in English | [[{{{de}}}|deutsch]] | [[{{{fr}}}|français]] | по-русски | автоперевод | 中文版 | 机械翻译

The Video API allows you to obtain the video stream by HTTP and RTP/UDP. In contrast to the Axis cameras, the Elphel cameras can receive the MJPG stream or Theora stream using the RTP protocol.


Here is an example of a command for obtaining an MPJPG format stream from the camera (Elphel, Axis etc):

$mplayer -fps 6 -demuxer lavf

If you want to obtain the stream with non-specific parameters, a small trick is necessary. In fact, the lavf receives the stream as MPJPG whenever the file name or URL has the extension ".mjpg" at the end. Therefore in the URL it is necessary to add a fictitious parameter with the extension ".mjpg", for example:

$mplayer -fps 6 -demuxer lavf

MPlayer can also play files which are recorded from the MJPG stream. For example, if the stream was saved this way:

$wget -O video.mjpg

with fps value 6, you can play this file in the following way:

$mplayer -fps 6 -demuxer lavf video.mjpg




In the standard Axis Video API there is no possibility to receive the multicast stream by RTSP. But there is the possibility to recieve the SDP-file and obtain the stream on the SDP base.

You can receive the SDP-file from the address:

After that you can play the stream:

$mplayer sdp://media.sdp

or save as a file:

$mencoder -fps 2 sdp://media.sdp -ovc copy -o my.avi 

Unfortunately, you must specify the fps for mencoder to work correctly, although this parameter is already present in the SDP file.


It is possible to address the camera's RTSP-server by using the RTSP-protocol and receive the unicast video stream.