How can I create a live steam using gstreamer?
-
22-06-2021 - |
Question
I would like to stream my webcam, I tried with vlc, but I'm getting a 10-15s delay between the server and client on the same network
vlc v4l2:// :v4l2-dev=/dev/video0 :v4l2-width=640 :v4l2-height=480 --sout="#transcode{vcodec=h264,vb=800,scale=1,acodec=mp4a,ab=128,channels=2,samplerate=44100}:rtp{sdp=rtsp://:8554/live.ts}" -I dummy
Now I would like to test gstreamer, but I couldn't found any example, how can I setup a live webcam stream(rtsp or http) using gstreamer?
Solution
Take a look at the rtsp-server examples in http://cgit.freedesktop.org/gstreamer/gst-rtsp-server/tree/examples
OTHER TIPS
To create a YouTube live event, one needs a RTMP stream containing x264+aac.
gst-launch -v videotestsrc \
! video/x-raw-yuv,width=640,height=480,framerate=30/1 \
! x264enc key-int-max=60 \
! h264parse \
! flvmux name=mux \
audiotestsrc ! queue ! audioconvert ! ffenc_aac ! aacparse ! mux. \
mux. ! rtmpsink location="rtmp://<stream-server-url>/"
Key frames in live feed must appear each 2 seconds at most, thus key-int-max=<double framerate>
.
Note that RTMP works over TCP, so on a bad channel it will suffer significant delays.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow