Bug 113622 - Impress can't play MP4 videos (OS X-specific)
Summary: Impress can't play MP4 videos (OS X-specific)
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Impress (show other bugs)
Version:
(earliest affected)
5.3.5.1 rc
Hardware: x86-64 (AMD64) macOS (All)
: highest major
Assignee: How can I remove my account?
URL:
Whiteboard:
Keywords: bibisectRequest, regression
Depends on:
Blocks: Media-Playback
  Show dependency treegraph
 
Reported: 2017-11-03 11:15 UTC by Hadmut Danisch
Modified: 2018-02-28 10:09 UTC (History)
9 users (show)

See Also:
Crash report or crash signature:


Attachments
Demo video (1.17 MB, application/vnd.oasis.opendocument.presentation)
2017-11-06 12:54 UTC, Hadmut Danisch
Details
bt from console log (13.77 KB, text/rtf)
2017-11-11 10:57 UTC, Julien Nabet
Details
Diff of commits between branches 5-3-5 and 5-3-4 (5.78 KB, text/plain)
2017-11-17 18:52 UTC, Xisco Faulí
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Hadmut Danisch 2017-11-03 11:15:40 UTC
Description:
Hi, 
I'm holding a monthly presentation with Impress for more than three years, containing three mp4 videos. Impress was playing this presentation without problem so far on my Mac Book, until Libreoffice 5.2. 

with 5.3 and 5.4 it can't play these videos anymore, just shows a gray window with a note symbol. 

Steps to Reproduce:
1. Have an impress presentation with an mp4 video
2. try to play it
3. get sad

Actual Results:  
Does not show video

Expected Results:
Should show video


Reproducible: Always


User Profile Reset: No



Additional Info:


User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:56.0) Gecko/20100101 Firefox/56.0
Comment 1 Xisco Faulí 2017-11-03 21:29:25 UTC Comment hidden (obsolete)
Comment 2 Hadmut Danisch 2017-11-06 12:54:27 UTC
Created attachment 137568 [details]
Demo video

Freshly made empty presentation with just one blank slide with a video, made on Mac OS X with libreoffice 5.4.2.2 on Mac OS X 10.12.6 five minutes ago.

Although libreoffice allows me to create this presentation, it does not play it. (I had a presentation with that particular video running with libreoffice for years.) 

Same file works with the linux edition of libreoffice.
Comment 3 Alex Thurgood 2017-11-06 14:07:58 UTC
Confirming also with

Version: 6.0.0.0.alpha1+
Build ID: 57c5f980835f834f6ea96c6f5ca841b5372aa61d
CPU threads: 4; OS: Mac OS X 10.13; UI render: default; 
Locale: fr-FR (fr_FR.UTF-8); Calc: group
Comment 4 Alex Thurgood 2017-11-06 14:17:42 UTC
Inserting a MP4 video in Impress in

LibreOffice 3.3.0 
OOO330m19 (Build:6)
tag libreoffice-3.3.0.4

allows both slideshow playback and preview playback

Regression
Comment 5 Alex Thurgood 2017-11-06 14:21:05 UTC
This problem must be dependent on the version with which the Impress file is made as my test file made with OOo3 can be opened and played in 

Version: 5.4.2.2
Build ID: 22b09f6418e8c2d508a9eaf86b2399209b0990f4
Threads CPU : 4; OS : Mac OS X 10.13; UI Render : par défaut; 
Locale : fr-FR (fr_FR.UTF-8); Calc: group
Comment 6 Alex Thurgood 2017-11-06 14:26:28 UTC
Also confirmed in

Version: 5.3.6.1
Build ID: 686f202eff87ef707079aeb7f485847613344eb7
Threads CPU : 4; Version de l'OS :Mac OS X 10.13; UI Render : par défaut; Moteur de mise en page : nouveau; 
Locale : fr-FR (fr_FR.UTF-8); Calc: group


1) Open Impress
2) Insert MP4
3) Try preview playback, then slideshow - no video playback.
Comment 7 Alex Thurgood 2017-11-06 14:29:33 UTC
Works correctly in

Version: 5.2.7.2
Build ID: 2b7f1e640c46ceb28adf43ee075a6e8b8439ed10
Threads CPU : 4; Version de l'OS :Mac OS X 10.13; UI Render : par défaut; 
Locale : fr-FR (fr_FR.UTF-8); Calc: group
Comment 8 Alex Thurgood 2017-11-06 14:33:17 UTC
Also works in

Version: 5.3.1.2
Build ID: e80a0e0fd1875e1696614d24c32df0f95f03deb2
Threads CPU : 4; Version de l'OS :Mac OS X 10.13; UI Render : par défaut; Moteur de mise en page : nouveau; 
Locale : fr-FR (fr_FR.UTF-8); Calc: group
Comment 9 Alex Thurgood 2017-11-06 14:36:14 UTC
Also works in 

Version: 5.3.4.2
Build ID: f82d347ccc0be322489bf7da61d7e4ad13fe2ff3
Threads CPU : 4; Version de l'OS :Mac OS X 10.13; UI Render : par défaut; Moteur de mise en page : nouveau; 
Locale : fr-FR (fr_FR.UTF-8); Calc: group
Comment 10 Alex Thurgood 2017-11-06 14:41:02 UTC
Fails to play video or preview in

Version: 5.4.0.3
Build ID: 7556cbc6811c9d992f4064ab9287069087d7f62c
CPU threads: 4; OS: Mac OS X 10.13; UI render: default; 
Locale: fr-FR (fr_FR.UTF-8); Calc: group
Comment 11 Alex Thurgood 2017-11-06 14:42:26 UTC
Bibisect is in the range from 5.4 branchoff
Comment 12 Julien Nabet 2017-11-11 10:57:30 UTC
Created attachment 137679 [details]
bt from console log

On MacOs 10.12 with master sources updated some days ago, I could reproduce this.
I noticed this log on console:
warn:avmedia:11266:8540134:avmedia/source/macavf/framegrabber.mm:66: AVGrabber::create() found no video content!

I attached a bt from there.
Comment 13 Xisco Faulí 2017-11-15 12:48:03 UTC
Reproduced in

Version: 5.3.5.1
Build ID: 020db1aa8142e57290f8a21e4df31185392d0e38
CPU Threads: 8; OS Version: Mac OS X 10.13; UI Render: default; Layout Engine: new; 
Locale: en-US (en_ES.UTF-8); Calc: group

but not in

Version: 5.3.4.2
Build ID: f82d347ccc0be322489bf7da61d7e4ad13fe2ff3
CPU Threads: 8; OS Version: Mac OS X 10.13; UI Render: default; Layout Engine: new; 
Locale: en-US (en_ES.UTF-8); Calc: group
Comment 15 Xisco Faulí 2017-11-17 18:52:14 UTC
Created attachment 137834 [details]
Diff of commits between branches 5-3-5 and 5-3-4
Comment 16 Xisco Faulí 2017-11-17 23:13:57 UTC
Initially I tried to build branch 5-3-5 but i couldn't because I'm using Sierra, so i decided to revert, in master, the commits one by one but I'm not able to find the culprit.
Anybody has an idea of what's going on here?
Comment 17 Thorsten Behrens (allotropia) 2017-11-17 23:41:17 UTC
Random scattershot guess: b49779db18fa094f3b2f4166ee93c072d2f117a1 or 4e461f61ac739c6b9ff38c247095ea69b9fb4e21
Comment 18 Thorsten Behrens (allotropia) 2017-11-17 23:42:48 UTC
otherwise, changes to baseline would be another reason - Norbert might know
Comment 19 Xisco Faulí 2017-11-18 16:19:25 UTC
(In reply to Thorsten Behrens (CIB) from comment #17)
> Random scattershot guess: b49779db18fa094f3b2f4166ee93c072d2f117a1 or
> 4e461f61ac739c6b9ff38c247095ea69b9fb4e21

I thought b49779db18fa094f3b2f4166ee93c072d2f117a1 was the one too, but I reverted it locally and I got the same problem. Same with the other commit too, sigh!!

Regarding the baseline, is there any way to prove it?
Comment 20 Xisco Faulí 2017-11-22 19:45:23 UTC
I can reproduce it in

Version: 5.4.0.2
Build ID: 2b906d450a44f2bbe506dcd22c51b3fa11dc65fd
CPU threads: 8; OS: Mac OS X 10.12.6; UI render: default; 
Locale: en-US (en_ES.UTF-8); Calc: group

but not in

Version: 5.4.0.1
Build ID: 962a9c4e2f56d1dbdd354b1becda28edd471f4f2
CPU threads: 8; OS: Mac OS X 10.12.6; UI render: default; 
Locale: en-US (en_ES.UTF-8); Calc: group

Since i couldn't compile branch 5.3.5 on Mac, I'm going to try with this branch...
Comment 21 Xisco Faulí 2017-11-22 22:40:30 UTC
This is the range between 5.4.0.2 and 5.4.0.1 -> https://cgit.freedesktop.org/libreoffice/core/log/?h=libreoffice-5-4&qt=range&q=3cde28795a21f4aef2d5882406a3c53e09e67815

I went through the suspicious commits ( I ignored sw, sc and gpg commits) by reverting them and no luck

@Cloph: Do you know if anything changed between 5.4.0.1 and 5.4.0.2 or between 5.3.4.2 and 5.3.5.1 to cause this bug?
Comment 22 Jan-Marek Glogowski 2017-11-23 11:12:08 UTC
My guess would be a4e81b7c313e5cb0e0f23a8605502b4b0b7f599e (Aug 4 2016).

Library_avmediaQuickTime is preferred over the Library_avmediaMacAVF.

Did we update the build bots to newer Apple SDKs around Jul 30 2017, or even a newer OS?

I had a glance at the MacAVF plugin. All this AVPlayer based stuff is supposed to be handled async. My guess is the caching is simply not yet ready, when we try to take a screenshot for the preview image.

Actually I don't see any real handling of the async "playable" or other status.
Don't have really time to fix this, but a lot should be handled async, and there is just a minimal observer, when playback stops - as I understand the code.
Comment 23 Julien Nabet 2017-11-23 11:22:17 UTC
Tor: following last Jan-Marek's comment (comment 22), thought you might be interested in this tracker.
Comment 24 Telesto 2017-11-24 17:31:39 UTC
No QuickTime in the 10.12 SDK
Finally. It has been documented as deprecated for years, after all.

https://cgit.freedesktop.org/libreoffice/core/commit/?id=a4e81b7c313e5cb0e0f23a8605502b4b0b7f599e
Comment 25 How can I remove my account? 2018-01-05 11:07:30 UTC
The video included in the attached document has file name extension .mp4 and is identified by the file command as "ISO Media, MP4 v2 [ISO 14496-14]" and the actual video data has dimension: 480 × 360, codec: H.264, AAC, duration: 00:24, frame rate: 29.97 fps, size: 1.2 MB.

I tried inserting another file that has the extension .mov and is "ISO Media, Apple QuickTime movie, Apple QuickTime (.MOV/QT)" and the video data is 3840 × 1620, H.264, AAC, Timecode, 02:04, 29.97 fps, 724 MB. I.e. the same codec, but MUCH larger. It worked fine.

Then I tried a third file, extension .mp4, "ISO Media, MP4 v2 [ISO 14496-14]", 1920 × 1080, H.264, 00:25, 29.97 fps, 64 MB. It did not work.

So apparently it indeed is the kind of container that matters, not the codec.
Comment 26 How can I remove my account? 2018-01-05 14:03:58 UTC
Presumably the problem is in the avmedia/source/macavf code. Its author is not really active in either OpenOffice or LibreOffice any longer, sadly.
Comment 27 How can I remove my account? 2018-01-05 15:06:15 UTC
Comment #22 sounds correct. Not sure why the current code works for slightly differently encapsulated video file, though.
Comment 28 How can I remove my account? 2018-01-05 16:35:39 UTC Comment hidden (off-topic)
Comment 29 How can I remove my account? 2018-01-05 17:34:15 UTC
I wonder if the currently unused FrameGrabber::create( const ::rtl::OUString& rURL ) function was supposed to be used originally, or perhaps if using that instead of calling the FrameGrabber::create( AVAsset* pMovie ) function from Player::createFrameGrabber() would be relevant in fixing this problem?

Ah, inspecting git log shows that 75c804c1be8acf4c3fc9935b81e696918f33fd9d removed the use of that function. The log message also seems to confirm the idea that the code is wrongly structured, and should be re-factored to use the asynchronous APIs properly (waiting for stuff to be ready) see comment #22.
Comment 30 How can I remove my account? 2018-02-27 09:23:40 UTC
This probably will be fixed by https://gerrit.libreoffice.org/#/c/50390/1 .
Comment 31 How can I remove my account? 2018-02-28 10:07:12 UTC
As this bug report seems to be more narrow in scope, and definitively matches what I fixed in 1aa5a3874bf716acfbded2a09319dce5d4ce8c0d , let's mark this as resolved then.
Comment 32 How can I remove my account? 2018-02-28 10:09:23 UTC
It turned out that the alleged lack of proper use of asynchronous (or "lazy") system APIs in avmedia/source/macavf was not an issue after all, at least not for this issue, but the fix was a completely different one... Quoting the commit message:

    tdf#79546: Make sure temp copy of inserted media file keeps the same extension
    
    Inserting videos into Impress presentations with 'Insert>Audio or
    Video' did not work at all for me. This helps. It seems that the
    AVFoundation APIs are sadly rather picky about file name extensions.
    
    Why we need to make a temporary copy of the media file (which after
    all can be rather large) at all, when inserting it in a slide, I don't
    understand. But I am not going to dig into that now.