Nvv4l2h265enc encoder latency discrepancies with streaming and file-based transcoding use-cases

Hi,

I am trying to measure the encoder latencies with streaming and file based transcoding use-cases and observed that nvv4l2h265enc encoder latency is ~13 msec with streaming pipeline and `~48msec with file-based pipeline.

I am using below pipelines.
Streaming pipeline:
GST_DEBUG=“GST_TRACER:7” GST_TRACERS=“interlatency” GST_DEBUG_FILE=udpsrc_nvv4l2decoder_nvv4l2h265enc_pl4_fakesink.log
gst-launch-1.0 udpsrc port=50000 buffer-size=2000000 caps=“application/x-rtp , media=video, clock-rate=90000, payload=96, encoding-name=H264”
! rtpjitterbuffer
! rtph264depay
! nvv4l2decoder enable-max-performance=1 disable-dpb=true
! nvv4l2h265enc preset-level=4 MeasureEncoderLatency=1 maxperf-enable=1
! fakesink

File-based pipeline:
gst-launch-1.0 filesrc location=AIR_1080p30_nv12.h264
! h264parse
! nvv4l2decoder enable-max-performance=1 disable-dpb=true
! nvv4l2h265enc preset-level=1 MeasureEncoderLatency=1 maxperf-enable=1
! fakesink

I have attached the log files for latencies.
What could be the reason for latency discrepancy ?

NOTE: I am seeing same latency numbers with streaming and file based, if I use preset-level=1.

Thanks for your help.

Best Regards,
Damoder

filesrc_nvv4l2decoder_nvv4l2h265enc_pl4_fakesink_MeasureEncoderLatency.log (17.4 KB)
udpsrc_nvv4l2decoder_nvv4l2h265enc_pl4_fakesink_MeasureEncoderLatency.log (125.6 KB)

Hi,
It looks like the udp source does not provide h264 stream with continuous timestamps:

KPI: v4l2: frameNumber= 0 encoder= 51 ms pts= 18856431817

KPI: v4l2: frameNumber= 5 encoder= 57 ms pts= 19022143528

KPI: v4l2: frameNumber= 4 encoder= 62 ms pts= 18989348901

KPI: v4l2: frameNumber= 6 encoder= 67 ms pts= 19054799425

KPI: v4l2: frameNumber= 7 encoder= 40 ms pts= 19087128983

See if you can launch the source with timestamps like:

KPI: v4l2: frameNumber= 0 encoder= 49 ms pts= 0

KPI: v4l2: frameNumber= 1 encoder= 56 ms pts= 33333333

KPI: v4l2: frameNumber= 2 encoder= 60 ms pts= 66666666

KPI: v4l2: frameNumber= 3 encoder= 62 ms pts= 99999999

KPI: v4l2: frameNumber= 4 encoder= 41 ms pts= 133333332

KPI: v4l2: frameNumber= 5 encoder= 40 ms pts= 166666665