PyNvVideoCodec_2.0.0 ThreadedDecoder ffmpeg general error after switching to a new video source

ffmpeg error occurs when I re-initialize the PyNvVideoCodec_2.0.0 ThreadedDecoder with a new video source, by using
reconfigure_decoder.

import PyNvVideoCodec as nvc

decoder = nvc.ThreadedDecoder(
    video_path,
    buffer_size=32,
    use_device_memory=True,
    max_width=3840,
    max_height=2160,
    output_color_type=nvc.OutputColorType.RGB,
)

for _ in range(64):
    frames = decoder.get_batch_frames(16)

decoder.reconfigure_decoder(another_video_path)

for _ in range(64):
    # error occurs here
    frames = decoder.get_batch_frames(16)
[ERROR][07:15:23] General error -1094995529 at line 739 in file .../PyNvVideoCodec_2.0.0/src/VideoCodecSDKUtils/helper_classes/Utils/FFmpegDemuxer.h

Error code 1094995529 means INDA which means invalid data (ref). However it’s certainly not a problem of the video file itself, because it always happen even if I change the order of videos. Whether I decode video A first and then B or decode B and then A, the same error occurs after switching to the new source.

I also confirmed Invalid NAL unit size warning shows up when I set the log level to TRACE.

[h264 @ 0x2cb5e080] Invalid NAL unit size (-1009653786 > 2889).
[h264 @ 0x2cb5e080] missing picture in access unit with size 2893

cuda info:

+-----------------------------------------------------------------------------------------+
| NVIDIA-SMI 565.57.01              Driver Version: 565.57.01      CUDA Version: 12.7     |
|-----------------------------------------+------------------------+----------------------+
| GPU  Name                 Persistence-M | Bus-Id          Disp.A | Volatile Uncorr. ECC |
| Fan  Temp   Perf          Pwr:Usage/Cap |           Memory-Usage | GPU-Util  Compute M. |
|                                         |                        |               MIG M. |
|=========================================+========================+======================|
|   0  NVIDIA L40S                    On  |   00000002:00:01.0 Off |                    0 |
| N/A   16C    P8             31W /  350W |       1MiB /  46068MiB |      0%      Default |
|                                         |                        |                  N/A |
+-----------------------------------------+------------------------+----------------------+

Hi hanch, can you confirm that the both the files were h264 (original as well as reconfigured), since we cannot reproduce this problem at our end, would it be possible for you to share us both the files. Thanks

Hi @hanch
Could you confirm that the both the files were h264 (original as well as reconfigured), since we cannot reproduce this problem at our end, would it be possible for you to share us both the files.