-
Notifications
You must be signed in to change notification settings - Fork 3
Example Pipelines
- Show a test video pattern on the local display
gst-launch-1.0 videotestsrc ! video/x-raw,width=1280,height=1024 ! fbdevsink
- Show video image from PiCam on local display (needs custom rpicamsrc plugin installed)
gst-launch-1.0 -v rpicamsrc ! video/x-raw,width=1280,height=1024 ! fakesink
- Stream RTMP (h.264/FLV) test pattern to Restreamer.io. 720p seems standard streaming resolution
gst-launch-1.0 videotestsrc ! omxh264enc ! video/x-h264,width=1280,height=720,framerate=25/1 ! h264parse ! flvmux streamable=true name=mux ! queue ! rtmpsink location='rtmp://$STREAM_URL/$STREAM_KEY live=1 flashver=FME/3.0%20(compatible;%20FMSc%201.0)'
- Stream RTMP (h.264/FLV) Pi Cam image to Restreamer.io. 720p seems standard streaming resolution
gst-launch-1.0 rpicamsrc keyframe-interval=2 ! video/x-h264,width=1280,height=720,framerate=25/1 ! h264parse ! flvmux streamable=true name=mux ! queue ! rtmpsink location='rtmp://$STREAM_URL/$STREAM_KEY live=1 flashver=FME/3.0%20(compatible;%20FMSc%201.0)'
NB. This isn't working on the cloud side, I think as there's no video
gst-launch-1.0 -v audiotestsrc is-live=true ! audio/x-raw, format=\(string\)S16LE, endianness=\(int\)1234, signed=\(boolean\)true, width=\(int\)16, depth=\(int\)16, rate=\(int\)16000, channels=\(int\)1 ! queue ! voaacenc bitrate=128 ! aacparse ! audio/mpeg,mpegversion=4,stream-format=raw ! queue ! flvmux streamable=true ! queue ! rtmpsink location='rtmp://$STREAM_URL/$STREAM_KEY live=1 flashver=FME/3.0%20(compatible;%20FMSc%201.0)'
gst-launch-1.0 audiotestsrc is-live=true ! audio/x-raw, format=\(string\)S16LE, endianness=\(int\)1234, signed=\(boolean\)true, width=\(int\)16, depth=\(int\)16, rate=\(int\)16000, channels=\(int\)1 ! queue ! voaacenc bitrate=128 ! aacparse ! audio/mpeg,mpegversion=4,stream-format=raw ! queue ! mux. rpicamsrc keyframe-interval=2 ! video/x-h264,width=1280,height=720,framerate=25/1 ! h264parse ! queue ! flvmux streamable=true name=mux ! queue ! rtmpsink location='rtmp://$STREAM_URL/$STREAM_KEY live=1 flashver=FME/3.0%20(compatible;%20FMSc%201.0)'
Flip video
gst-launch-1.0 audiotestsrc is-live=true ! audio/x-raw, format=\(string\)S16LE, endianness=\(int\)1234, signed=\(boolean\)true, width=\(int\)16, depth=\(int\)16, rate=\(int\)16000, channels=\(int\)1 ! queue ! voaacenc bitrate=128 ! aacparse ! audio/mpeg,mpegversion=4,stream-format=raw ! queue ! mux. rpicamsrc keyframe-interval=2 vflip=true hflip=true ! video/x-h264,width=1280,height=720,framerate=25/1 ! h264parse ! queue ! flvmux streamable=true name=mux ! queue ! rtmpsink location='rtmp://$STREAM_URL/$STREAM_KEY live=1 flashver=FME/3.0%20(compatible;%20FMSc%201.0)'
View MJPEG supporting laptop webcam on screen
gst-launch-1.0 v4l2src ! image/jpeg,width=320,framerate=15/1,rate=15 ! jpegdec ! autovideoconvert ! ximagesink
View video test src with OpenGL rendering
gst-launch-1.0 videotestsrc ! glimagesink
Format for using glshader
gst-launch-1.0 videotestsrc ! glupload ! glshader fragment="\"cat myshader.fs\"" ! glimagesink
Simple GL pipeline
gst-launch-1.0 -v gltestsrc ! 'video/x-raw(memory:GLMemory),width=1280,height=720' ! glimagesink
Webcam GL pipeline
gst-launch-1.0 -v v4l2src ! glupload ! 'video/x-raw(memory:GLMemory),width=1280,height=720' ! glimagesink
Test image on a rotating cube
gst-launch-1.0 -v videotestsrc ! glupload ! glfiltercube ! glimagesink
Webcam on rotating cube (slow)
gst-launch-1.0 -v v4l2src ! videoconvert ! 'video/x-raw,format=(string)RGBA,width=640,height=480' ! glupload ! glfiltercube ! glimagesink
Upload / Download test
gst-launch-1.0 -v videotestsrc ! 'video/x-raw,format=RGBA' ! glupload ! glcolorscale ! gldownload ! videoconvert ! ximagesink
raspivid -o - -t 0 -vf -hf -fps 30 -b 6000000 | ffmpeg -re -ar 44100 -ac 2 -acodec pcm_s16le -f s16le -ac 2 -i /dev/zero -f h264 -i - -vcodec copy -acodec aac -ab 128k -g 60 -strict experimental -f flv rtmp://$stream/$key
NB. Needs custom FFMPEG built with Rpi OMX acceleration
ffmpeg -f v4l2 -framerate 25 -video_size 640x480 -i /dev/video0 -vcodec h264_omx -b:v 2.5M -g 50 -f flv rtmp://$stream/$key
ffmpeg -f v4l2 -framerate 25 -video_size 1280x720 -i /dev/video0 -vcodec h264_omx -b:v 2.5M -g 50 -f flv rtmp://$stream/$key
ffmpeg -f alsa -ac 1 -i hw:1 -f v4l2 -framerate 25 -video_size 1280x720 -i /dev/video0 -vcodec h264_omx -b:v 2.5M -g 50 -c:a aac -ar 44100 -b:a 128k -f flv rtmp://$stream/$key
raspivid -o - -t 0 -w 1280 -h 720 -ev 25 -ex nightpreview -fps 25 -b 6000000 | ffmpeg -f alsa -thread_queue_size 512 -ac 1 -i hw:1 -f h264 -i - -vcodec copy -c:a aac -ar 44100 -b:a 128k -f flv rtmp://$stream/$key
Note if we're setting -ac 1 for one channel and the connected device has 2 channels FFMPEG will fail
With delay...
raspivid -o - -t 0 -w 1280 -h 720 -ev 25 -ex auto -fps 25 -b 6000000 | \
ffmpeg \
-itsoffset -0.5 \
-thread_queue_size 1024 -f alsa -ac 1 -ar 44100 -i hw:1 -thread_queue_size 512 \
-use_wallclock_as_timestamps 1 -f h264 \
-i - -vcodec copy -c:a aac -b:a 128k \
-f flv rtmp://$stream/$key
Test video source
ffmpeg -f lavfi -i testsrc=size=1280x720:rate=25 -c:v libx264 -preset fast -pix_fmt yuv420p -s 1280x800 -c:a aac -b:a 160k -ar 44100 -threads 0 -f flv rtmp://mybees.co.uk:82/live/external.stream?token=$TOKEN