Bug 448681 - digikam uses abandoned library incompatible with ffmpeg 5.0
Summary: digikam uses abandoned library incompatible with ffmpeg 5.0
Status: RESOLVED FIXED
Alias: None
Product: digikam
Classification: Applications
Component: Preview-Video (show other bugs)
Version: 7.6.0
Platform: OpenMandriva Linux
: NOR normal
Target Milestone: ---
Assignee: Digikam Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-01-17 23:59 UTC by Bernhard Rosenkränzer
Modified: 2024-01-26 12:47 UTC (History)
7 users (show)

See Also:
Latest Commit:
Version Fixed In: 8.3.0


Attachments
small qtavplayer git/master cmake patch (1.84 KB, text/plain)
2023-03-14 15:52 UTC, caulier.gilles
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Bernhard Rosenkränzer 2022-01-17 23:59:43 UTC
Digikam uses QtAV, which sadly has been abandoned upstream.
http://www.qtav.org/blog/new-sdk.html

This hasn't been much of a problem so far, but now that ffmpeg 5.0 has been released (and QtAV isn't compatible with it), we'll need a solution for people updating their ffmpeg.

In case anyone is interested in forking the last public QtAV code (probably the only solution other than moving to another library), I've submitted a partial patch to make it compatible with ffmpeg 5.0 at https://github.com/wang-bin/QtAV/issues/1377 -- but I don't have the time do debug its various crashes right now (yet the patch may be a good starting point).
Comment 1 caulier.gilles 2022-01-18 06:29:11 UTC
Hi,

QtAv is not abandoned at all. I'm in contact with lead developer, and it have been ported to Qt6 recently. Look last PR and commits in the project.

We don't plan to change to a new video framework yet in digiKam. ffmpeg backend is the best solution, as i explained in my comment here :

https://github.com/wang-bin/QtAV/issues/1294#issuecomment-1007943741 

The best way as you already do is to create a report in QtAV with your patch, or better, a merge request from a fork of the repository, which will include all your changes. It will be more easy for the QtAv developers to review changes.

Gilles Caulier
Comment 2 caulier.gilles 2022-03-30 11:03:04 UTC
Maik,

I just seen this automatic note appended on the bottom of QtAV report : 

"
NOTE: QtAV is no longer maintained, please use new sdk:
https://github.com/wang-bin/mdk-sdk
"

It's clear : the new sdk a closed source solution not compatible with digiKam...

Solution :

1/ Ask to the author the keys to maintain the official repository on github.
2/ Fork QtAV in a new github repository and maintain as possible.
3/ Extract CPP code needs for digiKam and import code in core as 3rd party.
4/ Switch again to another framework : MLT used by KDenlive https://mltframework.org/

For 1/, if original author force users to switch to closed source new sdk, i fear no chance to obtain the key.
For 2/, simple to do but complex to maintain. We don't have the manpower to do it. If we choose this solution, all QtAV users must help to maintain this code. This needs coordination, which it out of scope of digiKam.
For 3/, it's my preferred way, as we will review all necessary codes and rewrite all the complex cmake rules everywhere (a puzzle) and drop qmake stuff.    
For 4/, MLT is a bulldozer and this require to put all current code in the trash and restart for scratch. It's not sure if it depend of ffmpeg, that we needs.

Note : This thread is only for next 8.0.0 AND Qt6 port as QtAV Qt5 code for git/master work as expected. 

Gilles
Comment 3 Maik Qualmann 2022-03-30 11:49:40 UTC
We may be able to switch back to QtMultimedia in the future. It looks like a backend for FFmpeg is in development.

https://github.com/qt/qtmultimedia/tree/dev/src/plugins/multimedia/ffmpeg

https://bugreports.qt.io/browse/QTBUG-99626

Maik
Comment 4 caulier.gilles 2022-03-30 11:54:47 UTC
Ah It's a good point Maik. But in all case, GStreamer is just a pain to use. I would to be sure to be able to disable GSTreamer from QtMultimedia as this piece of software DO NOT work as expected, and is complex to use/install (codecs) in client area.

Gilles
Comment 5 caulier.gilles 2022-04-12 16:20:40 UTC
Maik,

I prepared a branch to integrate the QtAV code needs for digiKam. It's not too much complicated in fact.

https://invent.kde.org/graphics/digikam/-/tree/development/qtav-integration/core/libs/video/qtav

This will allow to :

- fix deprecated Qt5/Qt6 
- fix ugly dependency with OpenGL which is a mess and not homogeneous.
- clean up code to only let's what's we need for digiKam. For ex, the subtitle support is not really a priority to support.
- port to ffmpeg5 using patch from https://github.com/wang-bin/QtAV/issues/1377

This will allow to have a slowly possible migration to QtMultimedia version ffmpeg later, if necessary.

All compile and link under Linux. It still few checks and rules to tune in cmake before to merge back and test under MacOS and Windows.

Gilles
Comment 6 caulier.gilles 2022-04-14 14:06:27 UTC
Git commit c2a21c7f06bb268fb6c2f89047f70352b37c3e34 by Gilles Caulier.
Committed on 14/04/2022 at 14:01.
Pushed by cgilles into branch 'development/qtav-integration'.

QtAV integration is complete and work to play video.
It still plenty of warnings, currently disabled at compilation. See on top of core/libs/video/qtav/CMakeLists.txt.
The ffmpeg deprecated are for later and other are C++17 compliant.
The most important to fix now are the pre-processor undefined due to the mess with the EGL, VAAPI, and CUDA rules.
Here i'm lost, i tried all possible combinations and compared to the QtAV original compilation with cmake without success.

M  +1    -1    core/cmake/rules/RulesLibOpenGL.cmake
M  +38   -11   core/libs/video/qtav/CMakeLists.txt
M  +1    -1    core/libs/video/qtav/src/AVPlayerPrivate.cpp
M  +0    -19   core/libs/video/qtav/src/QtAV/private/AVCompat.h
M  +1    -1    core/libs/video/qtav/src/QtAV_Global.cpp
M  +1    -0    core/libs/video/qtav/src/subtitle/CharsetDetector.cpp

https://invent.kde.org/graphics/digikam/commit/c2a21c7f06bb268fb6c2f89047f70352b37c3e34
Comment 7 caulier.gilles 2022-04-14 14:14:26 UTC
Maik,

I just seen that if we compile QtAV with the same compiler warnings level than digiKam (through KF5::ECM), we obtain the same warnings in fact about undefined preprocessor rules. Ex :

   26 | #if NV_CONFIG(DLLAPI_CUDA)
      | ^~~~~~~~~~~~~~~~~~~~~
In file included from /home/gilles/Devel/QtAV/src/codec/video/VideoDecoderCUDA.cpp:45:
/home/gilles/Devel/QtAV/src/cuda/cuda_api.h:48:1: warning: this use of "defined" may not be portable [-Wexpansion-to-defined]
   48 | #if !NV_CONFIG(DLLAPI_CUDA) && !defined(CUDA_LINK)
      | ^~~~~~~~~~~~~~~~~~~~~
In file included from /home/gilles/Devel/QtAV/src/QtAV/AVError.h:24,
                 from /home/gilles/Devel/QtAV/src/QtAV/AVDecoder.h:25,
                 from /home/gilles/Devel/QtAV/src/QtAV/VideoDecoder.h:25,
                 from /home/gilles/Devel/QtAV/src/codec/video/VideoDecoderCUDA.cpp:22:
/home/gilles/Devel/QtAV/src/QtAV/QtAV_Global.h:173:29: warning: "QTAV_HAVE_CUDA_EGL" is not defined, evaluates to 0 [-Wundef]
  173 | #define QTAV_HAVE(FEATURE) (QTAV_HAVE_##FEATURE+0)
      |                             ^~~~~~~~~~
/home/gilles/Devel/QtAV/src/codec/video/SurfaceInteropCUDA.h:139:5: note: in expansion of macro ‘QTAV_HAVE’
  139 | #if QTAV_HAVE(CUDA_EGL)
      |     ^~~~~~~~~
/home/gilles/Devel/QtAV/src/QtAV/QtAV_Global.h:173:29: warning: "QTAV_HAVE_DLLAPI_CUDA" is not defined, evaluates to 0 [-Wundef]
  173 | #define QTAV_HAVE(FEATURE) (QTAV_HAVE_##FEATURE+0)
      |                             ^~~~~~~~~~
/home/gilles/Devel/QtAV/src/codec/video/VideoDecoderCUDA.cpp:163:5: note: in expansion of macro ‘QTAV_HAVE’
  163 | #if QTAV_HAVE(DLLAPI_CUDA)
      |     ^~~~~~~~~
/home/gilles/Devel/QtAV/src/QtAV/QtAV_Global.h:173:29: warning: "QTAV_HAVE_CUDA_EGL" is not defined, evaluates to 0 [-Wundef]
  173 | #define QTAV_HAVE(FEATURE) (QTAV_HAVE_##FEATURE+0)
      |                             ^~~~~~~~~~
/home/gilles/Devel/QtAV/src/codec/video/VideoDecoderCUDA.cpp:207:5: note: in expansion of macro ‘QTAV_HAVE’
  207 | #if QTAV_HAVE(CUDA_EGL)
      |     ^~~~~~~~~

The guy who code this rules must be ... well, forget (:-)))... You know what i mean...

Gilles
Comment 8 caulier.gilles 2022-04-14 14:56:30 UTC
Git commit 067994d2b5515e7466cc8932658f03aa2388b87a by Gilles Caulier.
Committed on 14/04/2022 at 14:55.
Pushed by cgilles into branch 'development/qtav-integration'.

Cleanup preprocessor rules for QtAV

M  +0    -1    Mainpage.dox
M  +25   -14   core/libs/video/qtav/CMakeLists.txt

https://invent.kde.org/graphics/digikam/commit/067994d2b5515e7466cc8932658f03aa2388b87a
Comment 9 caulier.gilles 2022-04-14 15:09:11 UTC
qtav-integration branch have been merger to master and branch is now deleted.
Comment 10 caulier.gilles 2022-04-15 08:57:40 UTC
Git commit dd50409eb5554862ae5e1aea640a1edc8a8ef439 by Gilles Caulier.
Committed on 15/04/2022 at 08:56.
Pushed by cgilles into branch 'master'.

QtAV code is now ported to pure Qt5/6 API.

M  +0    -5    core/libs/video/qtav/CMakeLists.txt
M  +1    -1    core/libs/video/qtav/src/codec/video/VideoDecoderCUDA.cpp
M  +3    -3    core/libs/video/qtav/src/codec/video/VideoDecoderVAAPI.cpp
M  +3    -3    core/libs/video/qtav/src/opengl/OpenGLTypes.cpp
M  +22   -1    core/libs/video/qtav/src/opengl/ShaderManager.cpp
M  +1    -1    core/libs/video/qtav/src/opengl/VideoShader.cpp

https://invent.kde.org/graphics/digikam/commit/dd50409eb5554862ae5e1aea640a1edc8a8ef439
Comment 11 caulier.gilles 2022-04-15 09:05:38 UTC
Hi Bernhard,

All QtAV is now ported to pure Qt5/6 API. It's time now to use FFMPEG 5 API patch and test.

To show all deprecated FFMPEG API use with FFMPEG 4.x, just disable the lines 11 and 15 from this CMakeLists.txt :

https://invent.kde.org/graphics/digikam/-/blob/master/core/libs/video/qtav/CMakeLists.txt#L11

Can you adjust your patch to support FFMPEG 5 API using gitlab and process with a Merge Request please ?

Note I left the code structure intact as possible. All files are in a same hierarchy of folders, so it must be simple to apply your patch as well.
We will review your patch in gitlab step by step.

Thanks in advance

Best Regards

Gilles Caulier
Comment 12 caulier.gilles 2022-04-15 09:13:44 UTC
Hi Maik,

I need your expertise with the QtAV code here, and especially the puzzle of pre-processor rules to configure external dependencies in code. The guy who code this mess live in another world (:-)))... 

To show all the undefined pre-processor definitions in QtAV, just comment lines #12, 13, 16, 17 from this CMakeLists.txt:

https://invent.kde.org/graphics/digikam/-/blob/master/core/libs/video/qtav/CMakeLists.txt#L12

Note: as i already said previously, if i activate the compiler warnings in original QtAV, all these warnings are also there. This is not a problem with the QtAv integration in digiKam.

Note2 : About the CUDA API dependency, QtAV do not check the availability and force as well the compilation code relevant with non APPLE platform. Cmake provide a FindCUDAToolkit.cmake helper script (FindCUDA.cmake is deprecated) that perhaps we can use here. Your viewpoints ? 

Best

Gilles
Comment 13 Maik Qualmann 2022-04-15 21:03:35 UTC
Hi Gilles,
I'll get an overview of the QtAV code over the weekend.

Best

Maik
Comment 14 caulier.gilles 2022-04-15 21:19:09 UTC
Maik,

One Q : What's the gain of capi concept ?

https://invent.kde.org/graphics/digikam/-/tree/master/core/libs/video/qtav/src/capi

Typically, this allow to load dynamically a dependency at run time, instead to link with dependency. 
so, it replace the OS loader which load in memory the dependencies on demand. 
Why to duplicates this job ? It a specific use cases under phone where QtAv can be compiled ?
I think it's a non sense with desktop uses.

Gilles
Comment 15 Maik Qualmann 2022-04-16 06:17:00 UTC
Hmm, as I understand it, capi is a C wrapper for the C++ API. So that QtAV can be accessed with C.
I don't think we need that.

Maik
Comment 16 caulier.gilles 2022-04-16 09:56:48 UTC
Hi Maik,

But CAPI is used with 3 dependencies : libass, vaapi, and EGL. I don't think QtAV C++ API will be accessed by C dependencies. It's the inverse, QtAV use C API from dependencies.

I read well all compilation rules from original QtAV code, and it's clear : if capi is not present with the QtAV code at configuration time, CAPI is not used and dependencies are linked instead to use dynamic loading.

- from CMake rules CAPI is optional : https://github.com/wang-bin/QtAV/blob/master/src/CMakeLists.txt#L27
- from QMake rules CAPI is mandatory : https://github.com/wang-bin/QtAV/blob/master/src/libQtAV.pro#L43

Again, what's the gain of an handmaid dynamic loading ? The loader do it very well after all. I don't understand why CAPI is used here...

Gilles
Comment 17 Bernhard Rosenkränzer 2022-04-16 10:21:14 UTC
My guess is it's done that way to avoid hard dependencies (make functionality not everyone needs available if the libraries are there, but work without those functionalities if the libraries aren't there).
Can be useful for building cross-distro binaries when targeting something that might be old enough to lack vaapi or something, but other than that I don't see any valid use case for the libraries mentioned (would make more sense if it was done for x264 or other stuff that has patent issues in some parts of the world).
Comment 18 caulier.gilles 2022-04-16 10:34:08 UTC
Hi Bernhard,

Thanks for the feedback. Effectively, i don't imagine this kind of workflow with the external dependencies...

Gilles
Comment 19 caulier.gilles 2022-04-16 10:34:59 UTC
Note: i pass static analyzers over QtAV code and i found really point where code need urgent fixes.

Gilles
Comment 20 caulier.gilles 2022-04-16 14:55:53 UTC
One other technical question which hurt me QtAV code:

This kind of preprocessor line :

#define QTAV_HAVE(FEATURE) (QTAV_HAVE_##FEATURE+0)

.. from there:
https://github.com/wang-bin/QtAV/blob/master/src/QtAV/QtAV_Global.h#L173

What does the "+0" operator want mean here ?

Typically, if FEATURE is "FOO", the macro define something like QTAV_HAVE_FOO... and what ???

Gilles
Comment 21 caulier.gilles 2022-04-25 05:40:00 UTC
Hi all,

I found another alternative to Qt6::Multimedia for the future. The QtAV developer, propose an opensource wrapper to different multimedia backends :

https://github.com/wangwenx190/QtMediaPlayer

Currently two player backends are available: MDK and MPV. FFmpeg is on plan. All backends will be loaded dynamically at run-time.

Gilles
Comment 22 caulier.gilles 2022-05-24 13:32:22 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 453840

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 23 caulier.gilles 2022-05-24 13:40:30 UTC
To Bernhard Rosenkränzer,

QtAV source code is now forked integrally into digiKam core. Your patch to support FFMPEG 5 have been review and applied to digiKam.

Code of QtAV is located here in digiKam :

https://invent.kde.org/graphics/digikam/-/tree/master/core/libs/video/qtav

Please, if you can test the digiKam code from git/master branch, it will be nice. All continuation to patch the QtAV fork will be great of course...

Note: digiKam now install the QtAV video player as a stand alone application on your system. binary is named "avplayer". This will help you to perform regression tests directly on player without to use whole digiKam as well for this task. Code of this stand alone player is located here :

https://invent.kde.org/graphics/digikam/-/tree/master/core/avplayer

Note2: I applied a lots of changes in QtAV code, because the code was unmaintained a lots. the static analyzers was a huge help in this task. I found plenty of place in code where bugs have been fixed. See my lists of changes in the README.md file :

https://invent.kde.org/graphics/digikam/-/raw/master/core/libs/video/qtav/README.md

Voilà, I'm waiting for your feedback.

Best

Gilles Caulier
Comment 24 caulier.gilles 2022-05-25 10:24:15 UTC
Hi Maik and Bernhard,

FFMPEG 5 is now detected properly with my last commit. I installed FFMPEG 5 on my system instead the official packaged FFMPEG 4 version.

The cmake configuration report the following :

-- --------------------------------------------------
-- digiKam MediaPlayer dependencies checks:
-- 
-- FFMPEG_FOUND        = TRUE
-- FFMPEG_INCLUDE_DIRS = /usr/include
-- FFMPEG_LIBRARIES    = /usr/lib/libavcodec.so;/usr/lib/libavdevice.so;/usr/lib/libavfilter.so;/usr/lib/libavformat.so;/usr/lib/libavutil.so;/usr/lib/libswscale.so;/usr/lib/libswresample.so
-- FFMPEG_DEFINITIONS  = 
-- Could NOT find FFmpeg (missing: AVRESAMPLE_LIBRARIES AVRESAMPLE_INCLUDE_DIRS) 
-- FFMPEG_FOUND        = FALSE
-- FFMPEG_INCLUDE_DIRS = /usr/include
-- FFMPEG_LIBRARIES    = /usr/lib/libavcodec.so;/usr/lib/libavdevice.so;/usr/lib/libavfilter.so;/usr/lib/libavformat.so;/usr/lib/libavutil.so;/usr/lib/libswscale.so;/usr/lib/libswresample.so
-- FFMPEG_DEFINITIONS  = 
-- Found Portaudio: /usr/lib64/libportaudio.so
-- SSE2 support   : true
-- SSE3 support   : true
-- SSSE3 support  : true
-- SSE4.1 support : true
-- SSE4.2 support : true
-- FFMpeg AVCodec    : TRUE (59.32.100)
-- FFMpeg AVDevice   : TRUE (59.6.100)
-- FFMpeg AVFilter   : TRUE (8.39.100)
-- FFMpeg AVFormat   : TRUE (59.24.100)
-- FFMpeg AVUtil     : TRUE (57.25.100)
-- FFMpeg SWScale    : TRUE (6.6.100)
-- FFMpeg SWResample : TRUE (4.6.100)
-- FFMpeg AVResample : FALSE ()
-- MediaPlayer support is enabled                       : yes
-- MediaPlayer will use FFMpeg 5 API                    : yes
-- MediaPlayer will be compiled with SSE4.1 support     : yes
-- MediaPlayer will be compiled with LibASS support     : yes
-- MediaPlayer will be compiled with UCharDet support   : yes
-- MediaPlayer will be compiled with OpenAL support     : yes
-- MediaPlayer will be compiled with PortAudio support  : yes
-- MediaPlayer will be compiled with PulseAudio support : yes
-- MediaPlayer will be compiled with OpenSLES support   : no
-- MediaPlayer will be compiled with VaAPI support      : yes
-- MediaPlayer will be compiled with X11 support        : yes
-- MediaPlayer will be compiled with XV support         : yes
-- MediaPlayer will be compiled with OpenGL support     : yes
-- MediaPlayer will be compiled with OpenGL-EGL support : yes
-- MediaPlayer will be compiled with GDI+ support       : no
-- MediaPlayer will be compiled with Direct3D11 support : no
-- MediaPlayer will be compiled with DirectSound support: no
-- MediaPlayer will be compiled with XAudio2 support    : no
-- MediaPlayer will be compiled with Direct2D support   : no
-- MediaPlayer libraries  : /usr/lib/libavcodec.so;/usr/lib/libavdevice.so;/usr/lib/libavfilter.so;/usr/lib/libavformat.so;/usr/lib/libavutil.so;/usr/lib/libswscale.so;/usr/lib/libswresample.so;dl;/usr/lib64/libass.so;uchardet;/usr/lib64/libopenal.so;/usr/lib64/libportaudio.so;/usr/lib64/libpulse.so;/usr/lib64/libva.so;/usr/lib64/libva-drm.so;/usr/lib64/libSM.so;/usr/lib64/libICE.so;/usr/lib64/libX11.so;/usr/lib64/libXext.so;/usr/lib64/libXv.so;/usr/lib64/libOpenGL.so;/usr/lib64/libGLX.so;/usr/lib64/libGLU.so;Qt5::OpenGL;/usr/lib64/libEGL.so
-- MediaPlayer definitions: -D__STDC_CONSTANT_MACROS;-DQTAV_HAVE_CAPI=1;-DQTAV_HAVE_VDA=0;-DAUTO_REGISTER=0;-DFF_API_OLD_MSMPEG4=0;-DFF_API_AC_VLC=0;-DQTAV_HAVE_FFMPEG5;-DQTAV_HAVE_SSE4_1=1;-DQTAV_HAVE_SSE2=0;-DQTAV_HAVE_DXVA=0;-DCAPI_LINK_ASS;-DQTAV_HAVE_LIBASS=1;-DLINK_UCHARDET;-DCAPI_LINK_EGL;-DQTAV_HAVE_GL=1;-DQTAV_HAVE_X11=1;-DQTAV_HAVE_XV=1;-DQTAV_HAVE_OPENAL=1;-DQTAV_HAVE_PORTAUDIO=1;-DQTAV_HAVE_PULSEAUDIO=1;-DQTAV_HAVE_OPENSL=0;-DQTAV_HAVE_D3D11VA=0;-DQTAV_HAVE_XAUDIO2=0;-DQTAV_HAVE_DSOUND=0;-DQTAV_HAVE_GDIPLUS=0;-DQTAV_HAVE_DIRECT2D=0;-DQTAV_HAVE_SWR_AVR_MAP=0;-DQTAV_HAVE_VIDEOTOOLBOX=0;-DQTAV_HAVE_CUDA=1;-DQTAV_HAVE_DLLAPI_CUDA=0;-DQTAV_HAVE_AVCODEC=1;-DQTAV_HAVE_AVDEVICE=1;-DQTAV_HAVE_AVFILTER=1;-DQTAV_HAVE_AVUTIL=1;-DQTAV_HAVE_SWSCALE=1;-DQTAV_HAVE_AVRESAMPLE=0;-DQTAV_HAVE_SWRESAMPLE=1;-DQTAV_HAVE_EGL_CAPI=1;-DQTAV_HAVE_VAAPI=1
-- MediaPlayer flags      : -msse4.1
-- 
-- -------------------------------------------------

IMPORTANT : libavresample is now removed with FFMPEG 5 and SWRESAMPLE must be used instead. The rules in QtAV about to reroute libswresample to libavresample if swresample is not available is only valid with FFMPEG < 5.

Another point is the way to enable FFMPEG 5 API uses with FFMPEG 4 to check if all deprecated API calls are fixed in QtAV : this do not work, as FFMPEG 5 API is more changed compared to FFMPEG 4.

Finally, FFMPEG 5 compilation report more deprecated than ones reported with FFMPEG4:

[  3%] Building CXX object core/libs/dimg/CMakeFiles/core_dimg_obj.dir/core_dimg_obj_autogen/mocs_compilation.cpp.o
/home/gilles/Devel/8.x/core/libs/metadataengine/dmetadata/dmetadata_video.cpp: In member function ‘bool Digikam::DMetadata::loadUsingFFmpeg(const QString&)’:
/home/gilles/Devel/8.x/core/libs/metadataengine/dmetadata/dmetadata_video.cpp:338:28: warning: ‘AVCodecParameters::channels’ is deprecated [-Wdeprecated-declarations]
  338 |             switch (codec->channels)
      |                            ^~~~~~~~
In file included from /usr/include/libavformat/avformat.h:314,
                 from /home/gilles/Devel/8.x/core/libs/metadataengine/dmetadata/dmetadata_video.cpp:70:
/usr/include/libavcodec/codec_par.h:172:14: note: declared here
  172 |     int      channels;
      |              ^~~~~~~~
/home/gilles/Devel/8.x/core/libs/metadataengine/dmetadata/dmetadata_video.cpp:338:28: warning: ‘AVCodecParameters::channels’ is deprecated [-Wdeprecated-declarations]
  338 |             switch (codec->channels)
      |                            ^~~~~~~~
In file included from /usr/include/libavformat/avformat.h:314,
                 from /home/gilles/Devel/8.x/core/libs/metadataengine/dmetadata/dmetadata_video.cpp:70:
/usr/include/libavcodec/codec_par.h:172:14: note: declared here
  172 |     int      channels;
      |              ^~~~~~~~
/home/gilles/Devel/8.x/core/libs/metadataengine/dmetadata/dmetadata_video.cpp:338:28: warning: ‘AVCodecParameters::channels’ is deprecated [-Wdeprecated-declarations]
  338 |             switch (codec->channels)
      |                            ^~~~~~~~
In file included from /usr/include/libavformat/avformat.h:314,
                 from /home/gilles/Devel/8.x/core/libs/metadataengine/dmetadata/dmetadata_video.cpp:70:
/usr/include/libavcodec/codec_par.h:172:14: note: declared here
  172 |     int      channels;
      |              ^~~~~~~~
[  3%] Building CXX object core/libs/metadataengine/CMakeFiles/core_dmetadata_obj.dir/dmetadata/dmetadata_exiftool.cpp.o

...

/home/gilles/Devel/8.x/core/libs/threadimageio/video/videothumbdecoder_p.cpp: In member function ‘bool Digikam::VideoThumbDecoder::Private::initializeVideo()’:
/home/gilles/Devel/8.x/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);
      |                             ~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                                                 |
      |                                                 const AVCodec*
make[2]: *** [core/libs/threadimageio/CMakeFiles/core_threadimageio_obj.dir/build.make:407: core/libs/threadimageio/CMakeFiles/core_threadimageio_obj.dir/video/videothumbdecoder_p.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:9005: core/libs/threadimageio/CMakeFiles/core_threadimageio_obj.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....

Also, the Bernhard patch is not enough to compile QtAV code from digiKam core :

Scanning dependencies of target core_qtav_obj
[  0%] Building CXX object core/libs/video/qtav/CMakeFiles/core_qtav_obj.dir/core_qtav_obj_autogen/mocs_compilation.cpp.o
[  0%] Building CXX object core/libs/video/qtav/CMakeFiles/core_qtav_obj.dir/src/ffmpeg/AVCompat.cpp.o
[  0%] Building CXX object core/libs/video/qtav/CMakeFiles/core_qtav_obj.dir/src/ffmpeg/AVMuxer.cpp.o
/home/gilles/Devel/8.x/core/libs/video/qtav/src/ffmpeg/AVMuxer.cpp: In member function ‘AVStream* QtAV::AVMuxer::Private::addStream(AVFormatContext*, const QString&, AVCodecID)’:
/home/gilles/Devel/8.x/core/libs/video/qtav/src/ffmpeg/AVMuxer.cpp:209:34: error: ‘AVStream’ {aka ‘struct AVStream’} has no member named ‘codec’
  209 |     AVCodec* const c        = s->codec;
      |                                  ^~~~~
/home/gilles/Devel/8.x/core/libs/video/qtav/src/ffmpeg/AVMuxer.cpp:213:8: error: ‘AVCodec’ {aka ‘struct AVCodec’} has no member named ‘codec_id’
  213 |     c->codec_id             = codec->id;
      |        ^~~~~~~~
/home/gilles/Devel/8.x/core/libs/video/qtav/src/ffmpeg/AVMuxer.cpp:217:8: error: ‘AVCodec’ {aka ‘struct AVCodec’} has no member named ‘time_base’
  217 |     c->time_base            = s->time_base;
      |        ^~~~~~~~~
/home/gilles/Devel/8.x/core/libs/video/qtav/src/ffmpeg/AVMuxer.cpp:222:12: error: ‘AVCodec’ {aka ‘struct AVCodec’} has no member named ‘flags’
  222 |         c->flags |= AV_CODEC_FLAG_GLOBAL_HEADER;
      |            ^~~~~
/home/gilles/Devel/8.x/core/libs/video/qtav/src/ffmpeg/AVMuxer.cpp: In member function ‘bool QtAV::AVMuxer::Private::prepareStreams()’:
/home/gilles/Devel/8.x/core/libs/video/qtav/src/ffmpeg/AVMuxer.cpp:322:16: warning: ‘AVCodecParameters::channel_layout’ is deprecated [-Wdeprecated-declarations]
  322 |             c->channel_layout           = aenc->audioFormat().channelLayoutFFmpeg();
      |                ^~~~~~~~~~~~~~
In file included from /usr/include/libavformat/avformat.h:314,
                 from /home/gilles/Devel/8.x/core/libs/video/qtav/src/ffmpeg/AVCompat.h:61,
                 from /home/gilles/Devel/8.x/core/libs/video/qtav/src/ffmpeg/AVMuxer.cpp:28:
/usr/include/libavcodec/codec_par.h:166:14: note: declared here
  166 |     uint64_t channel_layout;
      |              ^~~~~~~~~~~~~~
/home/gilles/Devel/8.x/core/libs/video/qtav/src/ffmpeg/AVMuxer.cpp:322:16: warning: ‘AVCodecParameters::channel_layout’ is deprecated [-Wdeprecated-declarations]
  322 |             c->channel_layout           = aenc->audioFormat().channelLayoutFFmpeg();
      |                ^~~~~~~~~~~~~~
In file included from /usr/include/libavformat/avformat.h:314,
                 from /home/gilles/Devel/8.x/core/libs/video/qtav/src/ffmpeg/AVCompat.h:61,
                 from /home/gilles/Devel/8.x/core/libs/video/qtav/src/ffmpeg/AVMuxer.cpp:28:
/usr/include/libavcodec/codec_par.h:166:14: note: declared here
  166 |     uint64_t channel_layout;
      |              ^~~~~~~~~~~~~~
/home/gilles/Devel/8.x/core/libs/video/qtav/src/ffmpeg/AVMuxer.cpp:322:16: warning: ‘AVCodecParameters::channel_layout’ is deprecated [-Wdeprecated-declarations]
  322 |             c->channel_layout           = aenc->audioFormat().channelLayoutFFmpeg();
      |                ^~~~~~~~~~~~~~
In file included from /usr/include/libavformat/avformat.h:314,
                 from /home/gilles/Devel/8.x/core/libs/video/qtav/src/ffmpeg/AVCompat.h:61,
                 from /home/gilles/Devel/8.x/core/libs/video/qtav/src/ffmpeg/AVMuxer.cpp:28:
/usr/include/libavcodec/codec_par.h:166:14: note: declared here
  166 |     uint64_t channel_layout;
      |              ^~~~~~~~~~~~~~
/home/gilles/Devel/8.x/core/libs/video/qtav/src/ffmpeg/AVMuxer.cpp:323:16: warning: ‘AVCodecParameters::channels’ is deprecated [-Wdeprecated-declarations]
  323 |             c->channels                 = aenc->audioFormat().channels();
      |                ^~~~~~~~
In file included from /usr/include/libavformat/avformat.h:314,
                 from /home/gilles/Devel/8.x/core/libs/video/qtav/src/ffmpeg/AVCompat.h:61,
                 from /home/gilles/Devel/8.x/core/libs/video/qtav/src/ffmpeg/AVMuxer.cpp:28:
/usr/include/libavcodec/codec_par.h:172:14: note: declared here
  172 |     int      channels;
      |              ^~~~~~~~
/home/gilles/Devel/8.x/core/libs/video/qtav/src/ffmpeg/AVMuxer.cpp:323:16: warning: ‘AVCodecParameters::channels’ is deprecated [-Wdeprecated-declarations]
  323 |             c->channels                 = aenc->audioFormat().channels();
      |                ^~~~~~~~
In file included from /usr/include/libavformat/avformat.h:314,
                 from /home/gilles/Devel/8.x/core/libs/video/qtav/src/ffmpeg/AVCompat.h:61,
                 from /home/gilles/Devel/8.x/core/libs/video/qtav/src/ffmpeg/AVMuxer.cpp:28:
/usr/include/libavcodec/codec_par.h:172:14: note: declared here
  172 |     int      channels;
      |              ^~~~~~~~
/home/gilles/Devel/8.x/core/libs/video/qtav/src/ffmpeg/AVMuxer.cpp:323:16: warning: ‘AVCodecParameters::channels’ is deprecated [-Wdeprecated-declarations]
  323 |             c->channels                 = aenc->audioFormat().channels();
      |                ^~~~~~~~
In file included from /usr/include/libavformat/avformat.h:314,
                 from /home/gilles/Devel/8.x/core/libs/video/qtav/src/ffmpeg/AVCompat.h:61,
                 from /home/gilles/Devel/8.x/core/libs/video/qtav/src/ffmpeg/AVMuxer.cpp:28:
/usr/include/libavcodec/codec_par.h:172:14: note: declared here
  172 |     int      channels;
      |              ^~~~~~~~
make[2]: *** [core/libs/video/qtav/CMakeFiles/core_qtav_obj.dir/build.make:116: core/libs/video/qtav/CMakeFiles/core_qtav_obj.dir/src/ffmpeg/AVMuxer.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:10626: core/libs/video/qtav/CMakeFiles/core_qtav_obj.dir/all] Error 2
make: *** [Makefile:160: all] Error 2

Voilà, so the ffmpeg 5 support in digiKam needs more works...

Gilles
Comment 25 caulier.gilles 2022-05-25 15:55:04 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 453840

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

https://invent.kde.org/graphics/digikam/commit/38f50070ee40531f190f34b1c8bc9be4c8c728ec
Comment 26 caulier.gilles 2022-05-25 18:27:14 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 453840

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 27 caulier.gilles 2022-05-25 19:27:25 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 453840

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

https://invent.kde.org/graphics/digikam/commit/2e9cf968215470f1566151219da596c2310b3f9d
Comment 28 caulier.gilles 2022-05-25 21:14:37 UTC
Hi Bernhard and Maik,

I tried to play MP4 video file with FFMPEG5 (current git/master code), without success. 2 frames are decoded and after, all is stopped:

digikam.metaengine: -- FFMpeg video stream metadata entries :
digikam.metaengine: QMap(("creation_time", "2016-07-25T16:06:42.000000Z")("encoder", "AVC Coding")("handler_name", "Video Media Handler")("language", "und")("vendor_id", "[0][0][0][0]"))
digikam.metaengine: -----------------------------------------
digikam.metaengine: -- FFMpeg audio stream metadata entries :
digikam.metaengine: QMap(("creation_time", "2016-07-25T16:06:42.000000Z")("handler_name", "Sound Media Handler")("language", "und")("vendor_id", "[0][0][0][0]"))
digikam.metaengine: -----------------------------------------
digikam.metaengine: -- FFMpeg root container metadata entries :
digikam.metaengine: QMap(("compatible_brands", "MSNVmp42isom")("creation_time", "2016-07-25T16:06:42.000000Z")("major_brand", "MSNV")("minor_version", "19595376"))
digikam.metaengine: ------------------------------------------
digikam.metaengine: Loading metadata with "FFMpeg" backend from "/home/gilles/Images/MAH09461.MP4"
digikam.general: Metadata loading with Exiv2 took 171 ms ( true )
digikam.general: "Standard Exif Tags" decoding took 0 ms ( false )
digikam.qtav.warn: no frame could be decompressed: Success 81586/81586
digikam.qtav.warn: invalid video frame from decoder. undecoded data size: 81586
digikam.general: "MakerNote Exif Tags" decoding took 0 ms ( false )
digikam.general: "IPTC Records" decoding took 0 ms ( false )
digikam.general: "XMP Schema" decoding took 0 ms ( false )
digikam.general: Stacked View Mode :  6
digikam.metaengine: ExifTool complete command for action "Load Metadata" with elasped time (ms): 117
digikam.metaengine: Json Array size: 1
digikam.metaengine: ExifTool Json map size: 134
digikam.metaengine: ExifTool parsed command for action "Load Metadata"
digikam.metaengine: 133 properties decoded
digikam.qtav.warn: Decode audio failed. undecoded: 0
digikam.qtav.warn: no frame could be decompressed: Success 81586/81586
digikam.qtav.warn: invalid video frame from decoder. undecoded data size: 81586
digikam.qtav.warn: [FFmpeg:h264] illegal short term buffer state detected
digikam.qtav: setInSize => calculating aspect ratio from converted input data(1.777778)
digikam.qtav.warn: Decode audio failed. undecoded: 0
digikam.qtav.warn: Decode audio failed. undecoded: 0
digikam.qtav.warn: Decode audio failed. undecoded: 0
digikam.qtav.warn: Decode audio failed. undecoded: 0
...
digikam.qtav.warn: Decode audio failed. undecoded: 0
digikam.qtav.warn: Decode audio failed. undecoded: 0
digikam.qtav.warn: Decode audio failed. undecoded: 0
digikam.qtav: End of file. erreof=1 feof=0
digikam.qtav.warn: Decode audio failed. undecoded: 0
digikam.qtav: audio thread gets an eof packet. pkt.pts: -1.000, d.render_pts0:-1.000
digikam.qtav.warn: Decode audio failed. undecoded: 0
digikam.qtav: audio decode eof done
digikam.qtav: delay 0.500000s @0.000s pts:0.120
digikam.qtav.warn: video too fast!!! sleep 0.15 s, nb fast: 30, v_a: 0.4200
digikam.qtav: delay 0.510000s @0.000s pts:0.120
digikam.qtav.warn: video too fast!!! sleep 0.15 s, nb fast: 31, v_a: 0.4300
digikam.qtav: delay 0.520000s @0.000s pts:0.120
digikam.qtav.warn: video too fast!!! sleep 0.16 s, nb fast: 32, v_a: 0.4400
digikam.qtav: delay 0.530000s @0.000s pts:0.120
digikam.qtav.warn: video too fast!!! sleep 0.16 s, nb fast: 33, v_a: 0.4500
digikam.qtav: delay 0.540000s @0.000s pts:0.120
digikam.qtav.warn: video too fast!!! sleep 0.17 s, nb fast: 34, v_a: 0.4600
digikam.qtav: delay 0.550000s @0.000s pts:0.120
digikam.qtav.warn: video too fast!!! sleep 0.17 s, nb fast: 35, v_a: 0.4700
digikam.qtav: delay 0.560000s @0.000s pts:0.120
digikam.qtav.warn: video too fast!!! sleep 0.18 s, nb fast: 36, v_a: 0.4800
digikam.qtav: delay 0.570000s @0.000s pts:0.120
digikam.qtav.warn: video too fast!!! sleep 0.18 s, nb fast: 37, v_a: 0.4900
digikam.qtav: delay 0.580000s @0.000s pts:0.120
digikam.qtav.warn: video too fast!!! sleep 0.19 s, nb fast: 38, v_a: 0.5000
digikam.qtav: delay 0.590000s @0.000s pts:0.120
digikam.qtav.warn: video too fast!!! sleep 0.19 s, nb fast: 39, v_a: 0.5100
digikam.qtav: delay 0.600000s @0.000s pts:0.120
digikam.qtav.warn: video too fast!!! sleep 0.20 s, nb fast: 40, v_a: 0.5200
digikam.qtav: delay 0.610000s @0.000s pts:0.120
digikam.qtav.warn: video too fast!!! sleep 0.20 s, nb fast: 41, v_a: 0.5300
digikam.qtav: delay 0.620000s @0.000s pts:0.120
digikam.qtav.warn: video too fast!!! sleep 0.21 s, nb fast: 42, v_a: 0.5400
digikam.qtav: delay 0.630000s @0.000s pts:0.120
digikam.qtav.warn: video too fast!!! sleep 0.21 s, nb fast: 43, v_a: 0.5500
digikam.qtav: delay 0.640000s @0.000s pts:0.120
digikam.qtav.warn: video too fast!!! sleep 0.22 s, nb fast: 44, v_a: 0.5600
digikam.qtav: delay 0.650000s @0.000s pts:0.120
digikam.qtav.warn: video too fast!!! sleep 0.22 s, nb fast: 45, v_a: 0.5700
digikam.qtav: delay 0.660000s @0.000s pts:0.120
digikam.qtav.warn: video too fast!!! sleep 0.23 s, nb fast: 46, v_a: 0.5800
digikam.qtav: delay 0.670000s @0.000s pts:0.120
digikam.qtav.warn: video too fast!!! sleep 0.23 s, nb fast: 47, v_a: 0.5900
digikam.qtav: delay 0.680000s @0.000s pts:0.120
digikam.qtav.warn: video too fast!!! sleep 0.24 s, nb fast: 48, v_a: 0.6000
digikam.qtav: delay 0.690000s @0.000s pts:0.120
digikam.qtav.warn: video too fast!!! sleep 0.24 s, nb fast: 49, v_a: 0.6100
digikam.qtav: delay 0.700000s @0.000s pts:0.120
digikam.qtav.warn: video too fast!!! sleep 0.25 s, nb fast: 50, v_a: 0.6200
digikam.qtav: delay 0.710000s @0.000s pts:0.120
digikam.qtav.warn: video too fast!!! sleep 0.25 s, nb fast: 51, v_a: 0.6300
digikam.qtav: delay 0.720000s @0.000s pts:0.120
digikam.qtav.warn: video too fast!!! sleep 0.26 s, nb fast: 52, v_a: 0.6400
digikam.qtav: delay 0.730000s @0.000s pts:0.120
digikam.qtav.warn: video too fast!!! sleep 0.26 s, nb fast: 53, v_a: 0.6500
digikam.qtav: delay 0.740000s @0.000s pts:0.120
digikam.qtav.warn: video too fast!!! sleep 0.27 s, nb fast: 54, v_a: 0.6600
digikam.qtav: delay 0.750000s @0.000s pts:0.120
digikam.qtav.warn: video too fast!!! sleep 0.27 s, nb fast: 55, v_a: 0.6700
digikam.qtav: delay 0.760000s @0.000s pts:0.120
digikam.qtav.warn: video too fast!!! sleep 0.28 s, nb fast: 56, v_a: 0.6800
digikam.qtav: delay 0.770000s @0.000s pts:0.120
digikam.qtav.warn: video too fast!!! sleep 0.28 s, nb fast: 57, v_a: 0.6900
digikam.qtav: delay 0.780000s @0.000s pts:0.120
digikam.qtav.warn: video too fast!!! sleep 0.29 s, nb fast: 58, v_a: 0.7000
digikam.qtav: delay 0.790000s @0.000s pts:0.120
digikam.qtav.warn: video too fast!!! sleep 0.29 s, nb fast: 59, v_a: 0.7100
digikam.qtav: delay 0.800000s @0.000s pts:0.120
digikam.qtav.warn: video too fast!!! sleep 0.30 s, nb fast: 60, v_a: 0.7200
digikam.qtav: delay 0.810000s @0.000s pts:0.120
digikam.qtav.warn: video too fast!!! sleep 0.30 s, nb fast: 61, v_a: 0.7300
digikam.qtav: delay 0.820000s @0.000s pts:0.120
digikam.qtav.warn: video too fast!!! sleep 0.31 s, nb fast: 62, v_a: 0.7400
digikam.qtav: delay 0.830000s @0.000s pts:0.120
digikam.qtav.warn: video too fast!!! sleep 0.31 s, nb fast: 63, v_a: 0.7500
digikam.qtav: delay 0.840000s @0.000s pts:0.120
digikam.qtav.warn: video too fast!!! sleep 0.32 s, nb fast: 64, v_a: 0.7600
digikam.qtav: delay 0.850000s @0.000s pts:0.120

As expected the port is not complete or buggy. 

Note: i compiled FFMPEG with this bootstrap script:

https://invent.kde.org/graphics/digikam/-/blob/master/project/scripts/bootstrap-ffmpeg.sh

Gilles
Comment 29 caulier.gilles 2022-05-26 07:42:59 UTC
Note: the same MP4 video file is played properly with digiKam compiled with last FFMPEG 4.3.2. So the original QtAV code work as expected (in case of FFMPEG 5 patches break something)

The console output is listed below :

digikam.metaengine: ExifTool "Load Metadata" "-json -G:0:1:2:4:6 -l /home/gilles/Images/MAH09461.MP4"
digikam.metaengine: Parse metadada with FFMpeg: "/home/gilles/Images/MAH09461.MP4"
digikam.metaengine: ExifToolProcess::readOutput(): ExifTool command completed
digikam.metaengine: -- FFMpeg video stream metadata entries :
digikam.metaengine: QMap(("creation_time", "2016-07-25T16:06:42.000000Z")("encoder", "AVC Coding")("handler_name", "Video Media Handler")("language", "und")("vendor_id", "[0][0][0][0]"))
digikam.metaengine: -----------------------------------------
digikam.metaengine: -- FFMpeg audio stream metadata entries :
digikam.metaengine: QMap(("creation_time", "2016-07-25T16:06:42.000000Z")("handler_name", "Sound Media Handler")("language", "und")("vendor_id", "[0][0][0][0]"))
digikam.metaengine: -----------------------------------------
digikam.metaengine: -- FFMpeg root container metadata entries :
digikam.metaengine: QMap(("compatible_brands", "MSNVmp42isom")("creation_time", "2016-07-25T16:06:42.000000Z")("major_brand", "MSNV")("minor_version", "19595376"))
digikam.metaengine: ------------------------------------------
digikam.metaengine: Loading metadata with "FFMpeg" backend from "/home/gilles/Images/MAH09461.MP4"
digikam.general: Metadata loading with Exiv2 took 109 ms ( true )
digikam.general: "Standard Exif Tags" decoding took 0 ms ( false )
digikam.general: "MakerNote Exif Tags" decoding took 0 ms ( false )
digikam.general: "IPTC Records" decoding took 0 ms ( false )
digikam.general: "XMP Schema" decoding took 0 ms ( false )
digikam.metaengine: ExifTool complete command for action "Load Metadata" with elasped time (ms): 92
digikam.metaengine: Json Array size: 1
digikam.metaengine: ExifTool Json map size: 134
digikam.metaengine: ExifTool parsed command for action "Load Metadata"
digikam.metaengine: 133 properties decoded
digikam.general: Stacked View Mode :  6
digikam.qtav: Not playing~
digikam.general: Database Info populated for QUrl("file:///home/gilles/Images/MAH09461.MP4")
digikam.qtav: Loading  QVariant(QString, "/home/gilles/Images/MAH09461.MP4")  ...
digikam.qtav: all closed and reseted
digikam.qtav: avformat_open_input: d->format_ctx:'0x7f62a00a0300', url:'/home/gilles/Images/MAH09461.MP4'...
digikam.qtav: avformat_open_input: url:'/home/gilles/Images/MAH09461.MP4' ret:0
digikam.qtav: avfmtctx.flags: 2097153 iformat.flags 67141632
digikam.qtav.warn: invalid index 0 (valid is 0~0) for stream type 2.
digikam.qtav: notify_interval: 250
digikam.qtav: stream: 1 duration= 1957888 ( 40789 ms), time_base= 2.08333e-05
digikam.qtav: codec: aac(AAC (Advanced Audio Coding))
digikam.qtav: stream: 0 duration= 1020000 ( 40800 ms), time_base= 4e-05
digikam.qtav: codec: h264(H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10)
digikam.qtav: has audio
digikam.qtav: QtAV::AudioDecoderFFmpeg thread type: Single, count: 1
[ALSOFT] (WW) Querying error state on null context (implicitly 0xa004)
digikam.qtav.warn: OpenAL audioFormatToAL error (null context): 0xa004
digikam.qtav.warn: AudioOutputOpenAL Error: No OpenAL format available for audio data format flt stereo.
digikam.qtav: OpenAL audio format: 0x0 ch:2, sample format: flt
[ALSOFT] (WW) Querying error state on null context (implicitly 0xa004)
digikam.qtav.warn: OpenAL audioFormatToAL error (null context): 0xa004
digikam.qtav.warn: AudioOutputOpenAL Error: No OpenAL format available for audio data format s32 stereo.
digikam.qtav: OpenAL audio format: 0x0 ch:2, sample format: s32
[ALSOFT] (WW) Querying error state on null context (implicitly 0xa004)
digikam.qtav.warn: OpenAL audioFormatToAL error (null context): 0xa004
digikam.qtav: OpenAL audio format: 0x1103 ch:2, sample format: s16
digikam.qtav: AudioOutput format:  QtAV::AudioFormat(48000Hz, 2Bytes, channelCount:2, channelLayout: "stereo", sampleFormat: "s16") ; requested:  QtAV::AudioFormat(48000Hz, 4Bytes, channelCount:2, channelLayout: "stereo", sampleFormat: "fltp")
digikam.qtav: OpenAL opening default device: OpenAL Soft
[ALSOFT] (EE) Failed to set real-time priority for thread: Operation not permitted (1)
digikam.qtav: AudioOutputOpenAL creating context...
digikam.qtav: OpenAL 1.1 ALSOFT 1.21.0 vendor: OpenAL Community; renderer: OpenAL Soft
digikam.qtav: device: 0x3013490, context: 0x28a3b50
digikam.qtav: OpenAL audio format: 0x1103 ch:2, sample format: s16
digikam.qtav: AudioOutputOpenAL open ok...
digikam.qtav: AudioOutputOpenAL: !AL_PLAYING alSourcePlay
digikam.qtav.warn: src audio parameters 'channel layout(or channels),sample rate and sample format must be set before initialize resampler
digikam.qtav: new audio thread
digikam.qtav: demux thread setAudioThread
digikam.qtav: output not changed: 0x3af41a0
digikam.qtav: set AVThread output
digikam.qtav: stream: 1 duration= 1957888 ( 40789 ms), time_base= 2.08333e-05
digikam.qtav: codec: aac(AAC (Advanced Audio Coding))
digikam.qtav: Trying video decoder: FFmpeg
digikam.qtav: QtAV::VideoDecoderFFmpeg thread type: Frame, count: 5
digikam.qtav: Video decoder found: 0x1a90640
digikam.qtav: setCapture 0x3567b90
digikam.qtav: stream: 0 duration= 1020000 ( 40800 ms), time_base= 4e-05
digikam.qtav: codec: h264(H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10)
digikam.qtav: auto select clock: audio > external
digikam.qtav: Using AudioClock
digikam.qtav: Clock initial value: 0.000000
digikam.qtav: Starting audio thread...
digikam.qtav: Starting video thread...
digikam.qtav: get av queue a/v thread = 0x28850c0 0x137f4e0
digikam.general: Found video orientation: 0
digikam.qtav.warn: no frame could be decompressed: Error number 400297 occurred 0/400297
digikam.qtav.warn: invalid video frame from decoder. undecoded data size: 0
digikam.qtav: AVClock started!!!!!!!!
digikam.metaengine: ExifTool "Load Metadata" "-json -G:0:1:2:4:6 -l /home/gilles/Images/MAH09461.MP4"
digikam.metaengine: Parse metadada with FFMpeg: "/home/gilles/Images/MAH09461.MP4"
digikam.qtav.warn: no frame could be decompressed: Error number 24166 occurred 0/24166
digikam.qtav.warn: invalid video frame from decoder. undecoded data size: 0
digikam.qtav: swr speed=1.00
digikam.qtav: out: {cl: 3, fmt: s16, freq: 48000}
digikam.qtav: in {cl: 3, fmt: fltp, freq: 48000}
digikam.qtav.warn: no frame could be decompressed: Error number 81586 occurred 0/81586
digikam.qtav.warn: invalid video frame from decoder. undecoded data size: 0
digikam.metaengine: ExifToolProcess::readOutput(): ExifTool command completed
digikam.metaengine: -- FFMpeg video stream metadata entries :
digikam.metaengine: QMap(("creation_time", "2016-07-25T16:06:42.000000Z")("encoder", "AVC Coding")("handler_name", "Video Media Handler")("language", "und")("vendor_id", "[0][0][0][0]"))
digikam.metaengine: -----------------------------------------
digikam.metaengine: -- FFMpeg audio stream metadata entries :
digikam.metaengine: QMap(("creation_time", "2016-07-25T16:06:42.000000Z")("handler_name", "Sound Media Handler")("language", "und")("vendor_id", "[0][0][0][0]"))
digikam.metaengine: -----------------------------------------
digikam.metaengine: -- FFMpeg root container metadata entries :
digikam.metaengine: QMap(("compatible_brands", "MSNVmp42isom")("creation_time", "2016-07-25T16:06:42.000000Z")("major_brand", "MSNV")("minor_version", "19595376"))
digikam.metaengine: ------------------------------------------
digikam.metaengine: Loading metadata with "FFMpeg" backend from "/home/gilles/Images/MAH09461.MP4"
digikam.general: Metadata loading with Exiv2 took 86 ms ( true )
digikam.general: "Standard Exif Tags" decoding took 0 ms ( false )
digikam.general: "MakerNote Exif Tags" decoding took 0 ms ( false )
digikam.general: "IPTC Records" decoding took 0 ms ( false )
digikam.general: "XMP Schema" decoding took 0 ms ( false )
digikam.general: Stacked View Mode :  6
digikam.qtav.warn: no frame could be decompressed: Error number 19588 occurred 0/19588
digikam.qtav.warn: invalid video frame from decoder. undecoded data size: 0
digikam.metaengine: ExifTool complete command for action "Load Metadata" with elasped time (ms): 63
digikam.metaengine: Json Array size: 1
digikam.metaengine: ExifTool Json map size: 134
digikam.metaengine: ExifTool parsed command for action "Load Metadata"
digikam.metaengine: 133 properties decoded
digikam.qtav.warn: no frame could be decompressed: Error number 63015 occurred 0/63015
digikam.qtav.warn: invalid video frame from decoder. undecoded data size: 0
digikam.qtav: setInSize => calculating aspect ratio from converted input data(1.777778)
...

There are some error from ffmpeg, but nothing block the video stream played in digiKam.

Gilles
Comment 30 caulier.gilles 2022-05-26 07:43:57 UTC
Note : the FFMPEG 4 compiled come from the n4.3.2 tag from git. It compiled with the same bootstrap script than FFMPEG 5.

Gilles
Comment 31 caulier.gilles 2022-05-27 08:56:57 UTC
Hi Bernhard and Maik,

I think the dysfunction is located in AVDumex class, responsible of rerouting audio and video streams processed by ffmpeg

Also, it still plenty of deprecated ffmpeg calls to fix, and the dysfunctions can be located here.

Gilles
Comment 32 caulier.gilles 2022-05-29 10:29:35 UTC
With avplayer, i can see interresting report from the console when playing the MP4 file :

digikam.qtav: AudioOutputOpenAL open ok...
digikam.qtav: AudioOutputOpenAL: !AL_PLAYING alSourcePlay
digikam.qtav.warn: src audio parameters 'channel layout(or channels),sample rate and sample format must be set before initialize resampler <=== !!!
digikam.qtav: new audio thread
...
digikam.qtav.warn: Decode audio failed. undecoded: 0
digikam.qtav.warn: [FFmpeg:h264] illegal short term buffer state detected
digikam.qtav: buffersrc_args=video_size=1440x1080:pix_fmt=0:time_base=1/1000000:pixel_aspect=1/1
digikam.qtav.warn: [FFmpeg:?] No such filter: ''
digikam.qtav.warn: [FFmpeg:?] Error avfilter_graph_parse_ptr(filter_graph, options.toUtf8().constData(), &inputs, &outputs, nullptr) @283 /home/gilles/Devel/8.x/core/libs/video/qtav/src/filter/LibAVFilter.cpp: (0xffffffea) Invalid argument
digikam.qtav.warn: setup video filter graph error  <=== !!!

This can explain why the video only show 2 frames before to be frozen...

Gilles
Comment 33 Maik Qualmann 2022-05-29 19:35:29 UTC
I'm on FFmpeg5 now too. I think the handling of AVCodecParameters and AVCodecContext is incorrect. Just take a look...

Maik
Comment 34 caulier.gilles 2022-06-02 09:35:42 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 453840

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
Comment 35 caulier.gilles 2022-09-30 12:21:58 UTC
Maik,

From the Qt 6.4 announcement:

https://www.qt.io/blog/qt-6.4-released

... ffmpeg 5 support is now in production with QtMultimedia module :

"
We have added an FFMPEG-based multimedia backend, which provides consistent audio and video functionality on all platforms. For video playback we have improved the color space handling and HDR support, and applications can inject subtitles to QVideoFrames.

A new feature under technology preview is support for spatial audio. You can now create three-dimensional sound scenes, where Qt emulates a virtual room with sound characteristics based on the size of the room, the material of the walls and floor, and the position of the listener. This feature is in technology preview.
"

So, with Qt6, we have an official replacement for a long time.

Gilles
Comment 36 Maik Qualmann 2022-09-30 19:17:42 UTC
Yes, the Qt6 Multimedia API is quite different from Qt5 and has many interesting features. I had started with a port to QtMultimedia, stopped for the moment as Qt6 is different in many ways. I also think Qt6 multimedia might be the way to go in the future.

Maik
Comment 37 caulier.gilles 2022-09-30 20:24:01 UTC
yes, i agree. with Qt6, QtMultimedia must be used in place.

Gilles
Comment 38 caulier.gilles 2022-12-09 09:20:44 UTC
*** Bug 462810 has been marked as a duplicate of this bug. ***
Comment 39 caulier.gilles 2023-03-14 15:49:31 UTC
Hi MAik,

I just discovered this forked project from QtAV in github :

https://github.com/valbok/QtAVPlayer

This one is maintained port to Qt6 and compatible with Qt5 and work fine with ffmpeg 5 API.

Code is simplified and used in background some part of Qt::multimedia, especially for the Widget.

Here is compiled the project with cmake and played some video with the example program, and i surprised to see al work as expected, including the sound.

As i can see the API change a little bit, but it can be a simple way to fix for a moment the internal video player. 

I patched a little it the cmake compilation rules to use Qt5 and build the video_widget sample.

Gilles
Comment 40 caulier.gilles 2023-03-14 15:52:54 UTC
Created attachment 157274 [details]
small qtavplayer git/master cmake patch
Comment 41 Brad Smith 2023-05-16 03:34:30 UTC
The DigiKam documentation still references the use of an optional external copy of QtAV. Isn't that no longer the case with 8.0.0?
Comment 42 caulier.gilles 2023-05-16 03:37:17 UTC
which digiKam doc ?

And yes, QtAv code have been ported inside digiKam core :

https://invent.kde.org/graphics/digikam/-/tree/master/core/libs/video/qtav

Gilles Caulier
Comment 43 Brad Smith 2023-05-16 03:42:23 UTC
Here.. https://www.digikam.org/api/
Comment 44 Brad Smith 2023-05-16 03:44:14 UTC
I also ask as our OpenBSD package has been updated to 8.0.0, but still has the external dependency and comment saying DigiKam dlopen's QtAV which I can't find any indication of that being so.
Comment 45 caulier.gilles 2023-05-16 04:05:49 UTC
Ah yes, the API doc is outdated online, but already patched about dependencies list in Doxygen code...

for the external QtAv deps in OpenBSD, you can drop it definitively. I don't know about the dlopen().

Gilles
Comment 46 caulier.gilles 2023-05-26 06:04:45 UTC
Hi Maik,

Did you take a look to the QtAVPlayer project from my comment 39 ?

The patch from comment 40 is not necessary anymore. I tested the code to play with the example application from this project, and this work fine here.

Gilles
Comment 47 Maik Qualmann 2023-05-26 08:16:15 UTC
Hmm, the QtAV Player project looks interesting. Anything against using it?

Maik
Comment 48 caulier.gilles 2023-05-26 20:32:39 UTC
I don't yet contacted the developer.

I take a look in code, ad it mostly inspired from QtAV, but some parts are disappear, and other one completely re-written. As i seen, the widget to display video come from QtMultimedia, but the backend is ffmpeg. Code is compatible with Qt5 and Qt6, and recent ffmpeg API are supported.

The Q are : playing files are enough stable without time latency ? Sound work as expected and well synchronized with video ?

If feedback is fine, we can include this code as well in DK core, after to talk with the developer to known the status of the implementations and the plan for the future.

Gilles
Comment 49 caulier.gilles 2023-10-11 05:55:28 UTC
Hi,

With Qt6, we will left the QtAv library even if code have been integrated in digiKam core. It's too much work to maintain this implementation in time.

QtMultimedia is back in digiKam with Qt6. It's now based by default on ffmpeg backend under Linux, MacOS and Windows. We plan to release digiKam based on Qt6 when KDE plasma 6 will out, typically in February 2024.

Media PLayer is now ported to Qt6Multimedia. It still the video encoder from the VideoSlideshow plugin which still to use some classes from QtAV, but we plan to fix it too in the future.

Gilles Caulier
Comment 50 caulier.gilles 2023-12-13 10:58:57 UTC
Git commit 44da06a0b008eb4030ae59e57c11a1341c157c8c by Gilles Caulier.
Committed on 13/12/2023 at 11:53.
Pushed by cgilles into branch 'master'.

Remove ENABLE_QTMULTIMEDIA cmake option.
Auto-detect automatically the mediaplyer to use : Qt5:QtAV | Qt6:QtMultimedia
Separate ffmpeg rules in a separate cmake script
Disable VideoSlideshow tool with Qt6: It needs to be ported to FFmpeg API instead QtAV
Note: now with Qt6, QtAV codes are not compiled at all.
Related: bug 472503

M  +0    -1    Mainpage.dox
M  +0    -1    bootstrap.linux
M  +0    -1    bootstrap.tarball
M  +0    -1    bootstrap.vcpkg
M  +1    -0    core/CMakeLists.txt
M  +9    -1    core/app/DigikamCoreTarget.cmake
A  +107  -0    core/cmake/rules/RulesFFmpeg.cmake
M  +269  -364  core/cmake/rules/RulesMediaPlayer.cmake
M  +0    -1    core/cmake/rules/RulesOptionDefinitions.cmake
M  +10   -2    core/dplugins/generic/tools/CMakeLists.txt
M  +12   -12   core/libs/video/CMakeLists.txt
R  +0    -0    core/libs/video/ffmpegconfighelper.cpp [from: core/libs/video/qtav/ffmpeg/ffmpegconfighelper.cpp - 100% similarity]
R  +0    -0    core/libs/video/ffmpegconfighelper.h [from: core/libs/video/qtav/ffmpeg/ffmpegconfighelper.h - 100% similarity]
M  +1    -1    core/tests/CMakeLists.txt
M  +0    -1    project/bundles/appimage/03-build-digikam.sh
M  +1    -1    project/bundles/macports/03-build-digikam.sh

https://invent.kde.org/graphics/digikam/-/commit/44da06a0b008eb4030ae59e57c11a1341c157c8c
Comment 51 caulier.gilles 2024-01-03 16:19:12 UTC
Git commit 5c0ce6aa787931b22bde21c50c6fa492883ae564 by Gilles Caulier.
Committed on 03/01/2024 at 16:56.
Pushed by cgilles into branch 'master'.

Add ffmpeg CLI binary finder for Video Slideshow.
Prepare to port the plugin to use the FFmpeg CLI tool instead QtAV (Qt6Multimedia cannot be used here).
NOTE: VideoSlideshow plugin is the last part of the Qt6 port of digiKam using QtAV.
Related: bug 472503, bug 425284, bug 427221, bug 139781, bug 462810

M  +1    -1    core/dplugins/generic/tools/videoslideshow/videoslideshowplugin.cpp
M  +1    -0    core/libs/video/CMakeLists.txt
A  +43   -0    core/libs/video/manager/ffmpegbinary.cpp     [License: GPL(v2.0+)]
A  +38   -0    core/libs/video/manager/ffmpegbinary.h     [License: GPL(v2.0+)]

https://invent.kde.org/graphics/digikam/-/commit/5c0ce6aa787931b22bde21c50c6fa492883ae564
Comment 52 caulier.gilles 2024-01-03 17:17:16 UTC
Git commit 420608c891d65372095db103bf8e795ffb289359 by Gilles Caulier.
Committed on 03/01/2024 at 18:16.
Pushed by cgilles into branch 'master'.

restore previous videoslideshow settings including audio track support
Related: bug 472503, bug 425284, bug 427221, bug 139781, bug 462810

M  +173  -10   core/libs/video/manager/qtav/vidslidetask.cpp
M  +1    -1    core/libs/video/manager/qtav/vidslidetask.h
M  +5    -1    core/libs/video/manager/vidslidesettings.cpp
M  +3    -1    core/libs/video/manager/vidslidesettings.h

https://invent.kde.org/graphics/digikam/-/commit/420608c891d65372095db103bf8e795ffb289359
Comment 53 caulier.gilles 2024-01-03 22:34:43 UTC
Git commit 4ff9e0d9fedf3189f62cbd3f0de64657bcc64116 by Gilles Caulier.
Committed on 03/01/2024 at 23:34.
Pushed by cgilles into branch 'master'.

add ffmpeg path tp the settings
Related: bug 472503, bug 425284, bug 427221, bug 139781, bug 462810

M  +1    -0    core/libs/video/manager/vidslidesettings.h

https://invent.kde.org/graphics/digikam/-/commit/4ff9e0d9fedf3189f62cbd3f0de64657bcc64116
Comment 54 caulier.gilles 2024-01-03 22:47:46 UTC
Git commit 982a06b8e1973a8447cac2ab92503f20a3f4fdfc by Gilles Caulier.
Committed on 03/01/2024 at 23:46.
Pushed by cgilles into branch 'master'.

add FFMpeg binary search in the wizard
Related: bug 472503, bug 425284, bug 427221, bug 139781, bug 462810

M  +12   -9    core/dplugins/generic/tools/videoslideshow/wizard/vidslidefinalpage.cpp
M  +45   -9    core/dplugins/generic/tools/videoslideshow/wizard/vidslideintropage.cpp
M  +3    -8    core/dplugins/generic/tools/videoslideshow/wizard/vidslideoutputpage.cpp
M  +3    -8    core/dplugins/generic/tools/videoslideshow/wizard/vidslidevideopage.cpp

https://invent.kde.org/graphics/digikam/-/commit/982a06b8e1973a8447cac2ab92503f20a3f4fdfc
Comment 55 caulier.gilles 2024-01-04 10:30:24 UTC
Git commit 2eb84eeb93994d93c4b3f4bdb001cba2fba67fb1 by Gilles Caulier.
Committed on 04/01/2024 at 11:26.
Pushed by cgilles into branch 'master'.

Complete isolation of QtAv code.
Tested with Qt5 and Qt5.
Tested with and without mediaplayer cmake option.
The linking problem with QtAv was the auto reccursive parsing of header file in whole source repository. QtAv was always parsed and add to the compilation rules.
Not qtav and qtmm are removed from the parse and add at the demand when necessary.
Continue to port VideoSlideshw to FFmpeg CLI tool to drop QtAV (Qt5 and Qt6).
Related: bug 472503, bug 425284, bug 427221, bug 139781, bug 462810

M  +6    -2    core/CMakeLists.txt
M  +27   -0    core/cmake/rules/RulesMediaPlayer.cmake
M  +1    -1    core/dplugins/generic/tools/CMakeLists.txt
M  +3    -4    core/dplugins/generic/tools/videoslideshow/wizard/vidslidefinalpage.cpp
M  +6    -8    core/libs/video/CMakeLists.txt

https://invent.kde.org/graphics/digikam/-/commit/2eb84eeb93994d93c4b3f4bdb001cba2fba67fb1
Comment 56 caulier.gilles 2024-01-04 12:43:24 UTC
Git commit 002af12bc3aad5cdfff34f2e6dd4eed71310df66 by Gilles Caulier.
Committed on 04/01/2024 at 13:42.
Pushed by cgilles into branch 'master'.

add C++17 support
use QString instead QUrl for the video output path
Related: bug 472503, bug 425284, bug 427221, bug 139781, bug 462810

M  +5    -9    core/dplugins/generic/tools/videoslideshow/wizard/vidslidealbumspage.cpp
M  +8    -15   core/dplugins/generic/tools/videoslideshow/wizard/vidslidefinalpage.cpp
M  +4    -6    core/dplugins/generic/tools/videoslideshow/wizard/vidslideimagespage.cpp
M  +9    -15   core/dplugins/generic/tools/videoslideshow/wizard/vidslideoutputpage.cpp
M  +12   -24   core/dplugins/generic/tools/videoslideshow/wizard/vidslidevideopage.cpp
M  +11   -21   core/dplugins/generic/tools/videoslideshow/wizard/vidslidewizard.cpp
M  +2    -2    core/libs/video/manager/vidslidesettings.cpp
M  +1    -1    core/libs/video/manager/vidslidesettings.h

https://invent.kde.org/graphics/digikam/-/commit/002af12bc3aad5cdfff34f2e6dd4eed71310df66
Comment 57 caulier.gilles 2024-01-04 14:10:24 UTC
Git commit 58ece9388d0a3ef6ba90db979902ba7cbf2a9b84 by Gilles Caulier.
Committed on 04/01/2024 at 15:07.
Pushed by cgilles into branch 'master'.

new video slideshow task to encode frame as temporary JPEG files.
This JPEG stream will be pipe to the FFmpeg cli tool to encode as video.

M  +2    -3    core/libs/video/CMakeLists.txt
D  +0    -452  core/libs/video/manager/qtav/vidslidetask.cpp
A  +184  -0    core/libs/video/manager/vidslidetask.cpp     [License: GPL(v2.0+)]
R  +0    -0    core/libs/video/manager/vidslidetask.h [from: core/libs/video/manager/qtav/vidslidetask.h - 100% similarity]

https://invent.kde.org/graphics/digikam/-/commit/58ece9388d0a3ef6ba90db979902ba7cbf2a9b84
Comment 58 caulier.gilles 2024-01-04 14:18:15 UTC
Git commit ae723b3daa572b4fa26fbe820b4f9b3131979b6c by Gilles Caulier.
Committed on 04/01/2024 at 15:16.
Pushed by cgilles into branch 'master'.

start the encoding thread to generate temprary JPEG frame before encode video with FFMPEG
Related: bug 472503, bug 425284, bug 427221, bug 139781, bug 462810

M  +13   -9    core/dplugins/generic/tools/videoslideshow/wizard/vidslidefinalpage.cpp

https://invent.kde.org/graphics/digikam/-/commit/ae723b3daa572b4fa26fbe820b4f9b3131979b6c
Comment 59 caulier.gilles 2024-01-04 15:26:07 UTC
Git commit 7c0981484d4371bd1e5ff7db5da6785f9393f65b by Gilles Caulier.
Committed on 04/01/2024 at 16:25.
Pushed by cgilles into branch 'master'.

Create a temporary directory to host JPEG frames
Related: bug 472503, bug 425284, bug 427221, bug 139781, bug 462810

M  +1    -1    core/dplugins/generic/tools/CMakeLists.txt
M  +23   -8    core/libs/video/manager/vidslidetask.cpp

https://invent.kde.org/graphics/digikam/-/commit/7c0981484d4371bd1e5ff7db5da6785f9393f65b
Comment 60 caulier.gilles 2024-01-05 13:50:34 UTC
Git commit dd325854d3021dacb139d387bd37544bf89d3df8 by Gilles Caulier.
Committed on 05/01/2024 at 14:45.
Pushed by cgilles into branch 'master'.

First version for testing of the new video slideshow tool based on FFmpeg CLI tool to encode images as video.

A small demo is available here: https://drive.google.com/file/d/1posBo2rqkatU7N6qkbZWGBbOELsUGdgg/view?usp=sharing

It still plenty of features to restore, as to adjust the codecs, the size, the frame rate, the format. The audio track must be supported too.
Currently the temporary directory containing frames to encode is not yet deleted at end, it's for debuging.
It's planed to remove temp dir when all features will be completed.
Related: bug 472503, bug 425284, bug 427221, bug 139781, bug 462810

M  +1    -3    core/dplugins/generic/tools/CMakeLists.txt
M  +1    -1    core/dplugins/generic/tools/videoslideshow/wizard/vidslidefinalpage.cpp
M  +6    -6    core/libs/video/manager/ffmpeglauncher.cpp
M  +17   -4    core/libs/video/manager/vidslidethread.cpp
M  +15   -1    core/libs/video/manager/vidslidethread.h

https://invent.kde.org/graphics/digikam/-/commit/dd325854d3021dacb139d387bd37544bf89d3df8
Comment 61 caulier.gilles 2024-01-07 11:21:50 UTC
Git commit 90b508130131d470ef6051e0296d24f058bd85b1 by Gilles Caulier.
Committed on 07/01/2024 at 12:20.
Pushed by cgilles into branch 'master'.

run the ffmpeg process in a separate thread to not block the GUI while encoding frames.
Related: bug 472503, bug 425284, bug 427221, bug 139781, bug 462810

M  +6    -1    core/libs/threads/processlauncher.cpp
M  +6    -2    core/libs/threads/processlauncher.h

https://invent.kde.org/graphics/digikam/-/commit/90b508130131d470ef6051e0296d24f058bd85b1
Comment 62 caulier.gilles 2024-01-10 06:49:33 UTC
Hi Maik,

The QtAV code is not used anymore in Qt6 version of digiKam. FFmpeg and Qt6Multimedia is used everywhere instead.

For the Qt5 version QtAv still used and it's introduce plenty of dysfunctions that i can reproduce on my computers using Kubuntu 22.04, 22.10, 23.04 and 23.10. In certain cases, i must reboot my computer as the sound system is locked in background and this introduce long time latency, for ex with firefox going to youtube, or when Plasma want to play an event sound. The computer become more and more unusable.

The Qt5 version only use QtAV to:

- Play video in preview or slideshow : 

https://invent.kde.org/graphics/digikam/-/tree/master/core/libs/video/player/qtav?ref_type=heads

- Play audio tracks in Presentation tool :

https://invent.kde.org/graphics/digikam/-/tree/master/core/dplugins/generic/view/presentation/audio?ref_type=heads

There is an alternative to QtAV for Qt5 : QtAVPlayer.

https://github.com/valbok/QtAVPlayer/tree/master/src/QtAVPlayer

The code is lightened compared to QtAV. There is no extra code to rendering video on widget as it use the Qt5Multimedia API. Encoding and Decoding API is also dropped. Only the player code still here, based on FFmpeg.

I tried this demo player on all my computer, and it works as expected :

https://github.com/valbok/QtAVPlayer/blob/master/examples/widget_video/main.cpp
I will investigate in a dedicated branch to use this code instead QtAv in digiKam.

Gilles
Comment 63 caulier.gilles 2024-01-26 12:47:49 UTC
Git commit 79ac8d6e9cb90c8d9b456405051ec0937f8485fe by Gilles Caulier.
Committed on 26/01/2024 at 13:44.
Pushed by cgilles into branch 'master'.

Preview and Slideshow of video is now rendered with Qt6::Multimedia and Qt5::QtAVPlayer.
Older and unmaintained QtAV framework code used in digiKam core is fully removed.
Both Qt6::Multimedia and Qt5::QtAVPlayer are based and compatible to FFMpeg API 5 and later.
Related: bug 468572, bug 382582, bug 435660, bug 471199, bug 478314, bug 445422, bug 477031, bug 478613
FIXED-IN: 8.3.0

M  +12   -9    NEWS

https://invent.kde.org/graphics/digikam/-/commit/79ac8d6e9cb90c8d9b456405051ec0937f8485fe