Bug 453840 - digiKam git build error with ffmpeg 5
Summary: digiKam git build error with ffmpeg 5
Status: RESOLVED FIXED
Alias: None
Product: digikam
Classification: Applications
Component: Portability-Runtime (show other bugs)
Version: 8.0.0
Platform: Compiled Sources Linux
: NOR normal
Target Milestone: ---
Assignee: Digikam Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-05-15 17:15 UTC by maderios
Modified: 2022-10-13 10:41 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In: 8.0.0
Sentry Crash Report:


Attachments
.txt build error (113.51 KB, text/plain)
2022-05-15 17:15 UTC, maderios
Details
build .txt (178.42 KB, text/plain)
2022-05-15 18:27 UTC, maderios
Details
digikam-build-ffmpeg5-25-05-2022-1 (98.52 KB, text/plain)
2022-05-25 13:24 UTC, maderios
Details
build fail dk2505-3 (147.62 KB, text/plain)
2022-05-25 16:48 UTC, maderios
Details
video ffmpeg5 debug (16.03 KB, text/plain)
2022-05-26 14:59 UTC, maderios
Details

Note You need to log in before you can comment on or make changes to this bug.
Description maderios 2022-05-15 17:15:17 UTC
Created attachment 148860 [details]
.txt build error

Hi
I get build error
Conditions
Arch Linux system
Qt5 5.15.4 
KF5  5.94.0-1
gcc 12.1.0-1 
Cmake 3.23.1
See attachment file

[ 22%] Built target digikamdatabase_obj
[ 22%] [32mBuilding CXX object core/libs/widgets/CMakeFiles/core_digikamwidgets_obj.dir/layout/sidebar_dmultitabbartab.cpp.o[0m
[ 22%] [32mBuilding CXX object core/libs/widgets/CMakeFiles/core_digikamwidgets_obj.dir/layout/sidebar_dmultitabbarframe.cpp.o[0m
[ 22%] [32mBuilding CXX object core/libs/widgets/CMakeFiles/core_digikamwidgets_obj.dir/layout/sidebar_dmultitabbarbutton.cpp.o[0m
[ 22%] [32mBuilding CXX object core/libs/widgets/CMakeFiles/core_digikamwidgets_obj.dir/text/modelcompleter.cpp.o[0m
[ 22%] [32mBuilding CXX object core/libs/widgets/CMakeFiles/core_digikamwidgets_obj.dir/text/searchtextbar.cpp.o[0m
[ 22%] Built target core_digikamwidgets_obj
make: *** [Makefile:136: all] Error 2
Comment 1 Maik Qualmann 2022-05-15 17:46:07 UTC
/home/fre/ARCH-AUR/digikam-light-git/src/digikam/core/libs/threadimageio/video/videothumbdecoder_p.cpp:93:49: error: invalid conversion from ‘const AVCodec*’ to ‘AVCodec*’ [-fpermissive]
   93 |     pVideoCodec           = avcodec_find_decoder(pVideoCodecParameters->codec_id);

Your FFmpeg version should be 4.3, here even with 4.4.1 there is no problem.

Maik
Comment 2 Maik Qualmann 2022-05-15 17:53:55 UTC
Git commit 9c82a5bb38a46023ecaf1db79c392730bd5347a4 by Maik Qualmann.
Committed on 15/05/2022 at 17:52.
Pushed by mqualmann into branch 'master'.

try to fix compile with FFmpeg from Arch linux

M  +1    -1    core/libs/threadimageio/video/videothumbdecoder_p.h

https://invent.kde.org/graphics/digikam/commit/9c82a5bb38a46023ecaf1db79c392730bd5347a4
Comment 3 maderios 2022-05-15 17:57:18 UTC
My ffmpeg is 5.0-7
https://archlinux.org/packages/extra/x86_64/ffmpeg/
Comment 4 Maik Qualmann 2022-05-15 18:02:56 UTC
FFmpeg 5 has API changes and is currently not compatible. It also affects QtAV, that won't work.

Maik
Comment 5 maderios 2022-05-15 18:27:28 UTC
Created attachment 148867 [details]
build .txt
Comment 6 maderios 2022-05-15 18:32:10 UTC
(In reply to Maik Qualmann from comment #4)
> FFmpeg 5 has API changes and is currently not compatible. It also affects
> QtAV, that won't work.
> 
> Maik

Bad news  :(  Waiting... :)
Thanks
Comment 7 Maik Qualmann 2022-05-15 18:35:28 UTC
FFmpeg 5 requires major adjustments, I hope Arch Linux still has 4.4.x available.

Maik
Comment 8 maderios 2022-05-15 18:45:57 UTC
I discover last time i built successfully Digikam git was on April 4 2022
At this date, ffmpeg 5.0-5 was already installed on my (updated) system
https://github.com/archlinux/svntogit-packages/commits/packages/ffmpeg/trunk
So, I think my build error doesn't come from ffmpeg 5
Comment 9 maderios 2022-05-15 18:52:15 UTC
I forgot to say ffmpeg4.4 is already installed on my system 
=> I have two installed ffmpeg on my system: 5 and 4
Comment 10 caulier.gilles 2022-05-15 19:58:54 UTC
I'm sure digiKam core (and now QtAV code hosted in digiKam) do not compile with ffmpeg 5. this is your problem...
Comment 11 maderios 2022-05-15 20:44:41 UTC
I remember now I used a ffmpeg5.patch, that's why i could build digikam git with ffmpeg 5 one month ago
I don't know if it works now 
https://aur.archlinux.org/cgit/aur.git/tree/ffmpeg5.patch?h=digikam-git
Comment 12 maderios 2022-05-16 18:08:10 UTC
Waiting ffmpeg 5 support, I compiled successfully digikam git with ffmpeg4.4
-DCMAKE_PREFIX_PATH="/usr/lib/ffmpeg4.4;/usr/include/ffmpeg4.4"
Comment 13 caulier.gilles 2022-05-24 13:32:30 UTC
Git commit 72d605a0d66cc59c923c7046ad60af61f1b0f21d by Gilles Caulier.
Committed on 24/05/2022 at 13:29.
Pushed by cgilles into branch 'master'.

Done. Full ffmpeg 5 support patch from QtAV issue https://github.com/wang-bin/QtAV/issues/1377#issuecomment-1014959481 is now applied on QtAv code integrated to digiKam core
Regression tests need to be done of course. There is no guaranty that new code work as expected.
Note: ffmpeg 4 code still here and unchanged.
Related: bug 448681

M  +52   -0    core/libs/video/qtav/src/codec/video/VideoDecoderFFmpegBase.cpp
M  +9    -0    core/libs/video/qtav/src/codec/video/VideoDecoderFFmpegHW.cpp
M  +14   -1    core/libs/video/qtav/src/codec/video/VideoDecoderVAAPI.cpp
M  +41   -3    core/libs/video/qtav/src/codec/video/VideoEncoderFFmpeg.cpp

https://invent.kde.org/graphics/digikam/commit/72d605a0d66cc59c923c7046ad60af61f1b0f21d
Comment 14 caulier.gilles 2022-05-24 13:42:52 UTC
Hi Maderios,

Please read well my explanations from this entry:

https://bugs.kde.org/show_bug.cgi?id=448681#c23

All help to stabilize ffmpeg 5 code support from digiKam QtAV fork will be very appreciate. This include patches but also regression tests wil video files.

Thanks in advance

Best

Gilles Caulier
Comment 15 maderios 2022-05-25 13:24:25 UTC
Created attachment 149207 [details]
digikam-build-ffmpeg5-25-05-2022-1
Comment 16 maderios 2022-05-25 13:25:20 UTC
Build error, see attachment file
[ 23%] [32mBuilding CXX object core/libs/widgets/CMakeFiles/core_digikamwidgets_obj.dir/layout/sidebar_splitter.cpp.o[0m
[ 23%] [32mBuilding CXX object core/libs/widgets/CMakeFiles/core_digikamwidgets_obj.dir/layout/sidebar_dmultitabbar.cpp.o[0m
[ 23%] [32mBuilding CXX object core/libs/widgets/CMakeFiles/core_digikamwidgets_obj.dir/layout/sidebar_dmultitabbartab.cpp.o[0m
[ 23%] [32mBuilding CXX object core/libs/widgets/CMakeFiles/core_digikamwidgets_obj.dir/layout/sidebar_dmultitabbarframe.cpp.o[0m
[ 23%] [32mBuilding CXX object core/libs/widgets/CMakeFiles/core_digikamwidgets_obj.dir/layout/sidebar_dmultitabbarbutton.cpp.o[0m
[ 23%] [32mBuilding CXX object core/libs/widgets/CMakeFiles/core_digikamwidgets_obj.dir/text/modelcompleter.cpp.o[0m
[ 23%] [32mBuilding CXX object core/libs/widgets/CMakeFiles/core_digikamwidgets_obj.dir/text/searchtextbar.cpp.o[0m
[ 23%] Built target core_digikamwidgets_obj
make: *** [Makefile:136: all] Error 2
Comment 17 caulier.gilles 2022-05-25 13:26:31 UTC
yes fully reproducible here. Fixes will arrive, be patient...

Gilles
Comment 18 caulier.gilles 2022-05-25 15:54:56 UTC
Git commit 38f50070ee40531f190f34b1c8bc9be4c8c728ec by Gilles Caulier.
Committed on 25/05/2022 at 15:44.
Pushed by cgilles into branch 'master'.

FFMPEG5 port++
Related: bug 448681

M  +10   -0    core/libs/threadimageio/video/videothumbdecoder_p.h

https://invent.kde.org/graphics/digikam/commit/38f50070ee40531f190f34b1c8bc9be4c8c728ec
Comment 19 maderios 2022-05-25 16:48:37 UTC
Created attachment 149214 [details]
build fail dk2505-3

Build fail, see new attachment file 

[ 37%] Built target gui_digikamalbum_obj
[ 37%] [32mBuilding CXX object core/utilities/advancedrename/CMakeFiles/gui_advancedrename_obj.dir/parser/options/database/dbheaderlistitem.cpp.o[0m
[ 37%] [32mBuilding CXX object core/utilities/advancedrename/CMakeFiles/gui_advancedrename_obj.dir/parser/options/database/dbkeyscollection.cpp.o[0m
[ 37%] [32mBuilding CXX object core/utilities/advancedrename/CMakeFiles/gui_advancedrename_obj.dir/parser/options/database/dbkeyselector.cpp.o[0m
[ 38%] [32mBuilding CXX object core/utilities/advancedrename/CMakeFiles/gui_advancedrename_obj.dir/parser/options/database/keys/commonkeys.cpp.o[0m
[ 38%] [32mBuilding CXX object core/utilities/advancedrename/CMakeFiles/gui_advancedrename_obj.dir/parser/options/database/keys/metadatakeys.cpp.o[0m
[ 38%] [32mBuilding CXX object core/utilities/advancedrename/CMakeFiles/gui_advancedrename_obj.dir/parser/options/database/keys/positionkeys.cpp.o[0m
[ 38%] [32mBuilding CXX object core/utilities/advancedrename/CMakeFiles/gui_advancedrename_obj.dir/parser/options/dateoption.cpp.o[0m
[ 38%] [32mBuilding CXX object core/utilities/advancedrename/CMakeFiles/gui_advancedrename_obj.dir/parser/options/directorynameoption.cpp.o[0m
[ 38%] [32mBuilding CXX object core/utilities/advancedrename/CMakeFiles/gui_advancedrename_obj.dir/parser/options/filepropertiesoption.cpp.o[0m
[ 38%] [32mBuilding CXX object core/utilities/advancedrename/CMakeFiles/gui_advancedrename_obj.dir/parser/options/metadataoption.cpp.o[0m
[ 38%] [32mBuilding CXX object core/utilities/advancedrename/CMakeFiles/gui_advancedrename_obj.dir/parser/options/sequencenumberoption.cpp.o[0m
[ 38%] Built target gui_advancedrename_obj
make: *** [Makefile:136: all] Error 2
Comment 20 caulier.gilles 2022-05-25 18:27:06 UTC
Git commit 53d71858b49b3b77fea5aa886333a4b0a1221bec by Gilles Caulier.
Committed on 25/05/2022 at 18:14.
Pushed by cgilles into branch 'master'.

FFMPEG 5 port ++ : QtAV code compile now WITHOUT any guaranty to be functional. Take a care!
NOTE: CUDA and VAAPI support are disabled as more complex port of code need to be ported to new FFMPEG API.
TODO list have been updated.
Related: bug 448681

M  +14   -6    core/libs/video/qtav/CMakeLists.txt
M  +6    -0    core/libs/video/qtav/README.md
M  +1    -1    core/libs/video/qtav/src/codec/AVEncoder.cpp
M  +10   -2    core/libs/video/qtav/src/codec/audio/AudioEncoderFFmpeg.cpp
M  +11   -6    core/libs/video/qtav/src/ffmpeg/AVMuxer.cpp
M  +1    -1    core/libs/video/qtav/src/ffmpeg/AVPlayerCore_p.cpp
M  +1    -1    core/libs/video/qtav/src/ffmpeg/VideoFormat.cpp

https://invent.kde.org/graphics/digikam/commit/53d71858b49b3b77fea5aa886333a4b0a1221bec
Comment 21 caulier.gilles 2022-05-25 19:27:33 UTC
Git commit 2e9cf968215470f1566151219da596c2310b3f9d by Gilles Caulier.
Committed on 25/05/2022 at 19:16.
Pushed by cgilles into branch 'master'.

Fix linking stage with FFMPEG 5 and QtAV: VAAPI and CUDA need to be ported to new API
Related: bug 448681

M  +25   -3    core/cmake/rules/RulesMediaPlayer.cmake

https://invent.kde.org/graphics/digikam/commit/2e9cf968215470f1566151219da596c2310b3f9d
Comment 22 maderios 2022-05-26 14:59:16 UTC
Created attachment 149235 [details]
video ffmpeg5 debug

It builds normally with ffmpeg5 but video player doesn't work at all. See attachment file. I had to delete many many identical  lines.
Comment 23 caulier.gilles 2022-05-27 08:53:56 UTC
yes, investiguations are under progress in bug #448681
Comment 24 caulier.gilles 2022-06-02 09:35:50 UTC
Git commit 11a6445ef82b36844c4bae692387683d9951ad25 by Gilles Caulier.
Committed on 02/06/2022 at 09:32.
Pushed by cgilles into branch 'master'.

port to FFMPEG5: clazy static anayzer report a wrong use a QMap with a pointer as key. Use QHash instead.
Related: bug 448681

M  +11   -5    core/libs/video/qtav/src/codec/AVDecoder.cpp
M  +1    -3    core/libs/video/qtav/src/codec/AVDecoder.h
M  +1    -1    core/libs/video/qtav/src/codec/video/SurfaceInteropCUDA.cpp

https://invent.kde.org/graphics/digikam/commit/11a6445ef82b36844c4bae692387683d9951ad25