Video surveillance using Raspberry Pi and GStreamer + omxh264enc

Sebastian Dröge sebastian at centricular.com
Mon Oct 3 09:50:35 UTC 2016


On Sun, 2016-10-02 at 09:12 -0700, Maximilian wrote:
> Hi all,
> 
> I'm new to GStreamer. I'd like to record video and audio from a USB Web-cam
> and a USB microphone connected to a Raspberry Pi 3. I want to get a series
> of video files 1 hour long. Also I want to use hardware encoder to prevent
> the Pi's CPU from overheating. For that I'm running the following pipeline
> in an endless loop and use CRON to send SIGINT to it once an hour.
> 
> gst-launch-1.0 -e v4l2src !
> video/x-raw,format=YV12,width=640,height=480,framerate=5/1 \
> 	! videoconvert ! queue ! videorate ! videoflip method=clockwise \
> 	! clockoverlay halignment=left valignment=bottom time-format="%Y/%m/%d
> %H:%M:%S" font-desc="Sans 24" \
> 	! omxh264enc target-bitrate=500000 control-rate=variable !
> video/x-h264,stream-format=byte-stream,framerate=5/1 ! h264parse ! queue \
> 	! mux. alsasrc device=plughw:0,0 ! lamemp3enc target=0 bitrate=128
> mono=true \
> 	! queue leaky=2 max-size-buffers=0 max-size-time=0 max-size-bytes=0 \
> 	! mux. avimux name=mux ! queue ! filesink location=camera`date
> -Iseconds`.avi
> 
> I have the following problem, the video and audio in the resulting file is
> not synchronized. It feels like video is shorter than audio; on a video that
> is around 59:58 long I observe the last video frame being frozen when I have
> approximately 20 seconds of audio remaining.
> 
> 
> Any suggestions on how to fix or tune the pipeline are welcome. Thank you.

You probably want to use splitmuxsink here, which can create files like
that every hour or other time interval, and also ensures that
synchronization stays correct. It's exactly for use cases like yours

It's only available since GStreamer 1.8 though.

-- 
Sebastian Dröge, Centricular Ltd · http://www.centricular.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 931 bytes
Desc: This is a digitally signed message part
URL: <https://lists.freedesktop.org/archives/gstreamer-devel/attachments/20161003/5b1a655e/attachment.sig>


More information about the gstreamer-devel mailing list