Saving timestamp failed when using Jetson hardware encoding in Jetson Orin r35 Jetpack 5.0
My machine is Jetson Orin
Jetpack 5.0.2
L4T: 35.1.0
I referred to the code provided by Nvidia,01_video_encode (video encode) and 12_camera_v4l2_cuda (camera capture CUDA processing)
Here is the code for assigning a timestamp to me
struct v4l2_buffer enc_buf;
struct v4l2_plane planes[MAX_PLANES];
memset(&enc_buf, 0, sizeof(enc_buf));
memset(planes, 0, MAX_PLANES * sizeof(struct v4l2_plane));
enc_buf.type = V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE;
enc_buf.memory = V4L2_MEMORY_DMABUF;
enc_buf.m.planes = planes;
now = cyber::Time::Now();
raw_image->tv_sec = now.ToSecond();
raw_image->tv_usec = (now.ToNanosecond() % 1000000000) / 1000;
/* Set user provided timestamp when copy timestamp is enabled */
enc_buf.flags |= V4L2_BUF_FLAG_TIMESTAMP_COPY;
enc_buf.timestamp.tv_sec = raw_image->tv_sec;
enc_buf.timestamp.tv_usec = raw_image->tv_usec;
then ,I using 00_video_decode parse,but timestamp is 0。
But it didn’t work out
Do you have R35 video capture encoding example code
my log output is :
[video_decode_main.cpp][dec_capture_loop_fcn][848] add by diyun 01 ,tv_sec=0
[video_decode_main.cpp][dec_capture_loop_fcn][849] add by diyun 01 ,tv_usec=0
[video_decode_main.cpp][dec_capture_loop_fcn][848] add by diyun 01 ,tv_sec=0
[video_decode_main.cpp][dec_capture_loop_fcn][849] add by diyun 01 ,tv_usec=0
[video_decode_main.cpp][dec_capture_loop_fcn][848] add by diyun 01 ,tv_sec=0
[video_decode_main.cpp][dec_capture_loop_fcn][849] add by diyun 01 ,tv_usec=0
[video_decode_main.cpp][dec_capture_loop_fcn][848] add by diyun 01 ,tv_sec=0
[video_decode_main.cpp][dec_capture_loop_fcn][849] add by diyun 01 ,tv_usec=0
[video_decode_main.cpp][dec_capture_loop_fcn][848] add by diyun 01 ,tv_sec=0
[video_decode_main.cpp][dec_capture_loop_fcn][849] add by diyun 01 ,tv_usec=0
[video_decode_main.cpp][dec_capture_loop_fcn][848] add by diyun 01 ,tv_sec=0
[video_decode_main.cpp][dec_capture_loop_fcn][849] add by diyun 01 ,tv_usec=0
[video_decode_main.cpp][dec_capture_loop_fcn][848] add by diyun 01 ,tv_sec=0
[video_decode_main.cpp][dec_capture_loop_fcn][849] add by diyun 01 ,tv_usec=0
Hi,
It is uncertain what source type is from the description. Is your source Bayer sensor or IP camera?
And we have latest Jetpack 5.1 1or 5.1.1. Please consider upgrade to latest version instead of using 5.0.2.
My machine’s basic environment is currently changing and it is not realistic. We have been using it for a long time, and the two versions you mentioned are similar to my version. I don’t think it’s a problem with the version. My camera is a gsml camera and has already implemented v4l2 video capture and H264 encoding, but the timestamp is not included
Hi,
Would like to know if it is a USB camera? Or it is a YUV camera sensor connecting to CSI port?
Can someone help me solve this problem? It has been bothering me for a long time
The code I used is as follows,Already able to use v4l2 to capture videos and successfully encode H264 files,But the timestamp is not assigned a value
12_camera_v4l2_cuda_r35_encode_ok.zip (11.2 KB)
hello 2532098972,
since it’s now moving to kernel-5.10, it uses timespec64
as timestamp struct.
struct timespec64 {
time64_t tv_sec; /* seconds */
long tv_nsec; /* nanoseconds */
besides, for every frame capture, VI operations it also stores start-of-frame timestamp to v4l2 buffer, please refer to VI driver,
for example, $public_sources/kernel_src/kernel/nvidia/drivers/media/platform/tegra/camera/vi/vi5_fops.c
static void vi5_capture_dequeue(struct tegra_channel *chan,
struct tegra_channel_buffer *buf)
{
...
vb->vb2_buf.timestamp = descr->status.sof_timestamp;
Can you provide the code base I provided for Jetpack version 5.0.2 L4T: 35.1.0? I cannot find the file you mentioned on my end
Can you provide the code base I provided for Jetpack version 5.0.2 L4T: 35.1.0? I cannot find the file you mentioned on my end
Hi,
The VI driver code is in kernel, please download source code package and check.
And latest release is Jetpack 5.1.2. We would suggest upgrade to later version. Certain issues are fixed in later releases.
But your mainstream product orin is still Jetpack 5.0, and I only bought it last year,This has only passed for a short period of time
Hi,
It would be great if you can upgrade since later releases contain certain bug fixes. If you prefer not to upgrade, please download kernel source code and check further. The driver code is open source and you may add prints to check how timestamps are acquired and stored in kernel.
This is already the latest version, and I think you misunderstood it. I don’t need the kernel vi code, I just implement the coding function
Hi,
The latest version is r35.3.1(Jetpack 5.1.1). Please run the command and confirm which release you are using:
$ head -1 /etc/nv_tegra_release
Hi,
You are using r35.1. We would suggest upgrade to r35.4.1. Do you have host PC in Ubuntu 18.04 or 20.04? For upgrading system image to AGX Orin developer kit, you would need a host PC which has SDKManager installed.