Hello,I process the video which comes from the USB camera on AGX Xavier,and use the gstreamer encode every frame to H.264 Transmit to PC by Ethernet.
the PC as the recevie terminal which decodes the H.264 stream use gstreamer plugins (ubuntu 18.04)
So,how to use the gsteamer plugin set the video stream display windows to the specified position on the screen
my send end(AGX Xavier)program is
#include <opencv2/opencv.hpp>
#include <iostream>
using namespace std;
using namespace cv;
int main(int argc, char* argv[])
{
cv::VideoCapture cap("v4l2src device=/dev/video0 ! video/x-raw, framerate=30/1, width=(int)1920, height=(int)1080 ! videoconvert ! appsink ");
VideoWriter video;
video.open("appsrc ! autovideoconvert ! omxh264enc bitrate=30000000 peak-bitrate=30500000 ! video/x-h264,stream-format=byte-stream! h264parse ! rtph264pay ! udpsink host=192.168.1.101 port=5001 sync=false ",cv::CAP_GSTREAMER,0,30,Size(1920,1080),true);
if (!video.isOpened())
{
printf("can't create writer\n");
return -1;
}
Mat img;
int nframe=0;
while(1)
{
cap.read(img);
video.write(img);
}
return 0;
}
my recevie end(PC ubuntu18.04)use gstreamer plugin command to decode the H.264 and display the video stream
sudo /usr/bin/gst-launch-1.0 udpsrc port=5001 ! application/x-rtp,encoding-name=H264,payload=96 ! tee name=t t. ! queue ! rtph264depay ! h264parse ! nvv4l2decoder ! nveglglessink
or
sudo /usr/bin/gst-launch-1.0 udpsrc port=5001 ! application/x-rtp,encoding-name=H264,payload=96 ! rtph264depay ! h264parse ! queue! avdec_h264 ! xvimagesink
I was try to the videobox ,videomixer,compositor plugins, and they can’t solve my problem
Thank you!!