Gstreamer pipeline not working as expected

Continuing the discussion from Gstreamer pipeline working differently for jetpack 4.6 and jetpack 4.4.1:
I recently reflashed my nx board with jetpack 4.6 and this same issue appeared on jetpack 4.6 as well. I tried to test on a freshly setup agx (jetpack 4.6) and the same issue was still present. I tried to use the patch available for jetpack 4.4 but that didn’t work.
Any help to correct this would be appreciated.

Hi,
We should have fixed it in Jetpack 4.6. So you have string like this:

... ! nvv4l2decoder mjpeg=1 ! nvoverlaysink

And the decoded YUVs are not correct?

the string i had used was:
gst-launch-1.0 v4l2src device=/dev/pal5 io-mode=2 ! 'image/jpeg,width=1280,height=720' ! nvv4l2decoder mjpeg=1 ! 'video/x-raw(memory:NVMM)' ! nvvidconv ! video/x-raw ! videoconvert ! video/x-raw ! xvimagesink
And the output from that was incorrect(the colours were faded).

Hi,
We try the following command on Jetpack 4.6 with Logitech Brio USB camera and the recorded video looks correct:

$ gst-launch-1.0 v4l2src device=/dev/video1 io-mode=2 num-buffers=100 ! image/jpeg,width=1920,height=1080,framerate=30/1 ! nvv4l2decoder mjpeg=1 ! nvvidconv ! nvv4l2h264enc ! h264parse ! matroskamux ! filesink location=test.mkv

Could you also try it with your camera?

When I run the above command(and changing the device) I get the following error:

Setting pipeline to PAUSED ...
Opening in BLOCKING MODE 
Opening in BLOCKING MODE 
Pipeline is live and does not need PREROLL ...
Setting pipeline to PLAYING ...
New clock: GstSystemClock
ERROR: from element /GstPipeline:pipeline0/GstV4l2Src:v4l2src0: Internal data stream error.
Additional debug info:
gstbasesrc.c(3055): gst_base_src_loop (): /GstPipeline:pipeline0/GstV4l2Src:v4l2src0:
streaming stopped, reason not-negotiated (-4)
Execution ended after 0:00:00.001914427
Setting pipeline to PAUSED ...
Setting pipeline to READY ...
Setting pipeline to NULL ...
Freeing pipeline ...

Hi,
Do you configure the device path and resolution/frame rate according to your v4l2 source? You would need to adapt the command to fit the source.

Yes, I had changed the device, framerate and width/height

Hi,
Please break down the pipeline:

gst-launch-1.0 v4l2src device=/dev/pal5 io-mode=2 ! 'image/jpeg,width=1280,height=720' ! nvv4l2decoder mjpeg=1 ! fakesink
gst-launch-1.0 v4l2src device=/dev/pal5 io-mode=2 ! 'image/jpeg,width=1280,height=720' ! nvv4l2decoder mjpeg=1 ! nvvidconv ! 'video/x-raw(memory:NVMM),format=NV12' ! fakesink

Both of the above commands are running and the output is this:

Setting pipeline to PAUSED ...
Opening in BLOCKING MODE 
Pipeline is live and does not need PREROLL ...
Setting pipeline to PLAYING ...
New clock: GstSystemClock
NvMMLiteOpen : Block : BlockType = 277 
NVMEDIA: Reading vendor.tegra.display-size : status: 6 
NvMMLiteBlockCreate : Block : BlockType = 277

what should be the next steps?

Hi,
You can try with encoder:

gst-launch-1.0 v4l2src device=/dev/pal5 io-mode=2 ! 'image/jpeg,width=1280,height=720' ! nvv4l2decoder mjpeg=1 ! nvvidconv ! 'video/x-raw(memory:NVMM),format=NV12' ! nvv4l2h264enc ! fakesink

This is my output on running the above command:

Setting pipeline to PAUSED ...
Opening in BLOCKING MODE 
Opening in BLOCKING MODE 
Pipeline is live and does not need PREROLL ...
Setting pipeline to PLAYING ...
New clock: GstSystemClock
NvMMLiteOpen : Block : BlockType = 277 
NVMEDIA: Reading vendor.tegra.display-size : status: 6 
NvMMLiteBlockCreate : Block : BlockType = 277 
Redistribute latency...
NvMMLiteOpen : Block : BlockType = 4 
===== NVMEDIA: NVENC =====
NvMMLiteBlockCreate : Block : BlockType = 4 
H264: Profile = 66, Level = 0 

Hi,
Please

  1. Replace fakesink to h264parse ! matroskamux ! filesink location=a.mkv.
  2. Run for a few seconds and terminate the command
  3. Check if the video file is good.

The faded colour issue is still present even after running the following:

gst-launch-1.0 v4l2src device=/dev/pal5 io-mode=2 ! 'image/jpeg,width=1280,height=720' ! nvv4l2decoder mjpeg=1 ! nvvidconv ! 'video/x-raw(memory:NVMM),format=NV12' ! nvv4l2h264enc ! h264parse ! matroskamux ! filesink location=a.mkv

Hi,
Please run the command and attach the MJPEG stream for reference:

gst-launch-1.0 v4l2src num-buffers=123 device=/dev/pal5 io-mode=2 ! 'image/jpeg,width=1280,height=720' ! filesink location=a.mjpg

That gave the correct output but we are not using the mjpg decoder in that. To improve the fps, I’m trying to use mjpg decoder.

Hi, please attach a.mjpg so that we can check why nvv4l2decoder cannot decode the stream correctly.

I’m attaching the a.mjpg file that I get after running the following:

gst-launch-1.0 v4l2src num-buffers=123 device=/dev/pal5 io-mode=2 ! 'image/jpeg,width=1280,height=720' ! filesink location=a.mjpg

link to a.mjpg

ps: Really appreciate that you are trying to help me.

Hi,
We run the command and play a.mkv. The color looks good in playback. Attach a mkv for your reference.
a.mkv (47.4 MB)

For upgrading from Jetpack 4.4 to 4.6, do you do clean re-flash? If not, are you able to re-flash the system through SDKManager and try again?

I’m reflash my system and check. I’ll update you soon.

I reflashed my sd card with Jetpack 4.6. It was working properly now.
I believe it was some issue caused due to not properly flashing the sd card. Thanks for helping!