HI,I’m trying to write a C++ program in my Jetson AGX that does the following:
System version: jetpack 5.1.2
- Receive video from the camera and convert it as follows: camera->RGB-> sensor_msgs/image (data format of ros)
- For each image obtained (sensor_msgs/image): detect and/or track specific objects in it and draw a bounding box around the object.
- Output images with bounding boxes to the Gstreamer pipeline, which encodes these images into JPEGs, and then outputs these JPEGs to a certain receiver, such as TCPSoreSink. This is the first configuration. The second configuration is to convert as follows: sensor_msgs/image → h264/h265 → file/RTSP/RTMP,
Steps 1 and 2 work well so far, but in step 3 I seem to get a “JPEG parameter structure mismatch” error from gstreamer (more details later when I’ll have access to my computer).
For step 1, I wrote the following code, which works fine:
std::ostringstream ss;
ss <<"nvv4l2camerasrc device=/dev/video0 ! video/x-raw(memory:NVMM), width=1920, height=1080,interlace-mode=progressive, framerate=30/1, format=UYVY! nvvidconv ! video/x-raw(memory:NVMM), format=(string)NV12 ! appsink name=raw_sink max-buffers=1 drop=true";
std::string launch_str_ = ss.str();
GError* err = NULL;
// launch pipeline
pipeline_ = gst_parse_launch(launch_str_.c_str(), &err);
Step 3 is to use NVJPEGENC to encode the frame from sensor_msgs/image to appsrc:
std::ostringstream ss;
ss << " appsrc name=raw_src is-live=true do-timestamp=true format=3 ! nvjpegenc ! appsink name=jpg_sink max-buffers=1 drop=true";
std::string launch_str_ = ss.str();
GError* err = NULL;
// launch pipeline
pipeline_ = gst_parse_launch(launch_str_.c_str(), &err);
However, in the third step, it is displayed: JPEG parameter struct mismatch: library thinks size is 584, caller expects 720, causing the program to error.I use appsrc name=raw_src is-live=true do-timestamp=true format=3! nvjpegenc ! Is appsink name=jpg_sink max-buffers=1 drop=true correct? Or some other problem,thank you.