Continuously streaming a video file code review

Tim Müller tim at centricular.com
Sat Mar 28 07:25:56 PDT 2015


On Fri, 2015-03-27 at 14:18 +0000, Russell Willis wrote:

Hi,

> I'm hoping someone can help me.  I've been asked to write a small
> program to continuously stream a video file, or loop the file, over
> rtsp.  I'm using the gstrtspserver, but having never used gstreamer
> before I've no idea if I have approached this correctly.  The solution
> I have works, but I would be grateful if someone could give me an
> indication if I've taken the right design decisions or not.
> 
> I've mainly used bits and pieces from the example files found within
> the gstreamer and gstrtspserver source and documentation.
> 
> Basically the first pipeline, using filesrc, reads in a file and uses
> the EOS bus message to loop to the beginning of the file.  The
> rtspserver pulls a sample from the videosink of the first pipeline and
> pushes it out across the network.  All code I use is below, there is
> no error checking and its not efficient, I want to make sure I'm on
> the right track before investing any more time.
> (snip code)

That looks like a reasonable enough approach at first glance. It all
depends on your exact requirements of course.

You could simplify things by using the intervideosink / intervideosrc
elements instead, then you don't have to take care of moving the buffers
from sink to src yourself (you may end up encoding more or fewer frames
though because the intervideosrc creates/duplicates frames to a fixed
framerate which may not match the incoming framerate if you don't match
them up yourself; which has advantages and disadvantages).

 Cheers
  -Tim

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



More information about the gstreamer-devel mailing list