Jetson Orin NX R35.3.1: `nvv4l2h264enc` assigns incorrect PTS to B-frames with irregular input timestamps

Disclosure: Drafted with AI assistance (ChatGPT). Reproduction and output comparisons were verified on actual hardware.

Environment: Jetson Orin NX, Jetson Linux R35.3.1, GStreamer 1.16.3.

Reproduction:

ffmpeg -y -f lavfi \
  -i 'testsrc2=size=320x240:rate=30:duration=4' \
  -vf "select='not(eq(mod(n,7),0))',setpts=PTS-STARTPTS" \
  -vsync vfr -c:v libx264 -bf 0 -pix_fmt yuv420p \
  /tmp/source.mp4

gst-launch-1.0 -q -e \
  filesrc location=/tmp/source.mp4 ! qtdemux ! \
  h264parse ! avdec_h264 ! videoconvert ! \
  'video/x-raw,format=I420' ! nvvidconv ! \
  'video/x-raw(memory:NVMM),format=NV12' ! \
  nvv4l2h264enc profile=4 num-B-Frames=1 \
    num-Ref-Frames=2 iframeinterval=31 ! \
  h264parse ! qtmux ! filesink location=/tmp/output.mp4

for f in /tmp/source.mp4 /tmp/output.mp4; do
  echo "$f"
  ffprobe -v error -select_streams v:0 \
    -show_entries frame=best_effort_timestamp_time \
    -of csv=p=0 "$f"
done

Observed: Both videos contain 102 decoded frames, but 17 presentation timestamps differ at corresponding picture indices. The output also contains two duplicate timestamps, while the source contains none.

Direct GStreamer probes showed the timestamp association problem before the MP4 muxer. The decoded picture order itself is preserved.

Expected: Encoded packets retain the correct source-picture PTS despite gaps in input timestamps.

Question: Does the timestamp fix previously reported for DeepStream 7.1 apply to Jetson GStreamer? Which release addresses this behavior?

Related report: Nvv4l2h264enc returns frames in wrong order when PTS doesn't align with framerate

Hi,
Please upgrade ad suggested in
Jetson Orin NX R35.3.1: Official `video_encode` sample crashes when using `V4L2_ENC_CMD_STOP` - #4 by DaneLLL