Skip to content

Video playback on link share page #604

Closed

Description

@jancborchardt

When trying to play a regular mp4 from the share link page, there was this error:
capture du 2016-07-27 14-45-11

We should really be able to play these files, no? cc @oparoz @Instagit @LukasReschke

Activity

  1. added
    1. to develop
    on Jul 27, 2016
  2. icewind1991 commented on Jul 27, 2016

    @icewind1991
    Member

    Being able to play video files is completely dependent on whether your browser feels like it or not

  3. oparoz commented on Jul 27, 2016

    @oparoz
    Member

    As long as we don't analyse every video file which is uploaded to extract some metadata, there is no way to prevent this behaviour.

  4. jancborchardt commented on Jul 27, 2016

    @jancborchardt
    MemberAuthor

    As long as we don't analyse every video file which is uploaded to extract some metadata

    So isn’t this something we should maybe do? ;) Sharing videos is arguably a big usecase.

  5. icewind1991 commented on Jul 27, 2016

    @icewind1991
    Member

    We won't be able to play the video anyway as long as the browser doesn't support it

  6. MorrisJobke commented on Jul 27, 2016

    @MorrisJobke
    Member

    So isn’t this something we should maybe do? ;) Sharing videos is arguably a big usecase.

    The only workaround is to transcode the videos on the server. And you don't want to do this in PHP -.- And it even could take very long. I also thought about this a lot. Maybe something for a nice app, because I had in mind to also transcode videos to a smaller size (depending on the network connection). But I guess this is a bigger task. Even big companies invested a lot of time to get this right and flawlessly :(

    The only way is to upload one of the following video files (container format, video codec, audio codec):

    • WebM with VP8 and Ogg Vorbis
    • MP4 with H264 and MP3
    • MP4 with H264 and AAC

    https://developer.mozilla.org/en-US/docs/Web/HTML/Supported_media_formats#Browser_compatibility

  7. MorrisJobke commented on Jul 27, 2016

    @MorrisJobke
    Member

    WebM with VP8 and Ogg Vorbis

    WebM support on IE and Safari depends on a to be installed codec

    MP4 with H264 and AAC

    AAC is not supported in Chromium

    MP4, H264, MP3, AAC on Firefox:

    To avoid patent issues, support for MPEG 4, H.264 and MP3 is not built directly into Firefox. Instead it relies on support from the OS or hardware (the hardware also needs to be able to support the profile used to encode the video, in the case of MP4). Firefox supports these formats on the following platforms: Windows Vista+ since Firefox 22.0, Android since Firefox 20.0, Firefox OS since Firefox 15.0, Linux since Firefox 26.0 (relies on GStreamer codecs) and OS X 10.7 since Firefox 35.0.

  8. MorrisJobke commented on Jul 27, 2016

    @MorrisJobke
    Member

    @jancborchardt As you see: To play a video file in all available browsers you need at least the video available in 2 different containers, with 2 different audio codecs and 2 different video codecs.

  9. MorrisJobke commented on Jul 27, 2016

    @MorrisJobke
    Member

    I just gave this another try (because I have another use case for myself). And somehow the files aren't played even if they are MP4 with H264 and MP3. I will give this tomorrow another try and hopefully get this sorted out.

  10. self-assigned this
    on Jul 27, 2016
  11. MorrisJobke commented on Jul 28, 2016

    @MorrisJobke
    Member

    I ran into #463. @jancborchardt Did you also use PHP7? Maybe check the server logs and test with the linked PR ;)

  12. removed their assignment
    on Jul 28, 2016
  13. Instagit commented on Jul 29, 2016

    @Instagit

    We discussed video handling before in a different context (showing videos in the gallery) and there are several possible solutions, but they all have drawbacks.

    • use a browser plugin for video playback
    • access metadata with external tool like FFmpeg and store it, so we can always tell which video is compatible with the user's current browser
    • transcode videos in the background after upload
    • transcode videos live

    Maybe another solution is setting up an FAQ page that explains the situation and tells the user in simple steps how to encode videos that can be played by all browsers and linking to that whenever a video can't be played. ℹ️

  14. 1 remaining item

  15. Bugsbane commented on Aug 8, 2016

    @Bugsbane
    Member

    Short term the FAQ link seems to be the best ratio of improvement to effort. Longer term though, I'd say that sharing videos and having them play back is an important enough use case that it would be worth working towards having it work. It's a more complex system, but I'd suggest:

    1. Read the metadata on upload
    2. If the server has FFMPEG installed and an option is enabled in the config file then call that to transcode in the background to mp4+h264+mp3 for Chrome/IE/Edge and Webm+vp8+ogg for Firefox/Chromium.
    3. Use the transcoded version for playback, detecting the user agent to determine the correct version, while the originals are used for any download.
    4. Display the FAQ link instead if we detect any error (eg unrecognized user agent)
  16. MorrisJobke commented on Aug 8, 2016

    @MorrisJobke
    Member

    I'm open to help out here (especially for the first steps with showing a FAQ on error, but if somebody wants to do this: feel free :) I will assign me once I start working on it.

  17. Instagit commented on Aug 8, 2016

    @Instagit

    If the server has FFMPEG installed and an option is enabled in the config file then call that to transcode in the background to mp4+h264+mp3 for Chrome/IE/Edge and Webm+vp8+ogg for Firefox/Chromium.

    We've considered that in the other issue I linked. The problem is that real-time transcoding requires quite decent hardware. It would need to encode at 25+ FPS, even for full HD (and in the future 4k), and while we have no hardware statistics, we can assume that many users run Nextcloud on low-powered media boxes, virtual servers etc. I have an i7 and depending on the video content, resolution and encoding options, I can't even reliably hit 25 FPS with that.

    Transcoding automatically in the background can be configured to be easier on the hardware, but requires a lot of disk space. Either way, it will only solve the problem for a few users, but maybe it's a nice feature to have anyway. When it's implemented, we could also offer on-demand transcoding for single videos and that would give users some good options.

  18. MorrisJobke commented on Aug 8, 2016

    @MorrisJobke
    Member

    Maybe it would also be nice to have specific app that transcode in a background job and places the file then in a "cache" directory. Then when requested this pre-transcoded files could be used and would also allow to transcode to a smaller version (360p, 480p, 720p, 1080p for example).

  19. LukasReschke commented on Aug 8, 2016

    @LukasReschke
    Member

    We can't do any FFMPEG background transcode processes invoked by the same PHP process. That is totally insecure. What you could do is having an app that runs on another server and there invokes some docker magic to securely transcode the videos in a container.

  20. LukasReschke commented on Aug 8, 2016

    @LukasReschke
    Member

    https://habrahabr.ru/company/mailru/blog/274855/ has a good example of why we can't use ffmpeg in a trusted environment on untrusted user data.

    Basically: it's defined behaviour of ffmpeg to not use it on untrusted data.

  21. jospoortvliet commented on Aug 16, 2016

    @jospoortvliet
    Member

    At least #463 fixes, for my Nextcloud, the problem. Well, the patch doesn't apply (Hunk 1 out of 1 failed) but manually changing 'split' to 'explode' on line 191 of the lib/private/files.php makes videos play properly in a share.

  22. Newan commented on Aug 25, 2016

    @Newan

    I have the same problem.
    But intern (login in with the video owner) run the video. Only on the share link it doesn´t

  23. bulleric commented on Sep 7, 2016

    @bulleric

    Got the same issue... Is it fixed in master?

  24. Instagit commented on Nov 16, 2016

    @Instagit

    We can't do any FFMPEG background transcode processes invoked by the same PHP process. That is totally insecure. What you could do is having an app that runs on another server and there invokes some docker magic to securely transcode the videos in a container.

    Using Docker would be nice, it can even run a transcoding web service on the same machine - but is it really an option? Docker can be quite difficult to set up on some systems.

    For the realistic short-term improvement, an FAQ page, what would it include and how would it be implemented (local page, link to documentation)? I suggest a link to a list of supported browser formats (1 [1], 2, 3) and a program that can transcode videos and is easy to use (Handbrake is probably the best open source, cross-platform option).

    [1] The data from caniuse.com is available as JSON so it could be presented in a more compact form for all required formats.

  25. added
    stale
    on Jun 20, 2018
  26. removed
    stale
    on Jun 12, 2019
  27. szaimen commented on May 21, 2021

    @szaimen
    Contributor

    If the videoplayer app installed, it works fine in my testing.
    So since I cannot reproduce the original issue anymore, I will close this ticket. If this is still happening please make sure to upgrade to the latest version. After that, feel free to reopen.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    1. to developbugfeature: sharing

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions