[gst-devel] Saving a live stream

Hayden Andrews hayden at heydan.co.uk
Fri Jan 30 11:02:07 CET 2009


Arnout Vandecappelle wrote:
> On Saturday 24 January 2009 09:58:42 Hayden Andrews wrote:
>   
>> First of all, I wrote a quick Perl script which reads directly from the
>> appropriate HTTP port (an Icecast Server) and writes to a file.
>> Everything looks fine with this file except ..
>>   1) Suppose we record from 40 mins to 1:20 of the live stream. When we
>> play the file, the current time starts at the time we started recording
>> from rather than from 00:00. Although the run time is correct (40 mins),
>> the current time progresses from 40mins to 1:20.
>>     
>
>  That's because the buffer timestamps are retained.  You have to re-stamp the 
> buffers.  I ended up writing an element to do exactly that: 
> http://bugzilla.gnome.org/show_bug.cgi?id=561224 - that bugzilla entry also 
> contains a remark on how it should be done by setting base_time, but I don't 
> think that will work.  As discussed earlier on the list (see 
> http://thread.gmane.org/gmane.comp.video.gstreamer.devel/22806 ), you can 
> also try an identity with single-segment=true, although I also doubt that 
> will work :-).
>
>  In any case, you'll need to do demuxing and remuxing to get the timestamps in 
> your output file.  So your pipeline will look like this:
>
> filesrc location=... ! oggdemux ! identity single-segment=true \
>   ! oggmux ! filesink location=...
>
>
>  Of course, you'll encounter additional problems with audio: you'll need to 
> split the pipeline and add queue's, and I'm pretty sure something will go 
> wrong with the synchronisation between the timestamps of the audio and video 
> channel.
>   
I'm going to try the 'identity' idea as your element is not yet in the 
build of GStreamer that is on the production machine.
I'm not filled with confidence when you suggest that something else is 
bound to go wrong! Is this not a fairly standard scenario? We are just 
trying to save portion of a live stream to a file that can then be 
edited easily, and played with reasonable timings. Anyway, I will try 
the new script with an identity element for each of the audio/video streams.

>> I figure that since a live stream has an unknown length, and since it is
>> not possible to seek when viewing a live stream, that there is missing
>> info in the live stream that needs to be inserted while saving. So, I
>> also figure that it would be easy to insert the relevant requirements
>> while saving a live stream to file.....
>>     
>  Indeed, the output file doesn't contain an index, which means the editor 
> needs to scan the entire file in order to seek correctly.  The index is only 
> written when the muxer receives an EOS event.  Unfortunately, as far as I 
> know, there is no way to force an EOS on a stream started with gst-launch.  
> How do you select the part you want using GStreamer anyway?
>   
I'm using the CPAN GStreamer module, not gst-launch. We are currently 
kicking off the script via a web page. So, the person, who is 
videoing/streaming the event, at the require time, hits 'record stream' 
on a web page which kicks off the Perl script. When they want to stop 
recording, they press 'Stop Recording' which sends a signal to the Perl 
Script. When the script receives the signal, it calls quit() on the 
Glib::MainLoop object. I guess that I should be sending this EOS to the 
pipe before calling quit() ??? How do I go about doing that?

Thanks heaps for your help, so far, Arnout.

Hayden
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20090130/27451adb/attachment.htm>


More information about the gstreamer-devel mailing list