gifski icon indicating copy to clipboard operation
gifski copied to clipboard

Not compatible with ffmpeg 5

Open xsbee opened this issue 2 years ago • 3 comments

On ArchLinux, with cargo install gifski --features=video, rustc complains the following

error[E0599]: no method named `codec` found for struct `Stream` in the current scope
  --> /home/sb/.cargo/registry/src/github.com-1ecc6299db9ec823/gifski-1.6.6/src/bin/ffmpeg_source.rs:48:34
   |
48 |             let decoder = stream.codec().decoder().video().map_err(|e| format!("Unable to decode the codec used in the video: {}", e))?;
   |                                  ^^^^^ method not found in `Stream<'_>`

For more information about this error, try `rustc --explain E0599`.
error: failed to compile `gifski v1.6.6`, intermediate artifacts can be found at `/tmp/cargo-installuQxfHf`

Caused by:
  could not compile `gifski` due to previous error

But apparently that method does exist.

xsbee avatar Apr 19 '22 07:04 xsbee

Stream::codec in ffmpeg-next is #[cfg(not(feature = "ffmpeg_5_0"))] [link]; I think https://github.com/zmwangx/rust-ffmpeg/commit/22ad8b959879efa028c33f71cc286b519eae8066 is to blame.

ffmpeg on my system is 4.4.1, so I can build gifski if I downgrade ffmpeg-next:

diff --git a/Cargo.toml b/Cargo.toml
index 7744e78..3a6dd2d 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -43,7 +43,7 @@ loop9 = "0.1.3"
 
 [dependencies.ffmpeg]
 package = "ffmpeg-next"
-version = ">= 4.4.0, <6"
+version = ">= 4.4.0, <5"
 optional = true
 default-features = false
 features = ["codec", "format", "filter", "software-resampling", "software-scaling"]

But I'm not sure if it'll work on distributions with ffmpeg 5.* and up.

To clarify: gifski uses deprecated APIs, and ffmpeg-next v5.* is a breaking change that removes them, so the <6 part of the version spec is invalid.

interruptinuse avatar Apr 27 '22 11:04 interruptinuse

Perhaps this issue should be renamed to "Make gifski compatible with ffmpeg 5.x"

leoherzog avatar Jul 11 '22 15:07 leoherzog

It is still impossible to compile Gifski with video support on current versions of Fedora (and other distros, I assume), and will continue to get more and more obsolete as more distros update to ffmpeg 5 and above.

$ cargo install gifski --features=video
    Updating crates.io index
  Installing gifski v1.7.2
error: failed to compile `gifski v1.7.2`, intermediate artifacts can be found at `/tmp/cargo-install6eHiMe`

Caused by:
  none of the selected packages contains these features: video

leoherzog avatar Aug 30 '22 13:08 leoherzog

Is there any thoughts on supporting ffmpeg 5? @kornelski

orhun avatar Dec 08 '22 19:12 orhun

I don't have time to implement this. Contributions welcome.

kornelski avatar Dec 08 '22 19:12 kornelski