Bruce Dawson wrote:
> Frank DiPrete wrote:
>> Bruce Dawson wrote:
>>   
>>> We've got several web cams that people like to visit
>>> (www.milessmithfarm.net). However, they're chewing up bandwidth when
>>> more than one person at a time views them.
>>>
>>> Is anyone aware of a Linux based video re-broadcaster (either software
>>> or a service)?
>>>
>>> We'd like to upload the video streams to a single server that multiple
>>> people can connect to and view them. This way, we're only sending one
>>> video stream up to the server, and the server can rebroadcast it to all
>>> the connected clients.
>>>
>>> --Bruce
>>>     
>> It sounds like the sources are live streams (web cams) and not files 
>> that can be uploaded to another server for download / viewing.
>>
>> A multi unicast scenario.
>>   
> ...
> 
> The above is correct.
> 
>> But we haven't solved the original problem yet.
>> Item 1) starts a stream from the webcam so you still pound your uplink 
>> for each request, but a little program logic may work here.
>>   
> 
> I think we sorta solved it. I only want one stream going out, and then
> the "repeater" (PHP) will repeat it to multiple clients.
>> I've done this sort of thing with php.
>> These code examples are for an flv source for a youtube re-creatiom 
>> problem I worked on recently, but you would just change the mime / file 
>> type.
>>
>> Your server could:
>>
>> 1) anchor the stream with php curl
>>
>> function proxy_stream($flv_url) {
>>
>>   $curl_handle=curl_init();
>>   curl_setopt($curl_handle, CURLOPT_URL, $flv_url );
>>   curl_setopt($curl_handle,CURLOPT_CONNECTTIMEOUT,3);
>>   curl_exec($curl_handle);
>>   curl_close($curl_handle);
>>
>> }
>>
>> 2) take that output to a pipe and shove it down the browser's throat
>> The important bit is the fpassthru function so as not to mangle the 
>> stream but just send it out again raw.
>>
>> function transmit_stream($flv_file) {
>>
>>   $pos = 0;
>>
>>   header("Content-Type: video/x-flv");
>>   header('Content-Length: ' . filesize($flv_file));
>>   $fh = fopen($flv_file,"rb");
>>   fseek($fh, $pos);
>>   fpassthru($fh);
>>   fclose($fh);
>>
>> }
>>
>> The trick now it to connect the ouput pipe from curl into the retransmit 
>>    function instead of operating on files. If a pipe from a webcam in 
>> proxy_stream() is already open, then don't call the curl function. In 
>> theory it would work (haven't tried it yet)
>>
>> Including a player frame on the server page is another added fun bit.
>> I used flowplayer and ffmpeg.
>>
>>   
> OK. Thanks. I'll play with those. I'll probably "pipe" the output from
> "proxy_stream" to shared memory so there will be only one connection.
> Then have transmit_stream copy from the shared memory to the client.
> This will avoid the problem of Apache/PHP creating a new proxy_stream
> for each connection.
> 
> However, I'm concerned about corrupting data streams to the client if a
> PHP process was unable to send out a shared memory segment.
> 
> --Bruce
> 
> 

Please let us/me know how you make out with this approach.
Very cool if it works.

_______________________________________________
gnhlug-discuss mailing list
gnhlug-discuss@mail.gnhlug.org
http://mail.gnhlug.org/mailman/listinfo/gnhlug-discuss/

Reply via email to