zmwangx / rust-ffmpeg

Safe FFmpeg wrapper.
Do What The F*ck You Want To Public License
1.2k stars 195 forks source link

Fixes the transcoding example to work with ffmpeg 7 #187

Closed stuglaser closed 1 month ago

stuglaser commented 1 month ago

This PR fixes the transcode-x264 example to work, fixing the issues in #118. I've fixed:

  1. We now initialize the encoder context from the codec.
  2. The input time_base now comes from the stream instead of the decoder (decoder.time_base has been deprecated in ffmpeg since 2.5).
  3. Uses the previously constructed encoder instead of recreating it unnecessarily.

I've tested this example on ffmpeg 6.6.1 (ubuntu 24.04), ffmpeg 4.4.2 (Ubuntu 22.04), ffmpeg 4.2.7 (Ubuntu 20.04), and ffmpeg 3.4.13.

Polochon-street commented 1 month ago

I'm wondering, does it also work with previous versions of ffmpeg?

stuglaser commented 1 month ago

Yes, I tested that the example can transcode videos, back to ffmpeg 3.4.13 (by running the example inside the jrottenberg container). I saw that that's the earliest version you're checking for in CI, but do you typically check back further?

Polochon-street commented 1 month ago

that's perfect, I just remembered that the CI checked for past versions, so I'll just merge this now.

Thanks a lot!