Hi team,
What I’m trying to do is read from a USB camera and send video stream Amazon Kinesis Video. I have used " v4l2-ctl" library to output the different formats and capabilities my camera supports. From the output of the command I can see that the USB camera supports “MJPJ” compressed and “YUYV 4:2:0” ( I420) at different FPS and resolutions. I want to read from “MJPG” format since the camera offers better FPS for 1920 1080 resolution.
Looking at the Amazon Producer G-Streamer plug in SDK documentation I have used the following example G-Streamer pipe to send video stream from USB camera
gst-launch-1.0 v4l2src do-timestamp=TRUE device=/dev/video0 ! videoconvert ! video/x-raw,format=I420,width=640,height=480,framerate=30/1 ! x264enc bframes=0 key-int-max=45 bitrate=500 ! video/x-h264,stream-format=avc,alignment=au,profile=baseline ! kvssink stream-name=“YourStreamName” storage-size=512 access-key=“YourAccessKey” secret-key=“YourSecretKey” aws-region=“YourAWSRegion”
Looking at the above code I can see that its taking stream from camera and converting the I420 format to H264 and then sending the stream to Amazon Kinesis Video. This command works fine without any issues. The problem is I want to read at a faster FPS which is only available on the “MJPJ” format.
I have seen one topic on NVIDIA form which is converting the MJPEG to h265. This topic can be found from here:
Looking at the accepted answer I was able to run the two commands to read and view live camera stream and write to a file from the MJPEC format from the camera. These two commands tested are :
gst-launch-1.0 -v v4l2src device=/dev/video0 ! image/jpeg, width=640, height=480, framerate=30/1, format=MJPG ! jpegdec ! xvimagesink
gst-launch-1.0 -v v4l2src device=/dev/video0 ! image/jpeg, width=640, height=480, framerate=30/1, format=MJPG ! jpegdec ! nvvidconv ! ‘video/x-raw(memory:NVMM), format=NV12’ ! omxh265enc ! matroskamux ! filesink location=test_MJPG_H265enc.mkv
Next I want to add this command to the AWS G-Streamer pipeline command so instead of reading from the “YUYV” format and converting to H264. I can read from “MJPG” format and convert it to H264 and send to AWS Kiensis Video.
But I have been getting some errors. I believe I might be doing the pipe wrong. Here is my command and error thrown after:
gst-launch-1.0 -v v4l2src do-timestamp=TRUE device=/dev/video0 ! videoconvert ! image/jpeg,format=MJPG, width=640, height=480, framerate=30/1 ! x264enc bframes=0 key-int-max=45 bitrate=500 ! video/x-h264,stream-format=avc,alignment=au,profile=baseline ! kvssink stream-name=“YourStreamName” storage-size=512 access-key=“YourAccessKey” secret-key=“YourSecretKey” aws-region=“YourAWSRegion”
WARNING: erroneous pipeline: could not link videoconvert0 to x264enc0, neither element can handle caps image/jpeg, format=(string)MJPG, width=(int)640, height=(int)480, framerate=(fraction)30/1
Below is my board details:
Jetson Nano 2GB Developer Kit SD Card Image version 4.5
that is running Ubuntu 18.04
Any help would be appreciated,
Thank you for your time