Skip to content

Instantly share code, notes, and snippets.

@jetsonhacks
Created October 17, 2014 04:14
Show Gist options
  • Save jetsonhacks/3e4bcbd8212cff1091dc to your computer and use it in GitHub Desktop.
Save jetsonhacks/3e4bcbd8212cff1091dc to your computer and use it in GitHub Desktop.
Use GStreamer to preview webcams
#!/bin/sh
# Show a webcam that delivers video 1920x1080 MJPG on screen
VELEM="v4l2src device=/dev/video0"
VCAPS="image/jpeg, width=1920, height=1080, framerate=30/1"
VSOURCE="$VELEM ! $VCAPS"
VIDEO_SINK="videoconvert ! videoscale ! xvimagesink sync=false"
VIDEO_DECODE="jpegparse ! jpegdec"
# echo is just for debugging purposes
echo gst-launch-1.0 -vvv \
$VSOURCE \
! $VIDEO_DECODE \
! $VIDEO_SINK
gst-launch-1.0 -vvv \
$VSOURCE \
! $VIDEO_DECODE \
! $VIDEO_SINK
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment