playbin2 undecoded video and about-to-finish signal

Tim Müller tim at centricular.com
Wed Mar 30 20:53:19 UTC 2016


On Sun, 2016-03-27 at 22:28 +0300, Krutskikh Ivan wrote:

Hi,

Your subject line mentions 'playbin2' - are you using the outdated and
unmaintained GStreamer 0.10 ? If yes, you should switch to a current
1.x version.

> I'm developing a video recording/broadcasting server with gstreamer
> and python.
> 
> Right now I'm facing 2 tasks:
> 
> - recording video from different sources (rtsp and http) and with
> different codecs (mjpeg,mpeg4,h264,h265) in a series of mkv files
> 
> - broadcasting video from my archive to different clients using http
> and rtsp.
> 
> Before discovering the playbin magic I used a number of template
> pipelines to capture video from source, pass it to multifilesink and
> ffmpeg to finish and store them in a convinient way, But if I could
> somehow feed my uri to playbin and get an undecoded video/audio
> stream from it, I would be able to put all my templates to single
> gstreamer pipeline: playbin uri=rtsp... (magic here) ! mpegtsmux !
> multifilesink...  And that would be very convenient.

For what it's worth, there is also decodebin and uridecodebin, which
are used inside of playbin but lower level.

You can also make (uri)decodebin stop autoplugging decoders early so
you can transmux without re-encoding, for example (auto* signals).


> The second task is more ambitious. I want to feed the recorded video
> to my clients as if it was a live source. Right now I have a file
> tree:
> 
> /basedir/cam_name/yearmonthday/hour/minutesecond-duration.mp4
> 
> Example:
> 
> archive-test:/archive/video/multi/160327/21 # ls
> 0120-00125.mp4  0730-00120.mp4  1335-00120.mp4  1940-00125.mp4  2545-
> 00120.mp4  3150-00120.mp4  3755-00120.mp4  4400-00125.mp4  5005-
> 00125.mp4  5610-00125.mp4
> 0325-00120.mp4  0930-00120.mp4  1535-00125.mp4  2145-00120.mp4  2745-
> 00125.mp4  3350-00125.mp4  3955-00125.mp4  4605-00120.mp4  5210-
> 00120.mp4  5815-00120.mp4
> 0525-00125.mp4  1130-00125.mp4  1740-00120.mp4  2345-00120.mp4  2950-
> 00120.mp4  3555-00120.mp4  4200-00120.mp4  4805-00120.mp4  5410-
> 00120.mp4
> 
> At some point in the future I recieve a request to play video from
> cam multi from  21:05 160327. I can then find my started file,
> construct a pipeline with playbin and multisocketsink, fast forward
> to the desired time and replace the uri of the file upon each about-
> to-finish signal. The complex part is that I also need an undecoded
> video stream since I plan to broadcast it to remote client without
> re-encoding.
> 
> So my questions are:
> 
> 1) Is this design possible?
> 2) Where can I find some examples of such pipelines, preferably in
> python.

It's all possible, but will be a bit fiddly.

You probably want something lower-level than playbin.

In recent GStreamer versions we have splitmuxsink and splitmuxsrc which
you might find helpful in this context.

What protocols do you want to stream as? The easiest would be to just
use gst-rtsp-server (see gst-rtsp-server/examples for some simple
examples).

Cheers
 -Tim


-- 
Tim Müller, Centricular Ltd - http://www.centricular.com




More information about the gstreamer-devel mailing list