RTP/RTSP webcam streaming to Kinesis Video on M1 Mac - amazon-web-services

I am trying to stream videos from my M1 Macbook pro's webcam to AWS Kinesis Video Streams using GStreamer. By following the instructions on this post I was able to start an RTP stream using the following command:
ffmpeg \
-f avfoundation \
-pix_fmt yuyv422 \
-video_size 640x480 \
-framerate 30 \
-i "0:0" -ac 2 \
-vf format=yuyv422 \
-vcodec libx264 -maxrate 2000k \
-bufsize 2000k -acodec aac -ar 44100 -b:a 128k \
-f rtp_mpegts udp://127.0.0.1:9988
I am able to view the live webcam stream in VLC media player by adding the link rtp://127.0.0.1:9988 to networks, so I know it is working via RTP (note, however, that rtsp://127.0.0.1:9988 does NOT work). When I try and send the webcam's view to a Kinesis video stream in AWS via GStreamer, the command errors out. I am running the GStreamer element inside a docker container, and using the command:
gst-launch-1.0 rtspsrc location=rtsp://127.0.0.1:9988 short-header=TRUE ! rtph264depay ! h264parse ! kvssink stream-name=<my stream name> storage-size=128 access-key=<My account's access key> secret-key=<My account's secret key>
This command successfully detects the correct stream on AWS but ultimately fails with the output:
Stream is ready
Pipeline is live and does not need PREROLL ...
Progress: (open) Opening Stream
Progress: (connect) Connecting to rtsp://127.0.0.1:9988
ERROR: from element /GstPipeline:pipeline0/GstRTSPSrc:rtspsrc0: Could not open resource for reading and writing.
Additional debug info:
gstrtspsrc.c(6842): gst_rtspsrc_retrieve_sdp (): /GstPipeline:pipeline0/GstRTSPSrc:rtspsrc0:
Failed to connect. (Generic error)
ERROR: pipeline doesn't want to preroll.
I have tried setting the location parameter in the gst-launch-1.0 command to rtsp://127.0.0.1:9988, udp://127.0.0.1:9988, and rtp://127.0.0.1:9988, but none of these work, as GStreamer specifically requires a RTSP address. Is there a way to stream via the webcam with RTSP, or a way to send an RTP/UDP stream to Kinesis Video Streams?

Related

Error during RTSP streaming using gstreamer on the jetson nano

Im working on this project :
https://www.hackster.io/jonmendenhall/jetson-nano-search-and-rescue-ai-uav-9ca547
At some point I will need to mount my camera (waveshare ; IMX219-77IR) on top of the drone and I would like to use vlc on Windows or Linux outside of nomachine (because I have installed nomachine server on the nano and the client on windows and because it will run in headless mode),to display what the camera sees when the drone is flying. For this reason I’m trying to configure a gstreamer with RTSP to start a streaming server on the Ubuntu 18.04 that I have installed on the jetson nano.
Below u can see what are the commands that I have issued :
$ ./test-launch "videotestsrc ! nvvidconv ! nvv4l2h264enc ! h264parse ! rtph264pay name=pay0 pt=96"
And on the same Jetson Nano, I opened another console where I ran this pipeline to decode the RTSP stream:
gst-launch-1.0 uridecodebin uri=rtsp://127.0.0.1:8554/test ! nvoverlaysink
I see this picture :
The picture is from videotestsrc plugin. I would like to replace videotestsrc with my video source,but I don't know how to do that.
I tried these combinations,but none of them worked :
./test-launch "v4l2src device=/dev/video0 ! nvvidconv ! nvv4l2h264enc ! h264parse ! queue ! rtph264pay name=pay0 pt=96"
./test-launch "device=/dev/video0 ! nvvidconv ! nvv4l2h264enc ! h264parse ! queue ! rtph264pay name=pay0 pt=96"
but the error is still the same :
Setting pipeline to PAUSED ...
Pipeline is live and does not need PREROLL ...
Progress: (open) Opening Stream
Progress: (connect) Connecting to rtsp://127.0.0.1:8554/test
Progress: (open) Retrieving server options
Progress: (open) Retrieving media info
ERROR: from element /GstPlayBin:playbin0/GstURIDecodeBin:uridecodebin0/GstRTSPSrc:source: Could not read from resource.
Additional debug info:
gstrtspsrc.c(5917): gst_rtsp_src_receive_response (): /GstPlayBin:playbin0/GstURIDecodeBin:uridecodebin0/GstRTSPSrc:source:
Could not receive message. (Timeout while waiting for server response)
ERROR: pipeline doesn't want to preroll.
Setting pipeline to PAUSED ...
Setting pipeline to READY ...
Setting pipeline to NULL ...
Freeing pipeline ...
but why ? I know for sure that my camera (model waveshare ; IMX219-77IR) created a device called /dev/video0 and I know for sure that it works,because this command is able to show my face on the screen :
DISPLAY=:0.0 gst-launch-1.0 nvarguscamerasrc ! 'video/x-raw(memory:NVMM), width=3280, height=2464, format=(string)NV12, framerate=(fraction)20/1' ! nvoverlaysink -e

Creating RTSP streaming service for Axis camera using GStreamer GstRTSPServer

In the end I would like to take an RSTP stream from an Axis security camera, and then make it available for re streaming using Gstreamers GstRTSPServer object. For now though I cannot even get the example videotestsrc to play in any player.
I have been following the post found here:
GStreamer Launch RTSP Server for ReStreaming IP Camera H264
I have gotten the example code built and running in a console, but am unable to view the stream in any players I find. EXACT code I am using found here:
https://github.com/GStreamer/gst-rtsp-server/blob/master/examples/test-readme.c
Both Windows 10 computers I am using are on the same network, I can ping both directions, firewall is completely off on both computers.
I have tried VLC player, Axis Media Control SDK modified examples, and GStreamer
using commands:
gst-launch-1.0 rtspsrc location=rtsp://127.0.0.1:8554/test latency=0 ! rtph264depay ! avdec_h264 ! videoconvert ! autovideosink
gst-launch-1.0 rtspsrc location=rtsp://10.2.3.10:8554/test latency=0 ! rtph264depay ! avdec_h264 ! videoconvert ! autovideosink
VLC is stating in logs that the connection was actively refused. It seems it is trying to connect to port 80? Not sure if I am reading that correctly. See VLC log below. Full log is pasted here from local machine:
https://pastebin.com/my3kTsRV
and here from a second machine:
https://pastebin.com/g1q47UBm
...Connection to server failed: No connection could be made because the target machine actively refused it
Opening connection to 127.0.0.1, port 80...
...Connection to server failed: No connection could be made because the target machine actively refused it
[06421494] live555 demux debug: connection error -10057
[06421494] live555 demux error: Failed to connect with rtsp://127.0.0.1:8554/test
The Axis Media Control (AMC) is trowing this for an error on both the local and secondary computers:
503 Service Unavailable
The maximum number of clients are already connected.
Trying to connect using the GStreamer command I get the following error, on both local and secondary computers:
ERROR: from element /GstPipeline:pipeline0/GstRTSPSrc:rtspsrc0: Unhandled error
Additional debug info:
gstrtspsrc.c(5633): gst_rtspsrc_send (): /GstPipeline:pipeline0/GstRTSPSrc:rtspsrc0:
Service Unavailable (503)
ERROR: pipeline doesn't want to preroll.
With VLC, AMC and GStreamer I am able to pull a stream directly from a camera, so something works at least. I am also able to successfully run other GStreamer examples, without the GstRTSPServer, successfully.
Let me know if you want/need me to try anything.

FFmpeg post video stream to a webservice cause error 'chunked body too large'

I have a webservice which is developped by Tornado. Now I use FFmpeg to post video stream data to service. After some time, the process is down and rise an error like:
[I 170928 07:33:55 http1connection:253] Malformed HTTP message from 172.18.130.125: chunked body too large
I use command like:
ffmpeg -s 1240x720 -f video4linux2 -i /dev/video0 -b:v 0 -q:v 1 -f mpegts -c:v mpeg1video -b 800k -r 30 http://10.4.245.152:9090/video/live
Should I use ffmpeg to continue post video stream to a webservice?
As I test, I think the reason of this problem is about service server. I check my service server and find the size of chunk data is limit.

Saving webcam rtsp mpeg4 stream

I'm running Windows and I'm connected to a webcam via stand-alone Video Servers.
I'm trying to save the stream to file using gstreamer,
with the following command:
gst-launch-1.0 rtspsrc location=rtsp://10.0.0.115/?multicast/mpeg4 ! decodebin ! mpegtsmux ! filesink location=D:\SomeDir\Somefile.mp4
But I get the following error:
ERROR: from element
/GstPipeline:pipeline0/GstRTSPSrc:rtspsrc0/GstUDPSrc:udpsrc0 :Internal
data flow error. Additional debug info: gstbasesrc.c(2943):
gst_base_src_loop (): /GstPipeline:pipeline0/GstRTSPSrc:rtsp
src0/GstUDPSrc:udpsrc0:
Any ideas why?

live audio streaming server based on gstreamer and a client with vlc playing the incoming stream

I need to set up a live audio streaming server with gstreamer. Server should be sending live audio to client and at the client side, vlc player should be used to play the incoming stream. I am using the following code
VIDEO_CAPS="application/x-rtp,media=(string)video,clock-rate=(int)90000,encoding-name=(string)H264"
gst-launch -v udpsrc caps=$VIDEO_CAPS port=4444 \
! gstrtpbin .recv_rtp_sink_0 \
! rtph264depay ! ffdec_h264 ! xvimagesink
then gstreamer reports like:
Setting pipeline to PAUSED ...
Pipeline is live and does not need PREROLL ...
Setting pipeline to PLAYING ...
New clock: GstSystemClock
Please help me with steps for setting up a server using gstreamer a client for performing live streaming
Try reading manual on streaming with VLC here.
Or just:
cvlc rtp://#:4444
Update:
Due to my bad reading skills I slightly misunderstood the question.
Here is how to set up a server:
gst-launch -v pulsesrc ! audioconvert ! audioresample \
! speexenc ! rtpspeexpay \
! udpsink host=224.1.1.1 port=4444 auto-multicast=true
or use multiudpsink to send to multiple clients.