H264 stream to MP4 file without the first bytes on the H264 stream

Tim Müller tim at centricular.com
Mon Feb 13 14:10:23 UTC 2017


On Sun, 2017-02-05 at 11:45 -0800, ivan-perez wrote:

Hi,

> For clarification, the H264 stream comes from the Raspberry camera,
> and I directly pipe it into two GStreamer instances:
> 
> * One instance is running all the time, as it takes care of producing
> a RTP stream which clients may see at any time.
> * Another instance only runs if some conditions are met (for example,
> after some detection movement). In that case, I want to save a video
> of 30 seconds (in MP4). My idea is to use the stream directly taken
> from the Raspberry camera, but at the moment it doesn't work because
> -I think- in order to work properly it'd need the first bytes of the
> stream, which may contain some headers.

You could also use rpicamsrc from

https://github.com/thaytan/gst-rpicamsrc

(which is preferably to raspivid) and run both things in the same
application?

e.g. here's a pipeline that can start/stop recording a stream (with a
few seconds of backlog even) on demand:

https://people.freedesktop.org/~tpm/code/test-backlog-recording-h264.c

Just have to switch out the bit at the beginning with rpicamsrc.

Cheers
 -Tim

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


More information about the gstreamer-devel mailing list