Stream Synchronized Webcams

Jan Schmidt thaytan at noraisin.net
Thu Nov 10 13:20:25 UTC 2016


Hi,

On 08/11/16 17:47, Eric-Stone wrote:
> Hi,
> 
> I'm trying to stream two synchronized side-by-side webcams compressed in
> h264 over the network. Right now, I have the output saved to a file (because
> it simplifies testing) using the command:

Attached is a script I used while developing the stereoscopic support in
GStreamer. It uses GL components to composite the side-by-side image,
but you can do the same with compositor in software.

omxh264enc doesn't have the code to add H.264 SEI markers to the output
video afaik, but if you make sure to mark it on the caps, then
matroskamux can write that info at the container level instead.

It's not clear how 'out of sync' your two images are. You'll always get
*some* jitter because the capture rates of the 2 webcams aren't
genlocked. You definitely shouldn't be doing do-timestamp=true though -
v4l2src will already be applying timestamps based on the actual capture
time, while 'do-timestamp=true' will apply a timestamp corresponding to
the moment the frames reach GStreamer instead.

Cheers,
Jan.

> 
> gst-launch-1.0 \
> 	v4l2src device=/dev/video0 do-timestamp=true ! \
> 	image/jpeg, width=$WIDTH, height=$HEIGHT, framerate=$FPS/1 ! \
> 	jpegparse ! jpegdec ! \
> 	videorate ! \
> 	alpha alpha=1.0 ! \
> 	videobox border-alpha=0 left=-$WIDTH ! \
> 	videomixer name=mix ! \
> 	videoconvert ! \
> 	queue ! \
> 	queue ! omxh264enc ! matroskamux ! filesink location=output/out.mkv  \
> 	$v4l2src device=/dev/video1 do-timestamp=true ! \
> 	image/jpeg, width=$WIDTH, height=$HEIGHT, framerate=$FPS/1 ! \
> 	jpegparse ! jpegdec ! \
> 	videorate ! \
> 	queue ! \
> 	mix.
> 
> This works, but unfortunately the two views are out of sync. I imagine that
> I need to add "sync=true" to some element before the encoder, but I'm unsure
> as where that should go. Does anyone have any suggestions on how to
> synchronize these two inputs?
> 
> 
> 
> --
> View this message in context: http://gstreamer-devel.966125.n4.nabble.com/Stream-Synchronized-Webcams-tp4680531.html
> Sent from the GStreamer-devel mailing list archive at Nabble.com.
> _______________________________________________
> gstreamer-devel mailing list
> gstreamer-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
> 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: record-2-usb.sh
Type: application/x-shellscript
Size: 604 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/gstreamer-devel/attachments/20161111/9c34120d/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: <https://lists.freedesktop.org/archives/gstreamer-devel/attachments/20161111/9c34120d/attachment.sig>


More information about the gstreamer-devel mailing list