Reputation: 21
I have a Raspberry Pi zero running v4l2rtspserver
and transmitting an RTSP stream with H264-encoded 1640x1232 frames.
I'd like gst-launch-1.0
to connect to it, change its resolution, and dump it somewhere.
Since I can't seem to get it right and since my history | grep gst-launch | wc -l
marks over 500, I thought I'd beg for help.
For those who are wondering this is my problem: Raspberrypi Zero is too slow to run MotionEyeOS and so I'd like to optimize motion-detection by running motion
on a scaled-down video stream (160x120, from a pipe or a loopback device) while retaining a full-scale video stream (via RTSP preferably, but also anything else would be ok).
In other words, I'm trying to split the output from the camera in 2 streams and change one stream's resolution.
Any other setup to achieve this (I've tried a few: v4l2loopback
, ffmpeg
+ ffserver
, mjpeg_streamer
etc.) would be fine.
Upvotes: 1
Views: 4945
Reputation: 21
I finally found it. So...assuming you have v4l2rtspserver
running with the default params, the gstreamer 1.0
pipeline to resize the video on the fly is:
gst-launch-1.0 -e rtspsrc location="rtsp://127.0.0.1:8554/unicast" ! capsfilter caps="application/x-rtp, media=(string)video, payload=(int)96, encoding-name=(string)H264" ! queue ! rtph264depay ! h264parse ! avdec_h264 ! queue ! videoconvert ! videoscale ! video/x-raw,width=160,height=120 ! avenc_h264_omx ! h264parse ! matroskamux ! filesink location=./video.mkv
Upvotes: 1