<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Word 14 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
{font-family:Wingdings;
panose-1:5 0 0 0 0 0 0 0 0 0;}
@font-face
{font-family:Wingdings;
panose-1:5 0 0 0 0 0 0 0 0 0;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri","sans-serif";}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:purple;
text-decoration:underline;}
span.EmailStyle17
{mso-style-type:personal-compose;
font-family:"Calibri","sans-serif";
color:windowtext;}
.MsoChpDefault
{mso-style-type:export-only;
font-size:10.0pt;
font-family:"Calibri","sans-serif";}
@page WordSection1
{size:8.5in 11.0in;
margin:70.85pt 70.85pt 70.85pt 70.85pt;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-US" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal">Hi,<o:p></o:p></p>
<p class="MsoNormal">I’m trying to get a minimal example for using a named pipe as a source of a stream for the LIVE555TM Media Server.<o:p></o:p></p>
<p class="MsoNormal">As a proof of concept, I would like to get a working example of making a stream from a sample.264 file into a named pipe and use the named pipe with a .264 extension to have Media Server stream it.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Working example (video plays in vlc)<o:p></o:p></p>
<p class="MsoNormal">Files:<o:p></o:p></p>
<p class="MsoNormal">rawh264_sample #The original slamtv60.264 just renamed<o:p></o:p></p>
<p class="MsoNormal">periodic_read.py #A dummy application that creates a binary stream from the rawh264_sample <o:p></o:p></p>
<p class="MsoNormal">stream.264 #The named pipe, created with “mkfifo stream.264”<o:p></o:p></p>
<p class="MsoNormal">live555MediaServer #The server binary from mediaServer<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Steps:<o:p></o:p></p>
<p class="MsoNormal">./live555MediaServer<o:p></o:p></p>
<p class="MsoNormal">Run vlc -> Ctrl+n (Open Network stream) -> rtsp://xx.xx.xx.xx:8554/stream.264<o:p></o:p></p>
<p class="MsoNormal">cat rawh264_sample >> stream.264<o:p></o:p></p>
<p class="MsoNormal">cat rawh264_sample >> stream.264 #It had to be called twice
<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">---------------------------------------------------------------------------------------------------------------------------------<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">The idea is to make a simple streamer that just chops the raw video file and periodically sends chops.<o:p></o:p></p>
<p class="MsoNormal">The code the dummy streamer (periodic_read.py) is below everything.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Example I didn’t get to work (The video starts loading in vlc but breaks)<o:p></o:p></p>
<p class="MsoNormal">Files:<o:p></o:p></p>
<p class="MsoNormal">rawh264_sample #The original slamtv60.264 just renamed<o:p></o:p></p>
<p class="MsoNormal">periodic_read.py #A dummy streamer that creates a binary stream from the rawh264_sample <o:p></o:p></p>
<p class="MsoNormal">stream.264 #The named pipe, created with “mkfifo stream.264”<o:p></o:p></p>
<p class="MsoNormal">live555MediaServer #The server binary from mediaServer<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Steps:<br>
./periodic_read.py > stream.264 #Move the raw file to the pipe<o:p></o:p></p>
<p class="MsoNormal">./live555MediaServer
<o:p></o:p></p>
<p class="MsoNormal">Run vlc to get the stream<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">What happens is that the vlc shows that the buffer is loading, but breaks after half. The video never starts to play.<br>
I get an error on the streamer side:<br>
Traceback (most recent call last):<o:p></o:p></p>
<p class="MsoNormal"> File "./periodic_read.py", line 14, in <module><o:p></o:p></p>
<p class="MsoNormal"> print chunk<o:p></o:p></p>
<p class="MsoNormal">IOError: [Errno 32] Broken pipe<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Is it possible that the problem is in the sync between the streamers write speed and mediaServers read speed?<o:p></o:p></p>
<p class="MsoNormal">Other comments are welcome <span style="font-family:Wingdings">
J</span><br>
<br>
<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">------------------------------------------------------------------<o:p></o:p></p>
<p class="MsoNormal"># periodic_read.py <o:p></o:p></p>
<p class="MsoNormal">#!/usr/bin/python<o:p></o:p></p>
<p class="MsoNormal">import time<o:p></o:p></p>
<p class="MsoNormal">import sys<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">file_path = "rawh264_sample"<o:p></o:p></p>
<p class="MsoNormal">chunk_size = 1000<o:p></o:p></p>
<p class="MsoNormal">frequency = 200<o:p></o:p></p>
<p class="MsoNormal">f = open(file_path, "rb")<o:p></o:p></p>
<p class="MsoNormal">while True:<o:p></o:p></p>
<p class="MsoNormal"> chunk=f.read(chunk_size)<o:p></o:p></p>
<p class="MsoNormal"> print chunk<o:p></o:p></p>
<p class="MsoNormal"> time.sleep(1/frequency)<o:p></o:p></p>
<p class="MsoNormal">if chunk == '' :<o:p></o:p></p>
<p class="MsoNormal"> break<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">------------------------------------------------------------------<o:p></o:p></p>
<p class="MsoNormal">
<o:p></o:p></p>
</div>
<br clear="both">
DISCLAIMER:<BR>
This e-mail may contain confidential and privileged material for the sole use of the intended recipient. Any review, use, distribution or disclosure by others is strictly prohibited. If you are not the intended recipient (or authorized to receive for the recipient), please contact the sender by reply e-mail and delete all copies of this message.<BR>
</body>
</html>