Hi everyone,
I’m using Jetpack 4.5.1 on an Xavier AGX and I would like to enable GDR for H265 encoding. I’m testing the 01_video_encode sample with the following configuration:
./video_encode input.yuv 1920 1080 H265 output.h265 --egdr -gdrf gdr_params.txt --input-metadata
where gdr_params.txt has “1 5”, however I saw in this post that for h265 the gdr_num_frames parameter seems to be ignored, and that’s what is happening to me, it always splits the I frame into 4 P frames.
Then I saw in the latest answer of that same post that you had a fix on Jetpack 4.6 so I tried the same configuration and this time it splits the I frame into the 5 P frames as the configuration file says. However, it only works during one cycle, the first 5 P frames have the refresh wave of the I frame in each of them but then the following frames don’t. I noticed that in JP 4.5.1 it used to ignore the gdr_num_frames but at least the refresh wave repeated periodically every 4 frames.
Here’s a video that shows the behavior (left JP 4.5.1, right JP 4.6)
Test in 4.6:
I made a slight modification on the sample source code to set the GDR settings to the encoder every time the cycle ends, and it works as expected (at least with 5), however I’m not sure if this is the proper way to configure it since in JP 4.5.1 it was done automatically.
This is the modification:
diff --git a/video_encode_main_org.cpp b/video_encode_main_mod.cpp
index a74831b..c7bd953 100644
--- a/video_encode_main_org.cpp
+++ b/video_encode_main_mod.cpp
@@ -1258,7 +1258,8 @@ static int encoder_proc_blocking(context_t &ctx, bool eos)
if (ctx.gdr_start_frame_number == 0xFFFFFFFF)
populate_gdr_Param(ctx.gdr_Param_file, &ctx.gdr_start_frame_number,
&ctx.gdr_num_frames);
- if (ctx.input_frames_queued_count == ctx.gdr_start_frame_number)
+ // if (ctx.input_frames_queued_count == ctx.gdr_start_frame_number)
+ if ((ctx.input_frames_queued_count % ctx.gdr_num_frames) - ctx.gdr_start_frame_number == 0)
{
ctx.gdr_out_frame_number = ctx.gdr_start_frame_number;
VEnc_gdr_params.nGDRFrames = ctx.gdr_num_frames;
@@ -2028,7 +2029,8 @@ encode_proc(context_t& ctx, int argc, char *argv[])
if (ctx.gdr_start_frame_number == 0xFFFFFFFF)
populate_gdr_Param(ctx.gdr_Param_file, &ctx.gdr_start_frame_number,
&ctx.gdr_num_frames);
- if (ctx.input_frames_queued_count == ctx.gdr_start_frame_number)
+ // if (ctx.input_frames_queued_count == ctx.gdr_start_frame_number)
+ if ((ctx.input_frames_queued_count % ctx.gdr_num_frames) - ctx.gdr_start_frame_number == 0)
{
ctx.gdr_out_frame_number = ctx.gdr_start_frame_number;
VEnc_gdr_params.nGDRFrames = ctx.gdr_num_frames;
So, my questions are:
- Is this change between Jetpack versions in the cycle repeating expected?
- Is the modification I made in the sample app the proper way to enable the repeating? If not, could you point to the correct configuration.
- Would it be possible to make it work completely on Jetpack 4.5.1?
Thanks in advance!