I have two problems with the H264/H265 encoders in the Multimedia API. I am on L4T 28.1. Due to product release date it is not feasible to update version right now.
Framerate setting
The setFrameRate function has a numerator and denumerator parameter. If I set them something/1 (e.g. 60/1), the calculated bitrate is correct. However, if I set it to 60000/1000, it seems that the denumerator is not taken into account, and the resulting bitrate is very low. For non-integer framerates (e.g. 59.94 → 60000/1001) this is required.
VUI insertion with H264
When I enable SPS/PPS and VUI insertion, the output elementary stream contains VUI timing information. Unfortunately no matter what framerate I set, I always get the same values:
num_units_in_tick : 1000
time_scale : 60000
VUI insertion with H265
SPS/PPS insertion also works with H265, but I have problems with VUI insertion.
The vui_parameters_present_flag is set to 1, but all VUI parameter flags (e.g. vui_timing_info_present_flag) are set to 0.
I checked L4T 32.1 on a TX2. There is definitely an improvement, but it seems to me that that VUI timing parameters are not absolutely correct, the resolution seems to be 0.25 frame/sec:
Also, the encoded file size (thus bitrate) only changes with the above resolution, e.g. the encoded file size is the same for 29000/1000 and 29100/1000 setting, so it seems that the effect is also present is the encoder’s bitrate calculation.
Frame rates below 1 (e.g. 500/1000) are handled incorrectly, the result is 30 FPS - both in VUI parameters and in file size.
Forgot to mention: the above is valid for H.264.
For H.265 I did not check VUI, but the file size issue is present, so I estimate that bitrate calculation is the same for both encoders.
I replaced libnvtvmr.so, does not seem to solve the issue.
Please try to run 01_video_encode:
video_encode bunny_i420.bin 1920 1080 H264 bunny.h264 --insert-aud --insert-spspps-idr --insert-vui -fps 29970 1000
In the resulting H.264 file I have:
num_units_in_tick : 4
time_scale : 238