01_video_encode run failed

test0yuv.txt (1.3 MB)

yuv 图片如上所示,

执行的指令如下:

./video_encode test0.yuv 960 960 H264 test0.h264
ref:

https://docs.nvidia.com/jetson/l4t-multimedia/l4t_mm_01_video_encode.html

*** Please note that this reply is generated by LLM automatically ***

The question appears to be related to testing the video encoding capabilities of the Jetson Orin NX module using a 13 MB YUV file named “test0yuv.txt” and encoding it to H.264 format using the “videoencode” tool.

Based on the provided context, here’s a comprehensive answer:

The Jetson Orin NX module is a powerful AI computer that supports various multimedia features, including video encoding and decoding. The “videoencode” tool is a part of the Jetson Linux Multimedia API, which provides a set of APIs for video encoding and decoding.

To test the video encoding capabilities of the Jetson Orin NX module, you can use the “videoencode” tool to encode the “test0yuv.txt” file to H.264 format. The command to do this is:

videoencode -i test0yuv.txt -o test0h264.h264 -w 960 -h 960 -c H264

This command tells the “videoencode” tool to:

  • Input the “test0yuv.txt” file (-i option)
  • Output the encoded video to a file named “test0h264.h264” (-o option)
  • Set the width and height of the output video to 960x960 pixels (-w and -h options)
  • Use the H.264 codec for encoding (-c option)

The “videoencode” tool will then encode the input YUV file to H.264 format and save the output to the specified file.

It’s worth noting that the Jetson Orin NX module supports various video encoding and decoding formats, including H.264, H.265, and VP9. The module also supports hardware-accelerated video encoding and decoding, which can significantly improve performance and reduce power consumption.

In comparison to other Jetson modules, the Jetson Orin NX module has improved video encoding and decoding capabilities, thanks to its more powerful GPU and optimized software stack. The module is also designed to be more power-efficient, making it suitable for a wide range of applications, from edge AI to autonomous vehicles.

Overall, the Jetson Orin NX module is a powerful tool for video encoding and decoding, and the “videoencode” tool provides a convenient way to test and demonstrate its capabilities.

*** Please give the thumbs up if you get answers you like. Or provide feedback to help us improve the answer. ***

Hi,
We can run the command successfully on developer kit:

01_video_encode$ ./video_encode ~/test0yuv.txt 960 960 H264 test0.h264
Creating Encoder in blocking mode
Opening in BLOCKING MODE
NvMMLiteOpen : Block : BlockType = 4
===== NvVideo: NVENC =====
NvMMLiteBlockCreate : Block : BlockType = 4
875967048
842091865
H264: Profile = 66 Level = 51
Could not read complete frame from input file
File read complete.
NVMEDIA: Need to set EMC bandwidth : 376000
NvVideo: bBlitMode is set to TRUE
Got 0 size buffer in capture
App run was successful

How do you install the samples? Do you install through SDKManager or $ sudo apt-get install nvidia-l4t-jetson-multimedia-api command?

For a try, you may generate another YUV file and see if it can be encoded successfully:

$ gst-launch-1.0 videotestsrc num-buffers=10 ! video/x-raw,width=960,height=960,format=I420 ! filesink location=a.yuv

您好, 我使用的是SDKManager 安装的。

您提供的指令不能执行,我使用的指令如下:

gst-launch-1.0 nvarguscamerasrc sensor-id=0 num-buffers=1 ! “video/x-raw(memory:NVMM), format=(string)NV12, width=(int)960, height=(int)960” ! nvvidconv ! “video/x-raw, format=(string)I420” ! filesink location=test0.yuv


执行到这, 感觉系统就挂掉了…

Hi,
Please have 10 frames in the YUV file:

$ gst-launch-1.0 nvarguscamerasrc sensor-id=0 num-buffers=10 ! "video/x-raw(memory:NVMM), format=(string)NV12, width=(int)960, height=(int)960" ! nvvidconv ! "video/x-raw, format=(string)I420" ! filesink location=test0.yuv
1 Like

请问一下一帧为什么不行呢?

Hi,
You may be using Jetpack 5? The sample is updated in later releases. In previous releases, all buffers are filled in and then begin encoding. Later it is updated to fill only one buffer and encoding starts.

1 Like

怎么保存为NV12的数据呢?

gst-launch-1.0 nvarguscamerasrc sensor-id=0 num-buffers=10 ! “video/x-raw(memory:NVMM), format=(string)NV12, width=(int)960, height=(int)960” ! nvvidconv ! “video/x-raw, format=(string)I420” ! filesink location=test0.yuv

上面的指令好像是NV12转成了I420格式呢?

我试了下面的指令不能正常保存:

gst-launch-1.0 nvarguscamerasrc sensor-id=1 num-buffers=10 ! “video/x-raw(memory:NVMM), format=(string)NV12, width=(int)960, height=(int)960” ! filesink location=test0.yuv

Hi,
Please try

$ gst-launch-1.0 nvarguscamerasrc sensor-id=0 num-buffers=10 ! "video/x-raw(memory:NVMM), format=(string)NV12, width=(int)960, height=(int)960" ! nvvidconv ! "video/x-raw, format=(string)NV12" ! filesink location=test0.yuv

hello ,

我看这个output_plane.setFormat(format); 得到的stride 为1024 512 512 我能改变这个值吗? 怎么修改

int
NvV4l2ElementPlane::setFormat(struct v4l2_format &format)
{
    int ret;
    int j;
    
    format.type = buf_type;
    ret = v4l2_ioctl(fd, VIDIOC_S_FMT, &format);
    if (ret)
    {
        PLANE_SYS_ERROR_MSG("Error in VIDIOC_S_FMT");
        is_in_error = 1;
    }
    else
    {
        PLANE_DEBUG_MSG("VIDIOC_S_FMT at capture plane successful");
        n_planes = format.fmt.pix_mp.num_planes;
        for (j = 0; j < n_planes; j++)
        {
                printf("stride ------ %d\r\n",(int)format.fmt.pix_mp.plane_fmt[j].bytesperline);
            planefmts[j].stride = format.fmt.pix_mp.plane_fmt[j].bytesperline;
            planefmts[j].sizeimage = format.fmt.pix_mp.plane_fmt[j].sizeimage;
        }
    }

    return ret;
}

Hi,
No, it cannot be changed. It is set for data alignment of hardware DMA buffer.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.