Skip to content

Instantly share code, notes, and snippets.

@ianmackinnon
Created February 27, 2020 16:22
Show Gist options
  • Save ianmackinnon/cf8a4d6cdb08852a818fc34bd4e1882f to your computer and use it in GitHub Desktop.
Save ianmackinnon/cf8a4d6cdb08852a818fc34bd4e1882f to your computer and use it in GitHub Desktop.
Capture Nikon D90 with `gphoto2` and stream from Raspberry Pi over RTP using GStreamer
port=5000
gst-launch-1.0 -e -v udpsrc port=${port} ! \
application/x-rtp, media=video, encoding-name=H264 ! \
rtph264depay ! \
queue ! \
avdec_h264 ! \
autovideosink sync=false
# The D90 Live View is 640x426 at around 24fps
# The bottom 3 rows are magenta
# If we crop the 3 top and bottom rows we get 640x420
port=5000
host=192.168.1.127 # <- Set **client** IP here
gphoto2 --capture-movie --stdout | gst-launch-1.0 -v -e \
fdsrc ! \
image/jpeg,framerate='(fraction)'24/1,width=640,height=426 ! \
jpegdec ! \
videocrop top=3 bottom=3 ! \
queue ! \
x264enc pass=qual quantizer=35 tune=zerolatency ! \
rtph264pay ! \
udpsink host=${host} port=${port}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment