storing one video stream into multiple files
Jan Spurny
JSpurny at seznam.cz
Wed Feb 1 03:00:37 PST 2012
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
More information about the gstreamer-devel
mailing list