Hi,<div><br></div><div>First of all, I am not sure that you could do this process in this place of the pipeline where you are trying to, because you don't control there when a Intra frame comes, so the files could not be correctly visualized later.</div>
<div><br></div><div>Maybe this solution, based on ffmpeg, could fix your problem:</div><div><a href="http://ffmpeg.org/ffmpeg.html#segment">http://ffmpeg.org/ffmpeg.html#segment</a></div><div><br></div><div>You can find a more contextualized explanation here:</div>
<div><a href="http://forums.creativecow.net/thread/291/616">http://forums.creativecow.net/thread/291/616</a></div><div><br></div><div>Best,</div><div><br></div><div>Angel<br><br><div class="gmail_quote">2012/2/2 Jan Spurny <span dir="ltr"><<a href="mailto:JSpurny@seznam.cz">JSpurny@seznam.cz</a>></span><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<br>
<br>
thanks for reply, at first I thought that multifilesink was only useful for dumping single frames, but than I found out it allows file splitting not only on buffer boundary, but also on discontinuity (?? I don't really know what that means) or key-frame.<br>
Using key-frame as a boundary seems to work, but only with mpeg ts streams, but I was only able to split incoming stream. When I tried some re-encoding the pipeline has failed.<br>
So it's a good start, but this way I have no control over the size of resulting files and also I'm stuck with original stream format.<br>
<br>
For example, this "works" (vid.avi containst h264 stream):<br>
<br>
gst-launch filesrc location=vid.avi \<br>
! avidemux \<br>
! mpegtsmux \<br>
! multifilesink next-file=key-frame location=file-%03d.mpg<br>
<br>
and resulting mpeg files are playable, but as I said, I'll have many different inputs and I need to re-encode the stream to some default format, so when I tried this to get 30s fragments with h264:<br>
<br>
gst-launch filesrc location=vid.avi \<br>
! decodebin \<br>
! x264enc \<br>
! mp4mux fragment-duration=30000 \<br>
! multifilesink next-file=key-frame location=file-%03d.mp4<br>
<br>
then I got first mp4 file which looks fine and I can play it, but the others are somehow invalid and I can't play them.<br>
<br>
It seems to me that while mp4mux and multifilesink works fine together, some crucial mp4 header is lost for all but the first file.<br>
<br>
Also the first playable file segment has length of 10 seconds regardless of the specified "fragment-duration", so I probably got this one wrong..<br>
And to make things even stranger, without "fragment-duration" option, even the first file is not playable..<br>
<br>
Anyway, it seems that I'm at least moving in the right direction..<br>
<font color="#888888"><br>
<br>
Jan Spurny<br>
</font><div><div></div><div class="h5"><br>
On Thu, 02 Feb 2012 09:43:44 +0100 (CET)<br>
Garbriel Neumüller <<a href="mailto:horsthuchen@googlemail.com">horsthuchen@googlemail.com</a>> wrote:<br>
<br>
> Hi,<br>
> do you know the Multifilesink plugin?<br>
> I think it would do exactly what you expect .<br>
> I never used it by my own but it sounds quite well.<br>
><br>
><br>
><br>
> -----Ursprüngliche Nachricht-----<br>
> Von:<br>
> gstreamer-devel-bounces+horsthuchen=<a href="mailto:googlemail.com@lists.freedesktop.org">googlemail.com@lists.freedesktop.org</a><br>
> [mailto:<a href="mailto:gstreamer-devel-bounces%2Bhorsthuchen">gstreamer-devel-bounces+horsthuchen</a>=googlemail.com@lists.freedesktop<br>
> .org] Im Auftrag von Jan Spurny<br>
> Gesendet: Mittwoch, 1. Februar 2012 12:01<br>
> An: <a href="mailto:gstreamer-devel@lists.freedesktop.org">gstreamer-devel@lists.freedesktop.org</a><br>
> Betreff: storing one video stream into multiple files<br>
><br>
> Hi,<br>
><br>
> I'm trying to store video from one video stream into multiple files with<br>
> given duration.<br>
> Something which could look like this:<br>
><br>
> gst-launch souphttpsrc location=<a href="http://1.2.3.4/video1" target="_blank">http://1.2.3.4/video1</a> ! decodebin ! x264enc<br>
> ! SOMETHING filename="file_%D_%T.mp4" duration=2m<br>
><br>
> and it would produce files like these:<br>
><br>
> file_2012-02-01_10-12-43.mp4<br>
> file_2012-02-01_10-14-43.mp4<br>
> file_2012-02-01_10-16-43.mp4<br>
> ..<br>
><br>
> I don't expect that element "SOMETHING" already exists so I'll have to write<br>
> it myself. I have written a few simple gstreamer elements (mostly some kind<br>
> of raw-video transformations) so I'm quite confident I'll be able to do it,<br>
> but I do need all advices and guidelines I can get.<br>
><br>
> I'll have many different inputs - different input sources (files, http<br>
> streams, rtsp streams, v4l, ..) and also different input formats (mjpeg,<br>
> mpeg4, h264, raw-yuv). But that's ok, gstreamer can handle these without<br>
> problems.<br>
><br>
> Now I can either just simply reuse the stream and just "cut it into chunks<br>
> of desired length", but as there are so many different formats to work<br>
> with..<br>
> Or I'll just recode video into some default format. That's why I have a<br>
> "decodebin ! x264enc" in my pipeline above. I may support more formats in<br>
> the future but for the first version one is enough.<br>
><br>
> So with one known format (let's say h264) I'll have to "pack it" (muxer)<br>
> into small chunks and write them down to disk.<br>
><br>
> This is the part where I don't really know where to start - I guess studying<br>
> some existing muxer and would be a good start, but I'm really scared of all<br>
> the complexity with encoded video streams, B-frames, I-frames, and all<br>
> this..<br>
><br>
><br>
> Thanks in advance for any help, advices or suggestions.<br>
><br>
> Jan Spurny<br>
> _______________________________________________<br>
> gstreamer-devel mailing list<br>
> <a href="mailto:gstreamer-devel@lists.freedesktop.org">gstreamer-devel@lists.freedesktop.org</a><br>
> <a href="http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel" target="_blank">http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel</a><br>
><br>
> _______________________________________________<br>
> gstreamer-devel mailing list<br>
> <a href="mailto:gstreamer-devel@lists.freedesktop.org">gstreamer-devel@lists.freedesktop.org</a><br>
> <a href="http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel" target="_blank">http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel</a><br>
_______________________________________________<br>
gstreamer-devel mailing list<br>
<a href="mailto:gstreamer-devel@lists.freedesktop.org">gstreamer-devel@lists.freedesktop.org</a><br>
<a href="http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel" target="_blank">http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel</a><br>
</div></div></blockquote></div><br>
</div>