rust-av / ssimulacra2_bin

Binary interface for the ssimulacra2 Rust port
BSD 2-Clause "Simplified" License
40 stars 10 forks source link

No way to pipe input? #25

Closed Orum closed 1 year ago

Orum commented 1 year ago

Attempting to pipe in Y4M video as one of the clips results in a crash with the following backtrace:

thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: "Invalid data found when processing input"', src/video.rs:62:51
stack backtrace:
   0: rust_begin_unwind
             at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/std/src/panicking.rs:584:5
   1: core::panicking::panic_fmt
             at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/core/src/panicking.rs:142:14
   2: core::result::unwrap_failed
             at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/core/src/result.rs:1814:5
   3: ssimulacra2_rs::video::compare_videos
   4: ssimulacra2_rs::main
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

As a side note, it would be nice if we could use - instead of /dev/stdin to pipe input in.

Orum commented 1 year ago

Oops, my mistake. This was not actually being fed Y4M and instead accidentally fed raw YUV with no header.

That said it still would be nice to have - aliased to stdin.

Orum commented 1 year ago

Well, it looks like it is no longer possible to pipe in input in 0.4.0. My best guess is that this is due to the change from av-metrics-decoders-0.1.10 to av-metrics-decoders-0.2.2, as the former appears to be limited to using strictly ffmpeg, while the latter appears to support vapoursynth.

There appears to be no way to bypass vapoursynth, even when the input file is /dev/stdin or even a named pipe ending in .y4m.

Backtrace during attempts, with either piping directly from stdin via vvdecapp -b "foo.266" --y4m -o - | RUST_BACKTRACE=1 ssimulacra2_rs video -v --src-full-range --dst-full-range src.mkv /dev/stdin, or using a mkfifo pipe with ssimulacra2_rs video -v --src-full-range --dst-full-range src.mkv foo.y4m

thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Os { code: 2, kind: NotFound, message: "No such file or directory" }', ~/.cargo/registry/src/github.com-1ecc6299db9ec823/av-metrics-decoders-0.2.2/src/vapoursynth.rs:36:18
stack backtrace:
   0: rust_begin_unwind
             at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/std/src/panicking.rs:584:5
   1: core::panicking::panic_fmt
             at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/core/src/panicking.rs:142:14
   2: core::result::unwrap_failed
             at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/core/src/result.rs:1814:5
   3: av_metrics_decoders::vapoursynth::VapoursynthDecoder::new_from_video
   4: ssimulacra2_rs::video::compare_videos
   5: ssimulacra2_rs::main
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
Orum commented 1 year ago

Appears to be working again in 0.4.1. Thank you Soichiro.