-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fallback for undecodable frames #5
Comments
A CPU decode option is indeed planned (things live AV1 hardware decode require very recent hardware, rtx 3000+). After seeing a problem like this, I'll start working on it asap. The problem seems to come from the scheduling of frames to be decoded (a frame was scheduled to be decoded in an occupied dpb slot). This scheduling is managed by the Cuvid bitstream parser as I don't parse it myself currently. Maybe I don't allocate a big enough dpb ? (I allocate a bit more than necessary). Maybe there is a bug in Cuvid (less probable) or in the way I handle things (more probable) ? Heck, maybe there is a problem with the bitstream and mpv is able to fix it during playback. Anyway, to debug this further it would be nice if you could send me bits of video that have this problem (my email is in this repo, or through discord). If possible, cut a only a small part (without reencoding). I can understand if you don't want to share the video though. I don't know about your mpv configuration so it might not even use nvdec to decode. About ffmpeg, I think there are 2 decoders using nvdec, one is based on the cuvid parser like I do (h264_cuvid iirc) and another is parsing the bitstream and filling the necessary structures itself and is making calls to nvdec directly (h264_nvdec iirc). That last one might not suffer from the same problems. |
The described bug is fixed by b87f8cd. For reference, now I do not feed many nalus at once to cuvid because that was cuasing it to possibly fire many decode callbacks at once, exhausting the dpb. I'll keep this issue open so I can remember to add a libavcodec fallback. |
I've been testing turbo-metrics for the past few days and I noticed an error when using certain specific files.
The error log is the following:
This happens consistently for those specific video frames. For each one of them, the reported frame "still in decode queue" is always the same (2nd, 3rd, 4th, 5th frame, depending on the video) on every execution.
Although certain software (e.g. mpv) seem to play correctly those videos using hardware acceleration, I have noticed that ffplay with hardware acceleration enabled keeps stuttering on those specific videos. (Repeating a previous frame sporadically instead of decoding the correct one.) So this seems to be an issue with nvdec and specific videos. What do those videos have to cause the issues, and how those mpv fix it? I do not know.
I have tested the files using 2 different GPUs, both with CUDA 12.6, and it happens consistently.
Since this seems to be an issue with the specific video files and nvdec, I do not know if there is something to fix in turbo-metrics. However, maybe a fallback could be implemented, to skip the specific failing frames, or to use CPU decoding, instead of panicking?
The text was updated successfully, but these errors were encountered: