Skip to content

ffmpeg 7 -> 8 #812

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

Merged
merged 1 commit into from
Aug 23, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions ae.nimble
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,8 @@ let x265 = Package(
)
let ffmpeg = Package(
name: "ffmpeg",
sourceUrl: "https://ffmpeg.org/releases/ffmpeg-7.1.1.tar.xz",
sha256: "733984395e0dbbe5c046abda2dc49a5544e7e0e1e2366bba849222ae9e3a03b1",
sourceUrl: "https://ffmpeg.org/releases/ffmpeg-8.0.tar.xz",
sha256: "b2751fccb6cc4c77708113cd78b561059b6fa904b24162fa0be2d60273d27b8e",
)
var packages: seq[Package] = @[]
if not defined(macosx):
Expand Down
51 changes: 9 additions & 42 deletions patches/ffmpeg.patch
Original file line number Diff line number Diff line change
@@ -1,40 +1,8 @@
From d1ed5c06e3edc5f2b5f3664c80121fa55b0baa95 Mon Sep 17 00:00:00 2001
From: Gyan Doshi <[email protected]>
Date: Sat, 22 Feb 2025 10:38:53 +0530
Subject: [PATCH] avcodec/libsvtav1: unbreak build with latest svtav1

SVT-AV1 made a change in their public API in 988e930c but without a
version bump or any other accessible marker, thus breaking ffmpeg build
with current versions of SVT-AV1.

They have finally bumped versions a month later, so check added.
---
libavcodec/libsvtav1.c | 4 ++++
1 file changed, 4 insertions(+)

diff --git a/libavcodec/libsvtav1.c b/libavcodec/libsvtav1.c
index 79b28eb4df54681a43bd4e8164784df84378e386..43fe531fde74dc058b63002cd704df5ef2c475f5 100644
--- a/libavcodec/libsvtav1.c
+++ b/libavcodec/libsvtav1.c
@@ -435,7 +435,11 @@ static av_cold int eb_enc_init(AVCodecContext *avctx)

svt_enc->eos_flag = EOS_NOT_REACHED;

+#if SVT_AV1_CHECK_VERSION(3, 0, 0)
+ svt_ret = svt_av1_enc_init_handle(&svt_enc->svt_handle, &svt_enc->enc_params);
+#else
svt_ret = svt_av1_enc_init_handle(&svt_enc->svt_handle, svt_enc, &svt_enc->enc_params);
+#endif
if (svt_ret != EB_ErrorNone) {
return svt_print_error(avctx, svt_ret, "Error initializing encoder handle");
}


diff --git a/configure b/configure
index 0609dac4ab..aa65218e15 100755
index 732de59292..136347a0d2 100755
--- a/configure
+++ b/configure
@@ -1884,8 +1884,6 @@ EXTERNAL_LIBRARY_GPL_LIST="
@@ -1886,8 +1886,6 @@ EXTERNAL_LIBRARY_GPL_LIST="
libdvdread
librubberband
libvidstab
Expand All @@ -43,13 +11,12 @@ index 0609dac4ab..aa65218e15 100755
libxavs
libxavs2
libxvid
@@ -1917,6 +1915,8 @@ EXTERNAL_LIBRARY_LIST="
$EXTERNAL_LIBRARY_NONFREE_LIST
$EXTERNAL_LIBRARY_VERSION3_LIST
$EXTERNAL_LIBRARY_GPLV3_LIST
@@ -1900,6 +1898,8 @@ EXTERNAL_LIBRARY_NONFREE_LIST="
"

EXTERNAL_LIBRARY_VERSION3_LIST="
+ libx264
+ libx265
chromaprint
gcrypt
gnutls

gmp
libaribb24
liblensfun
6 changes: 4 additions & 2 deletions src/av.nim
Original file line number Diff line number Diff line change
Expand Up @@ -369,8 +369,10 @@ proc open*(ctx: ptr AVCodecContext) =
ctx.time_base = AVRational(num: 1, den: ctx.sample_rate)
else:
ctx.time_base = AVRational(num: 1, den: AV_TIME_BASE)
if avcodec_open2(ctx, ctx.codec, nil) < 0:
error "Could not open encoder"
let ret = avcodec_open2(ctx, ctx.codec, nil)
if ret < 0:
let codecName = if ctx.codec != nil and ctx.codec.name != nil: $ctx.codec.name else: "unknown"
error &"Could not open encoder '{codecName}': {av_err2str(ret)}"

proc setProfileOrErr*(ctx: ptr AVCodecContext, to: string) =
if ctx.codec == nil:
Expand Down
Loading