<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Arnout Vandecappelle wrote:
<blockquote cite="mid:200901281625.43599.arnout@mind.be" type="cite">
  <pre wrap="">
On Saturday 24 January 2009 09:58:42 Hayden Andrews wrote:
  </pre>
  <blockquote type="cite">
    <pre wrap="">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.
    </pre>
  </blockquote>
  <pre wrap=""><!---->
 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: 
<a class="moz-txt-link-freetext" href="http://bugzilla.gnome.org/show_bug.cgi?id=561224">http://bugzilla.gnome.org/show_bug.cgi?id=561224</a> - 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 
<a class="moz-txt-link-freetext" href="http://thread.gmane.org/gmane.comp.video.gstreamer.devel/22806">http://thread.gmane.org/gmane.comp.video.gstreamer.devel/22806</a> ), 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.
  </pre>
</blockquote>
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.<br>
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.<br>
<br>
<blockquote cite="mid:200901281625.43599.arnout@mind.be" type="cite">
  <blockquote type="cite">
    <pre wrap="">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.....
    </pre>
  </blockquote>
  <pre wrap=""><!----> 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?
  </pre>
</blockquote>
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?<br>
<br>
Thanks heaps for your help, so far, Arnout.<br>
<br>
Hayden<br>
</body>
</html>