Skip to content

Fallback for undecodable frames #5

@0xb01u

Description

@0xb01u

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:

Using device NVIDIA GeForce RTX 4060 with CUDA version 12060
[crates/turbo-metrics/src/lib.rs:254:14] demuxer_dis.clock_rate() = 1000000
Reference: H.264/AVC   , 1920x1080, CP: BT709, MC: BT709, TC: BT709, CR: Limited
Distorted: H.264/AVC     , 1920x1080, CP: BT709, MC: BT709, TC: BT709, CR: Limited
Initializing SSIMULACRA2
Initialized, now processing ...
thread 'main' panicked at crates/cudarse/cudarse-video/src/dec_simple.rs:177:17:
decode 2 : still in decode queue
stack backtrace:
   0: rust_begin_unwind
             at /rustc/3f5fd8dd41153bc5fdca9427e9e05be2c767ba23/library/std/src/panicking.rs:652:5
   1: core::panicking::panic_fmt
             at /rustc/3f5fd8dd41153bc5fdca9427e9e05be2c767ba23/library/core/src/panicking.rs:72:14
   2: cudarse_video::dec::decode_picture
             at /home/user/turbo-metrics/crates/cudarse/cudarse-video/src/dec_simple.rs:177:17
   3: <unknown>
   4: <unknown>
   5: <unknown>
   6: <unknown>
   7: <turbo_metrics::input_video::MkvDemuxer as turbo_metrics::input_video::Demuxer>::demux
             at /home/user/turbo-metrics/crates/cudarse/cudarse-video/src/dec.rs:160:18
   8: turbo_metrics::process_video_pair
             at /home/user/turbo-metrics/crates/turbo-metrics/src/input_video.rs:134:9
   9: turbo_metrics::main
             at /home/user/turbo-metrics/crates/turbo-metrics-cli/src/main.rs:160:38

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions