Hi,
I'm trying to store video from one video stream into multiple files with given duration. Something which could look like this: gst-launch souphttpsrc location=http://1.2.3.4/video1 ! decodebin ! x264enc ! SOMETHING filename="file_%D_%T.mp4" duration=2m and it would produce files like these: file_2012-02-01_10-12-43.mp4 file_2012-02-01_10-14-43.mp4 file_2012-02-01_10-16-43.mp4 .. I don't expect that element "SOMETHING" already exists so I'll have to write it myself. I have written a few simple gstreamer elements (mostly some kind of raw-video transformations) so I'm quite confident I'll be able to do it, but I do need all advices and guidelines I can get. I'll have many different inputs - different input sources (files, http streams, rtsp streams, v4l, ..) and also different input formats (mjpeg, mpeg4, h264, raw-yuv). But that's ok, gstreamer can handle these without problems. Now I can either just simply reuse the stream and just "cut it into chunks of desired length", but as there are so many different formats to work with.. Or I'll just recode video into some default format. That's why I have a "decodebin ! x264enc" in my pipeline above. I may support more formats in the future but for the first version one is enough. So with one known format (let's say h264) I'll have to "pack it" (muxer) into small chunks and write them down to disk. This is the part where I don't really know where to start - I guess studying some existing muxer and would be a good start, but I'm really scared of all the complexity with encoded video streams, B-frames, I-frames, and all this.. Thanks in advance for any help, advices or suggestions. Jan Spurny _______________________________________________ gstreamer-devel mailing list [hidden email] http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel |
Hi,
do you know the Multifilesink plugin? I think it would do exactly what you expect . I never used it by my own but it sounds quite well. -----Ursprüngliche Nachricht----- Von: gstreamer-devel-bounces+horsthuchen=[hidden email] [mailto:gstreamer-devel-bounces+horsthuchen=[hidden email] .org] Im Auftrag von Jan Spurny Gesendet: Mittwoch, 1. Februar 2012 12:01 An: [hidden email] Betreff: storing one video stream into multiple files Hi, I'm trying to store video from one video stream into multiple files with given duration. Something which could look like this: gst-launch souphttpsrc location=http://1.2.3.4/video1 ! decodebin ! x264enc ! SOMETHING filename="file_%D_%T.mp4" duration=2m and it would produce files like these: file_2012-02-01_10-12-43.mp4 file_2012-02-01_10-14-43.mp4 file_2012-02-01_10-16-43.mp4 .. I don't expect that element "SOMETHING" already exists so I'll have to write it myself. I have written a few simple gstreamer elements (mostly some kind of raw-video transformations) so I'm quite confident I'll be able to do it, but I do need all advices and guidelines I can get. I'll have many different inputs - different input sources (files, http streams, rtsp streams, v4l, ..) and also different input formats (mjpeg, mpeg4, h264, raw-yuv). But that's ok, gstreamer can handle these without problems. Now I can either just simply reuse the stream and just "cut it into chunks of desired length", but as there are so many different formats to work with.. Or I'll just recode video into some default format. That's why I have a "decodebin ! x264enc" in my pipeline above. I may support more formats in the future but for the first version one is enough. So with one known format (let's say h264) I'll have to "pack it" (muxer) into small chunks and write them down to disk. This is the part where I don't really know where to start - I guess studying some existing muxer and would be a good start, but I'm really scared of all the complexity with encoded video streams, B-frames, I-frames, and all this.. Thanks in advance for any help, advices or suggestions. Jan Spurny _______________________________________________ gstreamer-devel mailing list [hidden email] http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel _______________________________________________ gstreamer-devel mailing list [hidden email] http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel |
Hi,
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. 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. 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. For example, this "works" (vid.avi containst h264 stream): gst-launch filesrc location=vid.avi \ ! avidemux \ ! mpegtsmux \ ! multifilesink next-file=key-frame location=file-%03d.mpg 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: gst-launch filesrc location=vid.avi \ ! decodebin \ ! x264enc \ ! mp4mux fragment-duration=30000 \ ! multifilesink next-file=key-frame location=file-%03d.mp4 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. It seems to me that while mp4mux and multifilesink works fine together, some crucial mp4 header is lost for all but the first file. Also the first playable file segment has length of 10 seconds regardless of the specified "fragment-duration", so I probably got this one wrong.. And to make things even stranger, without "fragment-duration" option, even the first file is not playable.. Anyway, it seems that I'm at least moving in the right direction.. Jan Spurny On Thu, 02 Feb 2012 09:43:44 +0100 (CET) Garbriel Neumüller <[hidden email]> wrote: > Hi, > do you know the Multifilesink plugin? > I think it would do exactly what you expect . > I never used it by my own but it sounds quite well. > > > > -----Ursprüngliche Nachricht----- > Von: > gstreamer-devel-bounces+horsthuchen=[hidden email] > [mailto:gstreamer-devel-bounces+horsthuchen=[hidden email] > .org] Im Auftrag von Jan Spurny > Gesendet: Mittwoch, 1. Februar 2012 12:01 > An: [hidden email] > Betreff: storing one video stream into multiple files > > Hi, > > I'm trying to store video from one video stream into multiple files with > given duration. > Something which could look like this: > > gst-launch souphttpsrc location=http://1.2.3.4/video1 ! decodebin ! x264enc > ! SOMETHING filename="file_%D_%T.mp4" duration=2m > > and it would produce files like these: > > file_2012-02-01_10-12-43.mp4 > file_2012-02-01_10-14-43.mp4 > file_2012-02-01_10-16-43.mp4 > .. > > I don't expect that element "SOMETHING" already exists so I'll have to write > it myself. I have written a few simple gstreamer elements (mostly some kind > of raw-video transformations) so I'm quite confident I'll be able to do it, > but I do need all advices and guidelines I can get. > > I'll have many different inputs - different input sources (files, http > streams, rtsp streams, v4l, ..) and also different input formats (mjpeg, > mpeg4, h264, raw-yuv). But that's ok, gstreamer can handle these without > problems. > > Now I can either just simply reuse the stream and just "cut it into chunks > of desired length", but as there are so many different formats to work > with.. > Or I'll just recode video into some default format. That's why I have a > "decodebin ! x264enc" in my pipeline above. I may support more formats in > the future but for the first version one is enough. > > So with one known format (let's say h264) I'll have to "pack it" (muxer) > into small chunks and write them down to disk. > > This is the part where I don't really know where to start - I guess studying > some existing muxer and would be a good start, but I'm really scared of all > the complexity with encoded video streams, B-frames, I-frames, and all > this.. > > > Thanks in advance for any help, advices or suggestions. > > Jan Spurny > _______________________________________________ > gstreamer-devel mailing list > [hidden email] > http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel > > _______________________________________________ > gstreamer-devel mailing list > [hidden email] > http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel gstreamer-devel mailing list [hidden email] http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel |
Hi,
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.
Maybe this solution, based on ffmpeg, could fix your problem: You can find a more contextualized explanation here:
Best, Angel
2012/2/2 Jan Spurny <[hidden email]> Hi, _______________________________________________ gstreamer-devel mailing list [hidden email] http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel |
Hi,
thanks for reply, this is definitely working, but I need solution within gstreamer pipeline. So I just have to look into ffmpeg sources and then replicate this functionality in my new element.. Jan Spurny On Thu, 02 Feb 2012 16:31:13 +0100 (CET) Angel Martin <[hidden email]> wrote: > Hi, > > 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. > > Maybe this solution, based on ffmpeg, could fix your problem: > http://ffmpeg.org/ffmpeg.html#segment > > You can find a more contextualized explanation here: > http://forums.creativecow.net/thread/291/616 > > Best, > > Angel > > 2012/2/2 Jan Spurny <[hidden email]> > > > Hi, > > > > 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. > > 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. > > 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. > > > > For example, this "works" (vid.avi containst h264 stream): > > > > gst-launch filesrc location=vid.avi \ > > ! avidemux \ > > ! mpegtsmux \ > > ! multifilesink next-file=key-frame location=file-%03d.mpg > > > > 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: > > > > gst-launch filesrc location=vid.avi \ > > ! decodebin \ > > ! x264enc \ > > ! mp4mux fragment-duration=30000 \ > > ! multifilesink next-file=key-frame location=file-%03d.mp4 > > > > 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. > > > > It seems to me that while mp4mux and multifilesink works fine together, > > some crucial mp4 header is lost for all but the first file. > > > > Also the first playable file segment has length of 10 seconds regardless > > of the specified "fragment-duration", so I probably got this one wrong.. > > And to make things even stranger, without "fragment-duration" option, even > > the first file is not playable.. > > > > Anyway, it seems that I'm at least moving in the right direction.. > > > > > > Jan Spurny > > > > On Thu, 02 Feb 2012 09:43:44 +0100 (CET) > > Garbriel Neumüller <[hidden email]> wrote: > > > > > Hi, > > > do you know the Multifilesink plugin? > > > I think it would do exactly what you expect . > > > I never used it by my own but it sounds quite well. > > > > > > > > > > > > -----Ursprüngliche Nachricht----- > > > Von: > > > gstreamer-devel-bounces+horsthuchen=[hidden email] > > > [mailto:gstreamer-devel-bounces+horsthuchen > > =[hidden email] > > > .org] Im Auftrag von Jan Spurny > > > Gesendet: Mittwoch, 1. Februar 2012 12:01 > > > An: [hidden email] > > > Betreff: storing one video stream into multiple files > > > > > > Hi, > > > > > > I'm trying to store video from one video stream into multiple files with > > > given duration. > > > Something which could look like this: > > > > > > gst-launch souphttpsrc location=http://1.2.3.4/video1 ! decodebin ! > > x264enc > > > ! SOMETHING filename="file_%D_%T.mp4" duration=2m > > > > > > and it would produce files like these: > > > > > > file_2012-02-01_10-12-43.mp4 > > > file_2012-02-01_10-14-43.mp4 > > > file_2012-02-01_10-16-43.mp4 > > > .. > > > > > > I don't expect that element "SOMETHING" already exists so I'll have to > > write > > > it myself. I have written a few simple gstreamer elements (mostly some > > kind > > > of raw-video transformations) so I'm quite confident I'll be able to do > > it, > > > but I do need all advices and guidelines I can get. > > > > > > I'll have many different inputs - different input sources (files, http > > > streams, rtsp streams, v4l, ..) and also different input formats (mjpeg, > > > mpeg4, h264, raw-yuv). But that's ok, gstreamer can handle these without > > > problems. > > > > > > Now I can either just simply reuse the stream and just "cut it into > > chunks > > > of desired length", but as there are so many different formats to work > > > with.. > > > Or I'll just recode video into some default format. That's why I have a > > > "decodebin ! x264enc" in my pipeline above. I may support more formats in > > > the future but for the first version one is enough. > > > > > > So with one known format (let's say h264) I'll have to "pack it" (muxer) > > > into small chunks and write them down to disk. > > > > > > This is the part where I don't really know where to start - I guess > > studying > > > some existing muxer and would be a good start, but I'm really scared of > > all > > > the complexity with encoded video streams, B-frames, I-frames, and all > > > this.. > > > > > > > > > Thanks in advance for any help, advices or suggestions. > > > > > > Jan Spurny > > > _______________________________________________ > > > gstreamer-devel mailing list > > > [hidden email] > > > http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel > > > > > > _______________________________________________ > > > gstreamer-devel mailing list > > > [hidden email] > > > http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel > > _______________________________________________ > > gstreamer-devel mailing list > > [hidden email] > > http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel > > gstreamer-devel mailing list [hidden email] http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel |
Hi,
Do you really need mp4 container? I don't believe multifilesink will work with mp4mux out of the box. Transport stream is definitely much better. If you really need MP4 I would take a look in lighttp's code for h.264/mp4 streaming (http://h264.code-shop.com/trac/wiki/Mod-H264-Streaming) to repeat mp4 atoms. jk On 2. 2. 2012, at 17:39, Jan Spurny wrote: > Hi, > > thanks for reply, this is definitely working, but I need solution within gstreamer pipeline. > So I just have to look into ffmpeg sources and then replicate this functionality in my new element.. > > Jan Spurny > > On Thu, 02 Feb 2012 16:31:13 +0100 (CET) > Angel Martin <[hidden email]> wrote: > >> Hi, >> >> 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. >> >> Maybe this solution, based on ffmpeg, could fix your problem: >> http://ffmpeg.org/ffmpeg.html#segment >> >> You can find a more contextualized explanation here: >> http://forums.creativecow.net/thread/291/616 >> >> Best, >> >> Angel >> >> 2012/2/2 Jan Spurny <[hidden email]> >> >>> Hi, >>> >>> 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. >>> 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. >>> 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. >>> >>> For example, this "works" (vid.avi containst h264 stream): >>> >>> gst-launch filesrc location=vid.avi \ >>> ! avidemux \ >>> ! mpegtsmux \ >>> ! multifilesink next-file=key-frame location=file-%03d.mpg >>> >>> 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: >>> >>> gst-launch filesrc location=vid.avi \ >>> ! decodebin \ >>> ! x264enc \ >>> ! mp4mux fragment-duration=30000 \ >>> ! multifilesink next-file=key-frame location=file-%03d.mp4 >>> >>> 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. >>> >>> It seems to me that while mp4mux and multifilesink works fine together, >>> some crucial mp4 header is lost for all but the first file. >>> >>> Also the first playable file segment has length of 10 seconds regardless >>> of the specified "fragment-duration", so I probably got this one wrong.. >>> And to make things even stranger, without "fragment-duration" option, even >>> the first file is not playable.. >>> >>> Anyway, it seems that I'm at least moving in the right direction.. >>> >>> >>> Jan Spurny >>> >>> On Thu, 02 Feb 2012 09:43:44 +0100 (CET) >>> Garbriel Neumüller <[hidden email]> wrote: >>> >>>> Hi, >>>> do you know the Multifilesink plugin? >>>> I think it would do exactly what you expect . >>>> I never used it by my own but it sounds quite well. >>>> >>>> >>>> >>>> -----Ursprüngliche Nachricht----- >>>> Von: >>>> gstreamer-devel-bounces+horsthuchen=[hidden email] >>>> [mailto:gstreamer-devel-bounces+horsthuchen >>> =[hidden email] >>>> .org] Im Auftrag von Jan Spurny >>>> Gesendet: Mittwoch, 1. Februar 2012 12:01 >>>> An: [hidden email] >>>> Betreff: storing one video stream into multiple files >>>> >>>> Hi, >>>> >>>> I'm trying to store video from one video stream into multiple files with >>>> given duration. >>>> Something which could look like this: >>>> >>>> gst-launch souphttpsrc location=http://1.2.3.4/video1 ! decodebin ! >>> x264enc >>>> ! SOMETHING filename="file_%D_%T.mp4" duration=2m >>>> >>>> and it would produce files like these: >>>> >>>> file_2012-02-01_10-12-43.mp4 >>>> file_2012-02-01_10-14-43.mp4 >>>> file_2012-02-01_10-16-43.mp4 >>>> .. >>>> >>>> I don't expect that element "SOMETHING" already exists so I'll have to >>> write >>>> it myself. I have written a few simple gstreamer elements (mostly some >>> kind >>>> of raw-video transformations) so I'm quite confident I'll be able to do >>> it, >>>> but I do need all advices and guidelines I can get. >>>> >>>> I'll have many different inputs - different input sources (files, http >>>> streams, rtsp streams, v4l, ..) and also different input formats (mjpeg, >>>> mpeg4, h264, raw-yuv). But that's ok, gstreamer can handle these without >>>> problems. >>>> >>>> Now I can either just simply reuse the stream and just "cut it into >>> chunks >>>> of desired length", but as there are so many different formats to work >>>> with.. >>>> Or I'll just recode video into some default format. That's why I have a >>>> "decodebin ! x264enc" in my pipeline above. I may support more formats in >>>> the future but for the first version one is enough. >>>> >>>> So with one known format (let's say h264) I'll have to "pack it" (muxer) >>>> into small chunks and write them down to disk. >>>> >>>> This is the part where I don't really know where to start - I guess >>> studying >>>> some existing muxer and would be a good start, but I'm really scared of >>> all >>>> the complexity with encoded video streams, B-frames, I-frames, and all >>>> this.. >>>> >>>> >>>> Thanks in advance for any help, advices or suggestions. >>>> >>>> Jan Spurny >>>> _______________________________________________ >>>> gstreamer-devel mailing list >>>> [hidden email] >>>> http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel >>>> >>>> _______________________________________________ >>>> gstreamer-devel mailing list >>>> [hidden email] >>>> http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel >>> _______________________________________________ >>> gstreamer-devel mailing list >>> [hidden email] >>> http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel >>> > _______________________________________________ > gstreamer-devel mailing list > [hidden email] > http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel _______________________________________________ gstreamer-devel mailing list [hidden email] http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel |
Hi,
thanks for reply. No I don't exactly need mp4 container, that was just an example - what I need is something which can be played almost everywhere and I was also hoping I can come up with some universal solution, so if for some reason we won't be able to use some codec/container in future (patents..) then it would be easy to change. But I can probably settle for just mpeg-ts for now. I had some problems with pipeline when I tried re-encoding the stream and then muxing to mpeg-ts, but I hope that won't be a big problem. So I just write my version of multifilesink and I'm done... Jan Spurny On Thu, 02 Feb 2012 17:53:16 +0100 (CET) Jaroslav Klaus <[hidden email]> wrote: > Hi, > > Do you really need mp4 container? I don't believe multifilesink will work with mp4mux out of the box. Transport stream is definitely much better. > > If you really need MP4 I would take a look in lighttp's code for h.264/mp4 streaming (http://h264.code-shop.com/trac/wiki/Mod-H264-Streaming) to repeat mp4 atoms. > > jk > > On 2. 2. 2012, at 17:39, Jan Spurny wrote: > > > Hi, > > > > thanks for reply, this is definitely working, but I need solution within gstreamer pipeline. > > So I just have to look into ffmpeg sources and then replicate this functionality in my new element.. > > > > Jan Spurny > > > > On Thu, 02 Feb 2012 16:31:13 +0100 (CET) > > Angel Martin <[hidden email]> wrote: > > > >> Hi, > >> > >> 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. > >> > >> Maybe this solution, based on ffmpeg, could fix your problem: > >> http://ffmpeg.org/ffmpeg.html#segment > >> > >> You can find a more contextualized explanation here: > >> http://forums.creativecow.net/thread/291/616 > >> > >> Best, > >> > >> Angel > >> > >> 2012/2/2 Jan Spurny <[hidden email]> > >> > >>> Hi, > >>> > >>> 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. > >>> 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. > >>> 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. > >>> > >>> For example, this "works" (vid.avi containst h264 stream): > >>> > >>> gst-launch filesrc location=vid.avi \ > >>> ! avidemux \ > >>> ! mpegtsmux \ > >>> ! multifilesink next-file=key-frame location=file-%03d.mpg > >>> > >>> 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: > >>> > >>> gst-launch filesrc location=vid.avi \ > >>> ! decodebin \ > >>> ! x264enc \ > >>> ! mp4mux fragment-duration=30000 \ > >>> ! multifilesink next-file=key-frame location=file-%03d.mp4 > >>> > >>> 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. > >>> > >>> It seems to me that while mp4mux and multifilesink works fine together, > >>> some crucial mp4 header is lost for all but the first file. > >>> > >>> Also the first playable file segment has length of 10 seconds regardless > >>> of the specified "fragment-duration", so I probably got this one wrong.. > >>> And to make things even stranger, without "fragment-duration" option, even > >>> the first file is not playable.. > >>> > >>> Anyway, it seems that I'm at least moving in the right direction.. > >>> > >>> > >>> Jan Spurny > >>> > >>> On Thu, 02 Feb 2012 09:43:44 +0100 (CET) > >>> Garbriel Neumüller <[hidden email]> wrote: > >>> > >>>> Hi, > >>>> do you know the Multifilesink plugin? > >>>> I think it would do exactly what you expect . > >>>> I never used it by my own but it sounds quite well. > >>>> > >>>> > >>>> > >>>> -----Ursprüngliche Nachricht----- > >>>> Von: > >>>> gstreamer-devel-bounces+horsthuchen=[hidden email] > >>>> [mailto:gstreamer-devel-bounces+horsthuchen > >>> =[hidden email] > >>>> .org] Im Auftrag von Jan Spurny > >>>> Gesendet: Mittwoch, 1. Februar 2012 12:01 > >>>> An: [hidden email] > >>>> Betreff: storing one video stream into multiple files > >>>> > >>>> Hi, > >>>> > >>>> I'm trying to store video from one video stream into multiple files with > >>>> given duration. > >>>> Something which could look like this: > >>>> > >>>> gst-launch souphttpsrc location=http://1.2.3.4/video1 ! decodebin ! > >>> x264enc > >>>> ! SOMETHING filename="file_%D_%T.mp4" duration=2m > >>>> > >>>> and it would produce files like these: > >>>> > >>>> file_2012-02-01_10-12-43.mp4 > >>>> file_2012-02-01_10-14-43.mp4 > >>>> file_2012-02-01_10-16-43.mp4 > >>>> .. > >>>> > >>>> I don't expect that element "SOMETHING" already exists so I'll have to > >>> write > >>>> it myself. I have written a few simple gstreamer elements (mostly some > >>> kind > >>>> of raw-video transformations) so I'm quite confident I'll be able to do > >>> it, > >>>> but I do need all advices and guidelines I can get. > >>>> > >>>> I'll have many different inputs - different input sources (files, http > >>>> streams, rtsp streams, v4l, ..) and also different input formats (mjpeg, > >>>> mpeg4, h264, raw-yuv). But that's ok, gstreamer can handle these without > >>>> problems. > >>>> > >>>> Now I can either just simply reuse the stream and just "cut it into > >>> chunks > >>>> of desired length", but as there are so many different formats to work > >>>> with.. > >>>> Or I'll just recode video into some default format. That's why I have a > >>>> "decodebin ! x264enc" in my pipeline above. I may support more formats in > >>>> the future but for the first version one is enough. > >>>> > >>>> So with one known format (let's say h264) I'll have to "pack it" (muxer) > >>>> into small chunks and write them down to disk. > >>>> > >>>> This is the part where I don't really know where to start - I guess > >>> studying > >>>> some existing muxer and would be a good start, but I'm really scared of > >>> all > >>>> the complexity with encoded video streams, B-frames, I-frames, and all > >>>> this.. > >>>> > >>>> > >>>> Thanks in advance for any help, advices or suggestions. > >>>> > >>>> Jan Spurny > >>>> _______________________________________________ > >>>> gstreamer-devel mailing list > >>>> [hidden email] > >>>> http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel > >>>> > >>>> _______________________________________________ > >>>> gstreamer-devel mailing list > >>>> [hidden email] > >>>> http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel > >>> _______________________________________________ > >>> gstreamer-devel mailing list > >>> [hidden email] > >>> http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel > >>> > > _______________________________________________ > > gstreamer-devel mailing list > > [hidden email] > > http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel > > _______________________________________________ > gstreamer-devel mailing list > [hidden email] > http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel gstreamer-devel mailing list [hidden email] http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel |
In reply to this post by Jan Spurný
Jan,
I have a similar requirement and would be willing to collaborate with you on this one. I agree that mutlifilesink is the right implementation from a pipeline architecture perspective. But mux and codec complexities might throw some curves. I am interested in using it with the mp4mux.
It looks as if multifilesink is very close to doing it. Here's what I have tried: gst-launch -vt --gst-plugin-spew videotestsrc num-buffers=10 do-timestamp=true is-live=true ! queue \
! 'video/x-raw-yuv,width=1280,height=720,framerate=15/1' ! x264enc pass=5 quantizer=22 speed-preset=4 profile=1 ! queue ! mux. \ audiotestsrc is-live=true num-buffers=10 ! queue ! faac bitrate=44100 ! queue ! mux. \
mp4mux name="mux" faststart=true ! \ multifilesink location=segment%05d.mp4 post-messages=true next-file=1 #filesink location=segment.mp4
# above works but multifilesink fails to open file line 532 There appear to be a few problems:
1. With any next-file value other than 0, multifilesink fails to open file line 532. I'm not sure why. 2. There needs to be a new GstMultiFileSinkNext file for a certain amount of time.
3. Currently, the files created with next-file=0 have size but are corrupt, presumably because the lack the proper mp4 format. Although next-file=2 is commented as being useful for TSMUX streams, which are similar. Also not sure why.
It seems like a very useful feature for DVR applications. Anyone have some guidance on this? Mike Mitchell On Wed, Feb 1, 2012 at 3:00 AM, Jan Spurny <[hidden email]> wrote: Hi, _______________________________________________ gstreamer-devel mailing list [hidden email] http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel |
Hi,
I have some progress, but not in a form of a plugin/element yet. I'm now experimenting with "dynamic" element change when I block decoder's src pad, unlink the encoder from the rest of the pipeline, send EOS to the rest of the pipeline, destroy the rest, create new elements, link them, set them to PLAYING, link them with the static pipeline and unblock decoder's src pad. It looks a bit like this: [live_source]->[decoder]--X-->[encoder]->[muxer]->[filesink] where: [live_source]->[decoder] is a static part of a pipeline X is point where pipeline is blocked / cut / extended / unblocked [encoder]->[muxer]->[filesink] is dynamic part which is created This way I can use almost any muxer/encoder I want and I'm able to set new filename everytime the pipeline changes. I have still some problems, but I think it'll work and then I'll just make new element for "Software DVR bin", let's call it "swdvrbin" for now. But there is two major inherent problems with my approach: - video gets decoded and then reencoded, which can be a big performance problem - stored video is different from the one which "live_source" has sent Jan Spurny > ------------ Původní zpráva ------------ > Od: Mike Mitchell <[hidden email]> > Předmět: Re: storing one video stream into multiple files > Datum: 16.2.2012 23:00:29 > ---------------------------------------- > Jan, > I have a similar requirement and would be willing to collaborate with you > on this one. I agree that mutlifilesink is the right implementation from a > pipeline architecture perspective. But mux and codec complexities might > throw some curves. I am interested in using it with the mp4mux. > It looks as if multifilesink is very close to doing it. Here's what I have > tried: > > gst-launch -vt --gst-plugin-spew videotestsrc num-buffers=10 > do-timestamp=true is-live=true ! queue \ > ! 'video/x-raw-yuv,width=1280,height=720,framerate=15/1' ! x264enc pass=5 > quantizer=22 speed-preset=4 profile=1 ! queue ! mux. \ > audiotestsrc is-live=true num-buffers=10 ! queue ! faac bitrate=44100 ! > queue ! mux. \ > mp4mux name="mux" faststart=true ! \ > multifilesink location=segment%05d.mp4 post-messages=true next-file=1 > #filesink location=segment.mp4 > # above works but multifilesink fails to open file line 532 > > There appear to be a few problems: > 1. With any next-file value other than 0, multifilesink fails to open file > line 532. I'm not sure why. > 2. There needs to be a new GstMultiFileSinkNext file for a certain amount > of time. > 3. Currently, the files created with next-file=0 have size but are corrupt, > presumably because the lack the proper mp4 format. Although next-file=2 is > commented as being useful for TSMUX streams, which are similar. Also not > sure why. > > It seems like a very useful feature for DVR applications. Anyone have some > guidance on this? > > *Mike Mitchell* > > > > > On Wed, Feb 1, 2012 at 3:00 AM, Jan Spurny <[hidden email]> wrote: > > > Hi, > > > > I'm trying to store video from one video stream into multiple files with > > given duration. > > Something which could look like this: > > > > gst-launch souphttpsrc location=http://1.2.3.4/video1 ! decodebin ! > > x264enc ! SOMETHING filename="file_%D_%T.mp4" duration=2m > > > > and it would produce files like these: > > > > file_2012-02-01_10-12-43.mp4 > > file_2012-02-01_10-14-43.mp4 > > file_2012-02-01_10-16-43.mp4 > > .. > > > > I don't expect that element "SOMETHING" already exists so I'll have to > > write it myself. I have written a few simple gstreamer elements (mostly > > some kind of raw-video transformations) so I'm quite confident I'll be able > > to do it, but I do need all advices and guidelines I can get. > > > > I'll have many different inputs - different input sources (files, http > > streams, rtsp streams, v4l, ..) and also different input formats (mjpeg, > > mpeg4, h264, raw-yuv). But that's ok, gstreamer can handle these without > > problems. > > > > Now I can either just simply reuse the stream and just "cut it into chunks > > of desired length", but as there are so many different formats to work > > with.. > > Or I'll just recode video into some default format. That's why I have a > > "decodebin ! x264enc" in my pipeline above. I may support more formats in > > the future but for the first version one is enough. > > > > So with one known format (let's say h264) I'll have to "pack it" (muxer) > > into small chunks and write them down to disk. > > > > This is the part where I don't really know where to start - I guess > > studying some existing muxer and would be a good start, but I'm really > > scared of all the complexity with encoded video streams, B-frames, > > I-frames, and all this.. > > > > > > Thanks in advance for any help, advices or suggestions. > > > > Jan Spurny > > _______________________________________________ > > gstreamer-devel mailing list > > [hidden email] > > http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel > > > > > gstreamer-devel mailing list [hidden email] http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel |
Hi.
Do you complete your plugin or maybe application? |
I too am interested in your solution.
|
This is a very old thread which just got bumped, but to answer the question: check out splitmuxsink. This element will split your video in segments.
|
Free forum by Nabble | Edit this page |