NVIDIA Multimedia APIs with UYVY sensor

Hi all,

I tried to run 12_camera_v4l2_cuda_video_encode example without success onto Tegra TX2. I ran the example as it is specified into README.txt file and I got the issue below. I was using Jetpack 3.1 for test.

./camera_v4l2_cuda -d /dev/video1 -s 640x480 -f YUYV
Failed to query video capabilities: Inappropriate ioctl for device
libv4l2_nvvidconv (0):(774) (INFO) : Allocating (4) OUTPUT PLANE BUFFERS Layout=0
libv4l2_nvvidconv (0):(790) (INFO) : Allocating (4) CAPTURE PLANE BUFFERS Layout=0
Failed to query video capabilities: Inappropriate ioctl for device
NvMMLiteOpen : Block : BlockType = 4 
===== MSENC =====
NvMMLiteBlockCreate : Block : BlockType = 4 
875967048
842091865
===== MSENC blits (mode: 1) into tiled surfaces =====
[ERROR] (NvV4l2ElementPlane.cpp:253) <enc0> Output Plane:Error while Qing buffer: Device or resource busy
ERROR: conv_capture_dqbuf_thread_callback(): (line:638) Failed to queue buffer on ENC output plane

On the other hand, I also tried to run the example on the Tegra TX2 using the Jetpack 3.0 and it runs successfully.

Do you know what are the differences between Jetpack 3.1 and Jetpack 3.0 which do not allow to run the example?

Or

Was the example fixed in any other post?

Best Regards
Angel

Hi bill9889,

I tried to run below command with “Rocketfish HD Webcam Pro” on TX2/Jetpack 3.1 and it ran successfully.
Could you try another Camera for test? Thanks.

./camera_v4l2_cuda -d /dev/video0 -s 640x480 -f YUYV

Hello,
Like forever3000 , i try to record a FHD Jpeg image (see3cam usb camera) on TX1/L4T 24.2.1 and J120).

That run well , except the V4L2 timestamp issu in NvVideoEncoder.( need a patch).

For fix this timestamp , a add timestamp+=1 , and used FFMPEG for build a MP4 like this :

...
                        
if( ltime < _ctx->mVideoTimestamp ) {
 _ctx->mVideoTimestamp +=1;
}
else {
  _ctx->mVideoTimestamp = ltime;
}       

...

lAvpkt.pts = _ctx->mVideoTimestamp;
lAvpkt.dts =  _ctx->mVideoTimestamp;
lAvpkt.duration = 0;  
        
...

av_write_frame( _ctx->m_Format_Context, &lAvpkt )

Job process :

JPEG : V4L2_PIX_FMT_MJPEG to V4L2_PIX_FMT_YUV422M
CONV : V4L2_PIX_FMT_YUV422M to V4L2_PIX_FMT_YUV420M
ENC : V4L2_PIX_FMT_YUV420M to V4L2_PIX_FMT_H264

But sometimes, i have this message in recording log and stop the streaming :

NvVideoEnc: TransferBufferToBlock failed
NvVideoEnc: NvVideoEncTransferOutputBufferToBlock TransferBufferToBlock failed Line=652

an idea for this message ?

thx

in log , see :

enc0_capture_dqbuf_thread_callback():	Error V4L2 buffer from output plane is empty

so, i think that NvJpegDecoder return wrong 422M image. I can check if the decoder return a good 422M format, but how can i checking if the buffer data is good before converter ?

thx

Please refer to
[url]NVIDIA Multimedia APIs with UYVY sensor - Jetson TX1 - NVIDIA Developer Forums
It demonstrates V4L2 camera → NvBuffer(fd) → VIC → NvVideoEncoder

i have already check that.

i have pipe : V4L2 camera → JpegDEcoder → NvBuffer(fd) → VIC → NvVideoEncoder → MP4 … write into MP4 with callback encoder.

i think that issu come from MicroSD writing .

I try to record on EMMC TX1 , that work better.
That’s work good on mount SDD/sshfs .

I add a queue buffer between encoder and write in mp4 : one thread for h264 , and one thread for write buffer into MP4 ( that was explain in a forever3000’s thread ) .

So, with two FHD / 18Mb/s , i saw many h264 buffer dropped.

with f3 writing test , i have write test less than 2 to 5 MB/s.

How i can fix MicroSD slot ?!

i have make a thread for this MicroSD issu.

[url]https://devtalk.nvidia.com/default/topic/1036385/jetson-tx1/read-write-on-microsd/[/url]

Hi forever3000,

Where are you write your right video and left video ? On a Micro SD, a SSD , a Usb key ?

I think i have a issu … like a writing limit MicroSD slot ( i work with a MicroSD Samsung EVO 256Go and exfat format ). The Capture lost many NvBuffers which were not written , after the encoding NvVideoencoder.

2 x usb camera FHD/MJPEG for H264 with 18Mbits/s and 25 fpsjavascript:void();

Hi Syd,

With TX2 I saved video to internal memory (emmc) and with TX1 I saved them on usb key, it look like there was no problem with writing speed. I think you should have one buffer to store encoded frame then pop to write mp4 file. Because the speed of writing is not stable, sometimes fast and sometimes slow so you might lost frame if did not use buffer.

thx ,

yes , that work on EMMC, but can’t work in MicroSD slot.

like your example , I was try with ten buffers … may be add more buffer.

I have less than 5MB/s … i think it’s problem i have since to development with Gstreamer and MMAPI .

capture and encode works well, but recording to files have problems.

Hello,

ok, i confirm for microSD limit. on 24.2.1 with 2~3MB/s , and a better rating on 24.2.3 4~5MB/s.
So, all work fine with h264 enqueue buffer ( size = 1000 ).

JPEG : V4L2_PIX_FMT_MJPEG to V4L2_PIX_FMT_YUV422M
CONV : V4L2_PIX_FMT_YUV422M to V4L2_PIX_FMT_YUV420M
ENC : V4L2_PIX_FMT_YUV420M to V4L2_PIX_FMT_H264

Only a strange issue in R24.2.3, a few green line into bottom video.

i haven’t this issue with YUV or BGR camera.

a bug I420 Converter or JPEG decoder ?

i try next week on TX2 / 28.1