Server: Preview of MP4 Videos failing to generate with ffmpeg/avconf if larger than 5MB

Created on 21 Sep 2016  路  8Comments  路  Source: nextcloud/server

Steps to reproduce

  1. Upload MP4 video larger than 5MB, with the moov atom at the end of the file, e.g. from an older android phone. About the moov atom: https://www.adobe.com/devnet/video/articles/mp4_movie_atom.html

    Expected behaviour

Video Thumbnail should be generated, works with MPG files.

Actual behaviour

avconf/ffmpeg fail because only the forst 5MB of the video are taken into account, see https://github.com/nextcloud/server/blob/master/lib/private/Preview/Movie.php#L57

If the moov atom is at the beginning of a video, the preview generation works. If the the moov atom is at end of the video, the generation fails. If it is a local file would it be possible to load it completely? Removing the limit in the stream_get_contents call generates the preview just fine. Or maybe would it be possible to streamline the video using something like qt-faststart first?

Server configuration

Operating system: Debian 8

Web server: Apache 2.4

Database: MySQL

PHP version: PHP 7.0.11

Nextcloud version: Nextcloud 10.0 (stable)

Updated from an older Nextcloud/ownCloud or fresh install: No

Where did you install Nextcloud from: Homepage

Please forgive me if I don't post any other configuration details, IMHO they are not relevant to described behaviour.
``

Most helpful comment

Okay, if you define it as expected behaviour, this is what a user ends up with. I am a first time user of nextcloud (never used owncloud). I wondered why there was no preview of most mp4 videos, so I dug into the code. I think I'm not the only user wondering if this behaviour is an error.

In my case I converted the videos to fast start and my problem is solved. But I think most users expect a working preview generation.

Maybe this is more of feature request, depending on how you see it.

All 8 comments

Hmm, disabling the switch based on storage sounds a bit weird to me.
I'd say this is fine as is, if the file is too big and does not have "progressive download," "fast start," "use streaming mode," or similar options, I guess that is simply what you end up with?

Okay, if you define it as expected behaviour, this is what a user ends up with. I am a first time user of nextcloud (never used owncloud). I wondered why there was no preview of most mp4 videos, so I dug into the code. I think I'm not the only user wondering if this behaviour is an error.

In my case I converted the videos to fast start and my problem is solved. But I think most users expect a working preview generation.

Maybe this is more of feature request, depending on how you see it.

I'm noticing this now, but they're for SMB shares on my local network. Is there a way to force preview generation for videos over 5MB?

AFAIK no, but you could convert the video with ffmpeg to "fast start", as described here.

Or take a look at qt-faststart, which moves the required information to the beginning of the file.

Thanks, but how can I tell nextcloud to use these options when generating previews?

You can't AFAIK. Just run your videos through qt-faststart or ffmpeg in a batch. That's how I solved it.

Alright, thank you for that. I'll take a look.

Really bizarre... 5MB is nothing. This issue was racking my brain for months, as video previews for larger movies worked fine on local storage, but failed over SMB. At least I know why now...

Is there a fix scheduled for this? I'm still failing to generate any video (MP4) thumbnails for files stored on 1Gbps SMB share

Was this page helpful?
0 / 5 - 0 ratings