x86_64-pc-linux-gnu-gcc -Wall -DNDEBUG -fno-strict-aliasing -pipe -O3 -fPIC -O3 -march=native -pipe -fvisibility=hidden -pthread -fdiagnostics-color=always -I/usr/include/python3.12 '-DCALIBRE_MODINIT_FUNC= __attribute__ ((visibility ("default"))) PyObject*' -std=c99 -I/usr/include -c /var/tmp/portage/app-text/calibre-7.20.0/work/calibre-7.20.0/src/calibre/utils/ffmpeg.c -o /var/tmp/portage/app-text/calibre-7.20.0/work/calibre-7.20.0/build/objects/ffmpeg/ffmpeg.o /var/tmp/portage/app-text/calibre-7.20.0/work/calibre-7.20.0/src/calibre/utils/ffmpeg.c: In function ‘open_output_file’: /var/tmp/portage/app-text/calibre-7.20.0/work/calibre-7.20.0/src/calibre/utils/ffmpeg.c:240:5: error: implicit declaration of function ‘av_channel_layout_default’ [-Wimplicit-function-declaration] 240 | av_channel_layout_default(&t->enc_ctx->ch_layout, t->dec_ctx->ch_layout.nb_channels); | ^~~~~~~~~~~~~~~~~~~~~~~~~ /var/tmp/portage/app-text/calibre-7.20.0/work/calibre-7.20.0/src/calibre/utils/ffmpeg.c:240:44: error: ‘AVCodecContext’ has no member named ‘ch_layout’; did you mean ‘channel_layout’? 240 | av_channel_layout_default(&t->enc_ctx->ch_layout, t->dec_ctx->ch_layout.nb_channels); | ^~~~~~~~~ | channel_layout /var/tmp/portage/app-text/calibre-7.20.0/work/calibre-7.20.0/src/calibre/utils/ffmpeg.c:240:67: error: ‘AVCodecContext’ has no member named ‘ch_layout’; did you mean ‘channel_layout’? 240 | av_channel_layout_default(&t->enc_ctx->ch_layout, t->dec_ctx->ch_layout.nb_channels); | ^~~~~~~~~ | channel_layout /var/tmp/portage/app-text/calibre-7.20.0/work/calibre-7.20.0/src/calibre/utils/ffmpeg.c:250:52: error: ‘AVCodecContext’ has no member named ‘ch_layout’; did you mean ‘channel_layout’? 250 | t->enc_ctx->bit_rate *= 1000 * t->enc_ctx->ch_layout.nb_channels; | ^~~~~~~~~ | channel_layout Reproducible: Always
There's an API change from 4.4 to 6.1, for e.g. uint64_t AVCodecContext::channel_layout https://ffmpeg.org/doxygen/4.4/structAVCodecContext.html#aeb08c575a79eb84fc4155dda88f46c06 AVChannelLayout AVCodecContext::ch_layout https://ffmpeg.org/doxygen/6.1/structAVCodecContext.html#a167ff73c67960acf2d5ca73d93e13f64 It affects this file https://github.com/kovidgoyal/calibre/compare/v7.19.0...v7.20.0?diff=unified&w=#diff-78f1edc2aa94c6223487b788d9615655af2caf1a57f3ac83ef4c89f2b25018ef But the rest of the release also has a lot of ffmpeg dependant stuff. Either there's a patch for backwards compatibility or the minimum version of ffmpeg needs to be bumped. Full diff here https://github.com/kovidgoyal/calibre/compare/v7.19.0...v7.20.0?diff=unified&w=
Bumping the minimal version of ffmpeg would be highly inconvenient since vlc[vaapi] still requires ffmpeg-4.
Hi Kovid, I'm not sure what to think about this bug report. Rather, I'm not sure what you'd think about it. :D From an upstream perspective what's your thought on maintaining support for old ffmpeg? I think the only real rationale for still using it is just about vlc, honestly -- and that's not actually your problem. But I'd be happy to backport a patch adding support for installing vlc and calibre with the same ffmpeg version, if you commit/merge one. I'm also happy to just require a minimum version of ffmpeg.
I am not all keen to maintain a patch in calibre for old ffmpeg versions. It might be acceptable if the patch is very small/trivial. But going forward if I add more ffmpeg code I am certainly not going to be writing code that works with two year old ffmpeg. How are you building Qt Multimedia am fairly sure that needs ffmpeg 6 as well? At least as per the Qt docs it does.
Well, for qtmultimedia it is a USE flag so possible to disable ffmpeg support. It does successfully compile with ffmpeg 4 though (haven't checked whether it works at runtime). I just tried manually downgrading ffmpeg and rebuilding qtmultimedia inside a test chroot purely to see if it works. I don't see any mention of a version number at https://doc.qt.io/qt-6/qtmultimedia-building-from-source.html and https://github.com/qt/qtmultimedia/blob/dev/src/plugins/multimedia/ffmpeg/qffmpegdefs_p.h does appear to collect version guards dating back to ffmpeg 4.3, so that's interesting.
Removing from the c99-porting tracker. It fails with ffmpeg 4 as expected regardless of GCC version: x86_64-pc-linux-gnu-gcc -Wall -DNDEBUG -fno-strict-aliasing -pipe -O3 -fPIC -pipe -march=native -fstack-protector-all -O2 -fdiagnostics-color=always -frecord-gcc-switches -flto=4 -Werror=odr -Werror=lto-type-mismatch -Werror=strict-aliasing -Wformat -Werror=format-security -fvisibility=hidden -pthread -fdiagnostics-color=always -I/usr/include/python3.12 '-DCALIBRE_MODINIT_FUNC= __attribute__ ((visibility ("default"))) PyObject*' -std=c99 -I/usr/include -c /var/tmp/portage/app-text/calibre-7.20.0/work/calibre-7.20.0/src/calibre/utils/ffmpeg.c -o /var/tmp/portage/app-text/calibre-7.20.0/work/calibre-7.20.0/build/objects/ffmpeg/ffmpeg.o /var/tmp/portage/app-text/calibre-7.20.0/work/calibre-7.20.0/src/calibre/utils/ffmpeg.c: In function ‘open_output_file’: /var/tmp/portage/app-text/calibre-7.20.0/work/calibre-7.20.0/src/calibre/utils/ffmpeg.c:240:5: warning: implicit declaration of function ‘av_channel_layout_default’ [-Wimplicit-function-declaration] 240 | av_channel_layout_default(&t->enc_ctx->ch_layout, t->dec_ctx->ch_layout.nb_channels); | ^~~~~~~~~~~~~~~~~~~~~~~~~ /var/tmp/portage/app-text/calibre-7.20.0/work/calibre-7.20.0/src/calibre/utils/ffmpeg.c:240:44: error: ‘AVCodecContext’ has no member named ‘ch_layout’; did you mean ‘channel_layout’? 240 | av_channel_layout_default(&t->enc_ctx->ch_layout, t->dec_ctx->ch_layout.nb_channels); | ^~~~~~~~~ | channel_layout /var/tmp/portage/app-text/calibre-7.20.0/work/calibre-7.20.0/src/calibre/utils/ffmpeg.c:240:67: error: ‘AVCodecContext’ has no member named ‘ch_layout’; did you mean ‘channel_layout’? 240 | av_channel_layout_default(&t->enc_ctx->ch_layout, t->dec_ctx->ch_layout.nb_channels); | ^~~~~~~~~ | channel_layout /var/tmp/portage/app-text/calibre-7.20.0/work/calibre-7.20.0/src/calibre/utils/ffmpeg.c:250:52: error: ‘AVCodecContext’ has no member named ‘ch_layout’; did you mean ‘channel_layout’? 250 | t->enc_ctx->bit_rate *= 1000 * t->enc_ctx->ch_layout.nb_channels; | ^~~~~~~~~ | channel_layout /var/tmp/portage/app-text/calibre-7.20.0/work/calibre-7.20.0/src/calibre/utils/ffmpeg.c: In function ‘read_decode_convert_and_store’: /var/tmp/portage/app-text/calibre-7.20.0/work/calibre-7.20.0/src/calibre/utils/ffmpeg.c:314:61: error: ‘AVCodecContext’ has no member named ‘ch_layout’; did you mean ‘channel_layout’? 314 | &converted_input_samples, NULL, t->enc_ctx->ch_layout.nb_channels, | ^~~~~~~~~ | channel_layout /var/tmp/portage/app-text/calibre-7.20.0/work/calibre-7.20.0/src/calibre/utils/ffmpeg.c: In function ‘load_encode_and_write’: /var/tmp/portage/app-text/calibre-7.20.0/work/calibre-7.20.0/src/calibre/utils/ffmpeg.c:380:5: warning: implicit declaration of function ‘av_channel_layout_copy’ [-Wimplicit-function-declaration] 380 | av_channel_layout_copy(&output_frame->ch_layout, &output_codec_context->ch_layout); | ^~~~~~~~~~~~~~~~~~~~~~ /var/tmp/portage/app-text/calibre-7.20.0/work/calibre-7.20.0/src/calibre/utils/ffmpeg.c:380:43: error: ‘AVFrame’ has no member named ‘ch_layout’; did you mean ‘channel_layout’? 380 | av_channel_layout_copy(&output_frame->ch_layout, &output_codec_context->ch_layout); | ^~~~~~~~~ | channel_layout /var/tmp/portage/app-text/calibre-7.20.0/work/calibre-7.20.0/src/calibre/utils/ffmpeg.c:380:77: error: ‘AVCodecContext’ has no member named ‘ch_layout’; did you mean ‘channel_layout’? 380 | av_channel_layout_copy(&output_frame->ch_layout, &output_codec_context->ch_layout); | ^~~~~~~~~ | channel_layout /var/tmp/portage/app-text/calibre-7.20.0/work/calibre-7.20.0/src/calibre/utils/ffmpeg.c: In function ‘transcode_single_audio_stream’: /var/tmp/portage/app-text/calibre-7.20.0/work/calibre-7.20.0/src/calibre/utils/ffmpeg.c:451:74: error: ‘AVCodecContext’ has no member named ‘ch_layout’; did you mean ‘channel_layout’? 451 | if (!(t.fifo = av_audio_fifo_alloc(t.enc_ctx->sample_fmt, t.enc_ctx->ch_layout.nb_channels, 1))) { | ^~~~~~~~~ | channel_layout /var/tmp/portage/app-text/calibre-7.20.0/work/calibre-7.20.0/src/calibre/utils/ffmpeg.c:455:16: warning: implicit declaration of function ‘swr_alloc_set_opts2’; did you mean ‘swr_alloc_set_opts’? [-Wimplicit-function-declaration] 455 | if ((ret = swr_alloc_set_opts2(&t.resample_ctx, | ^~~~~~~~~~~~~~~~~~~ | swr_alloc_set_opts /var/tmp/portage/app-text/calibre-7.20.0/work/calibre-7.20.0/src/calibre/utils/ffmpeg.c:456:21: error: ‘AVCodecContext’ has no member named ‘ch_layout’; did you mean ‘channel_layout’? 456 | &t.enc_ctx->ch_layout, t.enc_ctx->sample_fmt, t.enc_ctx->sample_rate, | ^~~~~~~~~ | channel_layout /var/tmp/portage/app-text/calibre-7.20.0/work/calibre-7.20.0/src/calibre/utils/ffmpeg.c:457:21: error: ‘AVCodecContext’ has no member named ‘ch_layout’; did you mean ‘channel_layout’? 457 | &t.dec_ctx->ch_layout, t.dec_ctx->sample_fmt, t.dec_ctx->sample_rate, | ^~~~~~~~~ | channel_layout /var/tmp/portage/app-text/calibre-7.20.0/work/calibre-7.20.0/src/calibre/utils/ffmpeg.c: In function ‘resample_raw_audio_16bit’: /var/tmp/portage/app-text/calibre-7.20.0/work/calibre-7.20.0/src/calibre/utils/ffmpeg.c:486:5: error: unknown type name ‘AVChannelLayout’ 486 | AVChannelLayout input_layout = {0}, output_layout = {0}; | ^~~~~~~~~~~~~~~ * ERROR: app-text/calibre-7.20.0::gentoo failed (compile phase):
IIRC Qt only officially supports the version of ffmpeg it is tested against, which currently is ffmpeg 7. https://doc.qt.io/qt-6/qtmultimedia-index.html#the-ffmpeg-backend
Ah well, "officially supports" is such an open-ended term when something is unofficially supported and compat is worked on. :) (Gentoo's default ffmpeg version is 6 until someone works through the porting blockers for packages that fail to build with 7.) Anyways, point being: it is definitely possible to have had ffmpeg 4 installed with calibre's qt stack e.g. multimedia, which means we do need to enforce it for calibre. So I'm going to add a version constraint shortly.
Regarding vlc[vaapi], I can't find the source now, but I read that even if you disable VA-API in VLC, if ffmpeg is VA-API-enabled, VLC will take advantage of that through ffmpeg, so it may not be a major issue. I for one moved to ffmpeg-6 with vlc[-vaapi].
The bug has been closed via the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=4d233cdbc9254cff6eaa7598ab93a2beae663218 commit 4d233cdbc9254cff6eaa7598ab93a2beae663218 Author: Eli Schwartz <eschwartz@gentoo.org> AuthorDate: 2024-10-22 18:15:27 +0000 Commit: Eli Schwartz <eschwartz@gentoo.org> CommitDate: 2024-10-27 16:12:23 +0000 app-text/calibre: require minimum ffmpeg version It simply fails to compile, with lower versions of ffmpeg. No revbump, anyone successfully building doesn't need to recompile as it will be slotted. The alternative here is to add ifdef'ed support for ffmpeg 4 to upstream. And upstream is unenthusiastic about this, for which I don't blame him. Sorry to all the VLC users I guess... maybe you can finally learn to love mpv? Closes: https://bugs.gentoo.org/941926 Signed-off-by: Eli Schwartz <eschwartz@gentoo.org> app-text/calibre/calibre-7.20.0.ebuild | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)