Difference between revisions of "Using Mplayer With Video API"

From ElphelWiki
Jump to: navigation, search
 
Line 1: Line 1:
 
{{en|ru=Using_Mplayer_With_Video_API.Ru|cn=Using_Mplayer_With_Video_API.cn}}
 
{{en|ru=Using_Mplayer_With_Video_API.Ru|cn=Using_Mplayer_With_Video_API.cn}}
  
Video API allow to obtain the video stream by HTTP and RTP/UDP. In difference from the Axis cameras, the Elphel cameras can obtain the MJPG stream or Theora stream by the RTP protocol.
+
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.
  
 
==HTTP==
 
==HTTP==
It's example of command for MPJPG format stream obtaining from camera (Elphel, Axis etc):
+
Here is an example of a command for obtaining an MPJPG format stream from the camera (Elphel, Axis etc):
 
  <nowiki>$mplayer -fps 6 -demuxer lavf http://192.168.0.9/mjpg/video.mjpg</nowiki>
 
  <nowiki>$mplayer -fps 6 -demuxer lavf http://192.168.0.9/mjpg/video.mjpg</nowiki>
  
If you want to obtain the stream with the non-specify parameters, the small trick is necessary. In fact, the '''lavf''' obtain the stream as MPJPG when the file name or URL have extension ".mjpg" at the end. Therefore to URL it is necessary to add the fictitious parameter with extension ".mjpg", for example:
+
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:
 
  <nowiki>$mplayer -fps 6 -demuxer lavf http://192.168.0.9/axis-cgi/mjpg/video.cgi?resolution=1024x768&bogus.mjpg</nowiki>
 
  <nowiki>$mplayer -fps 6 -demuxer lavf http://192.168.0.9/axis-cgi/mjpg/video.cgi?resolution=1024x768&bogus.mjpg</nowiki>
  
Also MPlayer can play the files which is the recorded MJPG stream. For example, the stream was saved by this way:
+
MPlayer can also play files which are recorded from the MJPG stream. For example, if the stream was saved this way:
 
  <nowiki>$wget http://192.16.0.9/axis-cgi/mjpg/video.cgi?resolution=1024x768 -O video.mjpg</nowiki>
 
  <nowiki>$wget http://192.16.0.9/axis-cgi/mjpg/video.cgi?resolution=1024x768 -O video.mjpg</nowiki>
with fps value 6, you can play this file by the next way:
+
with fps value 6, you can play this file in the following way:
 
  <nowiki>$mplayer -fps 6 -demuxer lavf video.mjpg</nowiki>
 
  <nowiki>$mplayer -fps 6 -demuxer lavf video.mjpg</nowiki>
  
Line 18: Line 18:
 
===MJPG===
 
===MJPG===
 
====Multicast====
 
====Multicast====
In standard Axis Video API there is no possibility for obtaining multicast stream by RTSP. But there is possibility for SDP-file obtaining and obtain stream on the SDP base.
+
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 obtain the SDP-file from address:
+
You can receive the SDP-file from the address:
  
 
<nowiki>http://192.168.0.9/mjpg/media.sdp</nowiki>
 
<nowiki>http://192.168.0.9/mjpg/media.sdp</nowiki>
  
After that you can play stream:
+
After that you can play the stream:
  
 
  <nowiki>$mplayer sdp://media.sdp</nowiki>
 
  <nowiki>$mplayer sdp://media.sdp</nowiki>
  
or save into the file:
+
or save as a file:
 
  <nowiki>$mencoder -fps 2 sdp://media.sdp -ovc copy -o my.avi</nowiki>  
 
  <nowiki>$mencoder -fps 2 sdp://media.sdp -ovc copy -o my.avi</nowiki>  
  
Unfortunately, you must specify the fps for correctness of mencoder work, although in sdp-file this parameter is present.
+
Unfortunately, you must specify the fps for mencoder to work correctly, although this parameter is already present in the SDP file.
  
 
====Unicast====
 
====Unicast====
It is possible to address to camera's RTSP-server by using the RTSP-protocol and obtain the unicast video stream.
+
It is possible to address the camera's RTSP-server by using the RTSP-protocol and receive the unicast video stream.
  
 
===Theora===
 
===Theora===

Latest revision as of 08:04, 29 December 2005

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.

HTTP

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

$mplayer -fps 6 -demuxer lavf http://192.168.0.9/mjpg/video.mjpg

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 http://192.168.0.9/axis-cgi/mjpg/video.cgi?resolution=1024x768&bogus.mjpg

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

$wget http://192.16.0.9/axis-cgi/mjpg/video.cgi?resolution=1024x768 -O video.mjpg

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

$mplayer -fps 6 -demuxer lavf video.mjpg

RTP

MJPG

Multicast

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:

http://192.168.0.9/mjpg/media.sdp

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.

Unicast

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

Theora