Bug 166055 - Crash when inserting .mp4 videos in Impress (kf6)
Summary: Crash when inserting .mp4 videos in Impress (kf6)
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Impress (show other bugs)
Version:
(earliest affected)
24.8.6.2 release
Hardware: x86-64 (AMD64) Linux (All)
: medium normal
Assignee: Michael Weghorn
URL:
Whiteboard: target:25.8.0 target:25.2.3 target:25...
Keywords:
Depends on:
Blocks: Qt6
  Show dependency treegraph
 
Reported: 2025-04-06 18:20 UTC by bilaltasdelen
Modified: 2025-05-03 12:10 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:


Attachments
Terminal output during the bug. (1.32 KB, text/plain)
2025-04-07 17:24 UTC, bilaltasdelen
Details
GDB trace of crash (28.21 KB, text/plain)
2025-05-02 06:42 UTC, Buovjaga
Details

Note You need to log in before you can comment on or make changes to this bug.
Description bilaltasdelen 2025-04-06 18:20:28 UTC
Description:
Whenever I try to insert an .mp4 video, either by dragging or using the insert menu, Impress starts to fill the memory, and most of the time gets killed by the OOM killer. If I am able to save before the crash or the Impress stops before getting killed, things turns to normal, and video plays, no problem. I realized that, memory is filled during the thumbnail creation, and stops if the thumbnail is created before the crash. GIFs don't seem to trigger this, but I have not tried another video format.

Steps to Reproduce:
1. Insert an mp4 into a slide in Impress. 
2. Monitor memory consumption.


Actual Results:
Memory is filled, system slows to halt, and Impress gets killed by the system.

Expected Results:
Video inserted successfully without crippling the system.


Reproducible: Always


User Profile Reset: No

Additional Info:
System memory: 32 GB
Comment 1 bilaltasdelen 2025-04-06 22:52:25 UTC
Desktop Environment: KDE Wayland 6.3.4
Integrated GPU: Intel UHD 630
Dedicated GPU: NVIDIA GeForce GTX 1650
Kernel 6.13.8
Comment 2 m_a_riosv 2025-04-07 00:38:38 UTC

*** This bug has been marked as a duplicate of bug 116643 ***
Comment 3 Buovjaga 2025-04-07 05:17:47 UTC
(In reply to m_a_riosv from comment #2)
> 
> *** This bug has been marked as a duplicate of bug 116643 ***

I don't think this is a duplicate of that report because it is about playing a slide in a Powerpoint file and this is about inserting. I have experienced this same memory leak with KDE UI, but for some reason didn't report it. I am not at my normal workstation, so can't test if it still happens with 25.2.

bilaltasdelen: can you try launching with

SAL_USE_VCLPLUGIN=gen libreoffice

or

SAL_USE_VCLPLUGIN=gtk3 libreoffice

and see if that makes a difference. You may also run htop in a different terminal, filter by soffice (F4) and manually kill the process (F9, SIGTERM), if you see the memory starting to leak.

I do see there is bug 164866 for gtk3.
Comment 4 bilaltasdelen 2025-04-07 17:24:52 UTC
Created attachment 200216 [details]
Terminal output during the bug.
Comment 5 bilaltasdelen 2025-04-07 17:25:19 UTC
With both SAL_USE_VCLPLUGIN=gen libreoffice and SAL_USE_VCLPLUGIN=gtk3 libreoffice I was able to insert the video and memory consumption was reasonable. Though, with SAL_USE_VCLPLUGIN=gen libreoffice UI was extremely laggy, and SAL_USE_VCLPLUGIN=gtk3 libreoffice froze once when I played an already inserted video (potentially reproducing bug 164866).

I should add the current version I am testing is 25.2.2.2. I was observing this behavior for some time, though.

Also, in case it is helpful, I attached the errors printed to the console during the video insertion.
Comment 6 bilaltasdelen 2025-04-07 18:35:48 UTC
Additional info: SAL_USE_VCLPLUGIN=kf5 libreoffice also seems to work, and is currently looking to be the most stable and snappy option among the others for my system. It can be a workaround for this bug.
Comment 7 Michael Weghorn 2025-04-08 06:35:06 UTC
I can't reproduce on Debian testing when inserting the Big Buck Bunny movie [1]. Do you reproduce with that particular file as well? Otherwise, can you please attach or provide a link to a sample .mp4 file that triggers this?

Please also paste the complete version information from "Help" -> "About LibreOffice for more details.

Version: 25.8.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: b7e6e0f150a669aa191b16655e6e03d60946c416
CPU threads: 32; OS: Linux 6.12; UI render: default; VCL: qt6 (cairo+wayland)
Locale: en-GB (en_GB.UTF-8); UI: en-US
Calc: CL threaded

[1] https://download.blender.org/peach/bigbuckbunny_movies/BigBuckBunny_320x180.mp4
Comment 8 Michael Weghorn 2025-04-08 06:38:24 UTC
(In reply to Michael Weghorn from comment #7)
> I can't reproduce on Debian testing when inserting the Big Buck Bunny movie
> [1].

While I can't reproduce with that file with my local development build, I actually can with the Debian packaged LibreOffice version. This might be either fixed in a newer version of LibreOffice or related to something else (e.g. different QtMultiMedia video backends being used.)

Version: 25.2.2.2 (X86_64) / LibreOffice Community
Build ID: 520(Build:2)
CPU threads: 32; OS: Linux 6.12; UI render: default; VCL: kf6 (cairo+wayland)
Locale: en-GB (en_GB.UTF-8); UI: en-GB
Debian package version: 4:25.2.2-1
Calc: threaded
Comment 9 bilaltasdelen 2025-04-08 13:27:35 UTC
I can reproduce with Big Buck Bunny video. Sometimes first insertion works, but second insertion triggers the bug. 

Requested information:

Version: 25.2.2.2 (X86_64) / LibreOffice Community
Build ID: 520(Build:2)
CPU threads: 12; OS: Linux 6.13; UI render: default; VCL: kf6 (cairo+wayland)
Locale: en-US (en_US.UTF-8); UI: en-US
25.2.2-1
Calc: CL threaded
Comment 10 Michael Weghorn 2025-04-09 07:55:22 UTC
(In reply to bilaltasdelen from comment #9)
> I can reproduce with Big Buck Bunny video. Sometimes first insertion works,
> but second insertion triggers the bug.

Thanks. I can indeed reproduce the issue with my local dev build as well when I try inserting a video multiple times.

Pending Gerrit change https://gerrit.libreoffice.org/c/core/+/183867 fixes the issue for me with the default ffmpeg QtMultimedia backend.

(For QT_MEDIA_BACKEND=gstreamer, the infinite recursion is also fixed with that change, but it crashes later somewhere in low-level GStreamer code, which *might* possibly be a GStreamer or Qt bug, but I didn't investigate further.)
Comment 11 Commit Notification 2025-04-09 10:20:22 UTC
Michael Weghorn committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/697405b533a8ae5b6a8f5bd184b9344a96f71c69

tdf#166055 qt avmedia: Provide media/player size right away

It will be available in 25.8.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 12 Michael Weghorn 2025-04-09 10:20:48 UTC
Pending backport for 25-2: https://gerrit.libreoffice.org/c/core/+/183914
Comment 13 Commit Notification 2025-04-10 09:02:19 UTC
Michael Weghorn committed a patch related to this issue.
It has been pushed to "libreoffice-25-2":

https://git.libreoffice.org/core/commit/2308a07698660f84e2e11b3fab8cc75550c6798d

tdf#166055 qt avmedia: Provide media/player size right away

It will be available in 25.2.3.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 14 bilaltasdelen 2025-05-02 02:51:33 UTC
I was able to test the bug with 25.2.3 as it just hit the Arch repos. Inserting a video does not cause a memory leak now, but instead Impress crashes immediately. If I recover the document, I see that the video is actually successfully inserted, and plays correctly.

I am able to reproduce the crash with an empty presentation with big buck bunny video. Both, SAL_USE_VCLPLUGIN=kf5 and SAL_USE_VCLPLUGIN=kf6 reproduces the crash.

Do you want me to open a new bug report for this, or is it still related to this one?
Comment 15 Buovjaga 2025-05-02 06:42:10 UTC
Created attachment 200626 [details]
GDB trace of crash

Could be something unrelated, of course, but here is a trace.

Version: 25.8.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: b4ad56ecb6ecd6a75667656817136c34f8bea50e
CPU threads: 8; OS: Linux 6.14; UI render: default; VCL: kf6 (cairo+wayland)
Locale: fi-FI (fi_FI.UTF-8); UI: en-US
Calc: CL threaded
Comment 16 Michael Weghorn 2025-05-02 09:18:23 UTC
(In reply to Buovjaga from comment #15)
> Could be something unrelated, of course, but here is a trace.

Thanks. Backtrace looks quite related.

I can't reproduce with my master build on Debian testing, using qt6.

Some questions:

1) Is there anything useful in the stderr output if you start LO from a terminal? (Ideally with a master debug build or at least `--enable-sal-log`, but QtMultimedia plugins might also print some relevant output.)

2) What QtMultimedia plugins/backends are installed? For example, on Debian testing, I get

    $ ls /usr/lib/x86_64-linux-gnu/qt6/plugins/multimedia/
    libffmpegmediaplugin.so

, i.e. only the ffmpeg, but not the gstreamer plugin is packaged by Debian/installed on the system.

3) Does starting with environment variable QT_MEDIA_BACKEND=ffmpeg or QT_MEDIA_BACKEND=gstreamer make any difference?

Version: 25.8.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: 32c7035824e50429c4ffeb43d0bdf306ba8874e9
CPU threads: 32; OS: Linux 6.12; UI render: default; VCL: qt6 (cairo+wayland)
Locale: en-GB (en_GB.UTF-8); UI: en-US
Calc: threaded
Comment 17 Michael Weghorn 2025-05-02 09:20:33 UTC
(In reply to bilaltasdelen from comment #14)
> I was able to test the bug with 25.2.3 as it just hit the Arch repos.
> Inserting a video does not cause a memory leak now, but instead Impress
> crashes immediately. If I recover the document, I see that the video is
> actually successfully inserted, and plays correctly.
> 
> I am able to reproduce the crash with an empty presentation with big buck
> bunny video. Both, SAL_USE_VCLPLUGIN=kf5 and SAL_USE_VCLPLUGIN=kf6
> reproduces the crash.

When you start with SAL_USE_VCLPLUGIN=kf5, does "Help" -> "About LibreOffice" actually say that "VCL: kf5" is used or is that still kf6? (If Arch doesn't package the kf5 VCL plugin, my assumption would be that kf6 is still used. Otherwise, the kf5 issue would presumably be a different one, as QtMultimedia is only used with qt6/kf6, not qt5/kf5).

> Do you want me to open a new bug report for this, or is it still related to
> this one?

Looks related, let's continue here.
Comment 18 Buovjaga 2025-05-02 11:25:52 UTC
(In reply to Michael Weghorn from comment #16)
> (In reply to Buovjaga from comment #15)
> > Could be something unrelated, of course, but here is a trace.
> 
> Thanks. Backtrace looks quite related.
> 
> I can't reproduce with my master build on Debian testing, using qt6.
> 
> Some questions:
> 
> 1) Is there anything useful in the stderr output if you start LO from a
> terminal? (Ideally with a master debug build or at least `--enable-sal-log`,
> but QtMultimedia plugins might also print some relevant output.)

No, nothing interesting upon startup. Upon adding the file, I get ffmpeg output, but nothing interesting. Only 'Failed to open VDPAU backend libvdpau_nvidia.so: cannot open shared object file: No such file or directory' which is irrelevant I guess as I don't have Nvidia hardware.

> 2) What QtMultimedia plugins/backends are installed? For example, on Debian
> testing, I get
> 
>     $ ls /usr/lib/x86_64-linux-gnu/qt6/plugins/multimedia/
>     libffmpegmediaplugin.so
> 
> , i.e. only the ffmpeg, but not the gstreamer plugin is packaged by
> Debian/installed on the system.

$ LC_ALL=C ls /usr/lib/qt6/plugins/multimedia/
total 1056
-rwxr-xr-x 1 root root 621664 Apr  2 10:31 libffmpegmediaplugin.so
-rwxr-xr-x 1 root root 454672 Apr  2 10:31 libgstreamermediaplugin.so

> 3) Does starting with environment variable QT_MEDIA_BACKEND=ffmpeg or
> QT_MEDIA_BACKEND=gstreamer make any difference?

With gstreamer I did briefly see the thumbnail of the video, but then LibreOffice went into "not responding" mode and finally crashed.
Comment 19 bilaltasdelen 2025-05-02 16:05:28 UTC
> When you start with SAL_USE_VCLPLUGIN=kf5, does "Help" -> "About LibreOffice" 
> actually say that "VCL: kf5" is used or is that still kf6? (If Arch doesn't 
> package the kf5 VCL plugin, my assumption would be that kf6 is still used. 
> Otherwise, the kf5 issue would presumably be a different one, as QtMultimedia
> is only used with qt6/kf6, not qt5/kf5).

Version: 25.2.3.2 (X86_64) / LibreOffice Community
Build ID: 520(Build:2)
CPU threads: 12; OS: Linux 6.14; UI render: default; VCL: kf6 (cairo+xcb)
Locale: en-US (en_US.UTF-8); UI: en-US
25.2.3-1
Calc: CL threaded

You are right, apparently it is still kf6. Weird, I am pretty sure I was working around the memory leak bug at 25.2.2 by setting kf5.

> 1) Is there anything useful in the stderr output if you start LO from a
> terminal? (Ideally with a master debug build or at least `--enable-sal-log`,
> but QtMultimedia plugins might also print some relevant output.)

Same as @Buovjaga, there is an "Unspecified Application Error" printed during the crash.

> 2) What QtMultimedia plugins/backends are installed? For example, on Debian
> testing, I get
> 
>     $ ls /usr/lib/x86_64-linux-gnu/qt6/plugins/multimedia/
>     libffmpegmediaplugin.so
> 
> , i.e. only the ffmpeg, but not the gstreamer plugin is packaged by
> Debian/installed on the system.

$ LC_ALL=C ls -l /usr/lib/qt6/plugins/multimedia/
total 1056
-rwxr-xr-x 1 root root 621664 Apr  2 00:31 libffmpegmediaplugin.so
-rwxr-xr-x 1 root root 454672 Apr  2 00:31 libgstreamermediaplugin.so

> 3) Does starting with environment variable QT_MEDIA_BACKEND=ffmpeg or
> QT_MEDIA_BACKEND=gstreamer make any difference?

Again, same as @Buovjaga. Impress hangs for a while, I see a black box inserted, then crash.
Comment 20 Michael Weghorn 2025-05-02 17:35:55 UTC
Thanks for the additional infos. I also observed (different) issues now when testing some more, quite similar to the original ones. This is related to the way that preview images are generated. Unfortunately QtMultimedia doesn't really have straightforward API for that.

Falling back to using the LibreOffice GStreamer backend for that task should hopefully fix/avoid the problem for now, see pending Gerrit change (more details in the commit message):
https://gerrit.libreoffice.org/c/core/+/184912

(QtMultimedia is still used for actual video playback, which was introduced to make video playback work for qt6/kf6, see tdf#145735).

@Ilmari: Could you please check whether that change also fixes the crash you see?
Comment 21 Buovjaga 2025-05-02 18:09:54 UTC
(In reply to Michael Weghorn from comment #20)
> Thanks for the additional infos. I also observed (different) issues now when
> testing some more, quite similar to the original ones. This is related to
> the way that preview images are generated. Unfortunately QtMultimedia
> doesn't really have straightforward API for that.
> 
> Falling back to using the LibreOffice GStreamer backend for that task should
> hopefully fix/avoid the problem for now, see pending Gerrit change (more
> details in the commit message):
> https://gerrit.libreoffice.org/c/core/+/184912
> 
> (QtMultimedia is still used for actual video playback, which was introduced
> to make video playback work for qt6/kf6, see tdf#145735).
> 
> @Ilmari: Could you please check whether that change also fixes the crash you
> see?

Yes, the change fixes the crash.
Comment 22 Commit Notification 2025-05-02 20:29:20 UTC
Michael Weghorn committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/08533ca4e2526644b803c40c0c3d3c96f43762af

tdf#166055 avmedia qt: Use GStreamer frame grabber by default

It will be available in 25.8.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 23 Michael Weghorn 2025-05-02 20:30:13 UTC
(In reply to Buovjaga from comment #21)
> Yes, the change fixes the crash.

Great, thanks for testing! Merged to master now. Backport for 25.2 pending in Gerrit:
https://gerrit.libreoffice.org/c/core/+/184918
Comment 24 Commit Notification 2025-05-03 12:10:28 UTC
Michael Weghorn committed a patch related to this issue.
It has been pushed to "libreoffice-25-2":

https://git.libreoffice.org/core/commit/4bda0a68ef81a3f3eb5233b35ea046aca5352c88

tdf#166055 avmedia qt: Use GStreamer frame grabber by default

It will be available in 25.2.4.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.