[gst-devel] Saving a live stream
arnout at mind.be
Wed Jan 28 16:25:43 CET 2009
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
> 2) When someone tries to edit the file to trim each end and make any
> other minor changes that are required, seeking takes forever and the
> editor takes for ever to do things that would normally be quite quick
> with a normal file. I believe that if the file has a play time of about
> 40 mins, then the player says that it will take about 40 mins to do many
> 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?
It may pay off to take a look at gentrans: http://gentrans.sourceforge.net/
Arnout Vandecappelle arnout at mind be
Senior Embedded Software Architect +32-16-286540
G.Geenslaan 9, 3001 Leuven, Belgium BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint: D206 D44B 5155 DF98 550D 3F2A 2213 88AA A1C7 C933
More information about the gstreamer-devel