nextcloud / files_videoplayer

:vhs: Old video viewer for Nextcloud
91 stars 37 forks source link

Support .mkv and .avi -- or other container formats #9

Closed naclander closed 7 years ago

naclander commented 7 years ago

I am not able to view .mkv or .avi container formats on either Chromium or Firefox, regardless of encoding format.

Instagit commented 7 years ago

AVI: [edit] Does not work as browsers don't support it.

MKV: Works for some files as of this commit, at least in Chrome, because it's very similar to WebM, but it's not officially supported by Firefox or Chrome.

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

naclander commented 7 years ago

The linked video file is a .mp4 file, and works fine. I would need to convert that file to an .avi format, and test it, but I will need to figure out how to do that.

I don't know about Chrome, but Chromium and Firefox refuse to play .mkv or .avi regardless of encoded format. This might work in Chrome but I have no way to test this. My only direct comparison against the Nextcloud video player is the Dropbox video player, which manages to play any .mkv or .avi files I have without issues.

I will attempt to convert the linked .mp4 file above to an .avi file and an .mkv file, and let you know if I can successfully play it.

Instagit commented 7 years ago

Sorry, what I said is wrong. MP4 works, AVI does not. The browsers don't support the AVI container format.

There are several ways to get unsupported formats to work. I guess Dropbox converts videos to a supported format when you upload them, like YouTube. We can't do that for performance reasons.

Discussions about improving video support can be found here and here, but it's difficult as every implementation has drawbacks.

serenity-networks commented 7 years ago

Actually, videojs has plugins that will allow all AVI, MP4, MOV, MKV, FLV and others to play. It would be GREAT it someone could write a quick how to on how to enable these videojs plugins in NextCloud. I know of 3 other NextCloud server admin's that want the same exact thing.

I have been trying to figure out how to use either one of these plugins with NextCloud for a while.

These two plugins, specifically, would be extremely useful. The Java plugin, most people have java. WRT the VLC plugin it's a fallback plugin and obviously that would be up to the admin to enable but for those of us that use VLC and have it deployed network-wide, it would be very useful.

videojs-java: Allows you to play AIFF, AVI, GSM, MID, MPG, MP2, MOV, AU and WAV medias through Java within Video.js.

videojs-vlc: Allows you to play all media through VLC web plug-in within Video.js.

The VLC plugin is a fallback plugin and it's insanely easy to enable if you know where to enable it.

Video.js VLC

Video.js VLC Tech plug-in

A Video.js tech plugin that add VLC Media Player fallback.

Getting Started

VLC Web Plugin must be installed on the browser to work.

Once you've added the plugin script to your page, you can use it with any supported video:

Include JavaScript files

<script src="video.js"></script>
<script src="videojs-vlc.js"></script>

And add this new tech to the player:

data-setup='{ "techOrder": ["vlc"] }'

Video.js Java

Video.js Java Tech plug-in

A Video.js tech plugin that add AIFF, AVI, GSM, MID, MPG, MP2, MOV, AU and WAV stream support through Java.

Getting Started

Once you've added the plugin script to your page, you can use it with any supported video:

Include JavaScript files

<script src="video.js"></script>
<script src="videojs-java.js"></script>

And add this new tech to the player:

data-setup='{ "techOrder": ["java"] }

There's also a working example of the plugin you can check out if you're having trouble.

Plugin Options

This plugin has a global configuration to setup JAR file location.


<script>
    videojs.options.java.jar = "video-js.jar";
</script>

All info taken from the videojs site, here: https://github.com/videojs/video.js/wiki/Plugins

serenity-networks commented 7 years ago

Also, something like Projekktor seems like it would be better than what we have. Flash and VLC fallback built in...

http://www.projekktor.com/

You can load up their demo's page to see all the different supported formats (vlc plugin included, which literally plays everything).

http://www.projekktor.com/demos/

What would it take to integrate something like this?

Instagit commented 7 years ago

@serenity-networks

Video.js has a Flash fallback, too, but it was actually removed to get rid of Flash dependencies, which in my opinion was a good idea. I don't like relying on plugins for video support.

There's no perfect solution for adding video support and I guess ultimately it's up to the community where Nextcloud is going with this.

The best way to go forward would be getting involved in the discussions I linked, preferably with good technical suggestions, so the core team can see it. I see you are already doing that, so I'd close this issue soon if there's nothing to add. :)

edit: If you need a short-term solution and don't care how the video player looks, it wouldn't be too much work to take an existing video app and make it work with Flash and VLC plugins.

johnking commented 7 years ago

@serenity-networks @Instagit

Based on the author of these two plug-ins: videojs-vlc and videojs-java are not supported in videojs with version >= 5.0.

Vlc Tech is Undefined #11

I need to playback .mpg file, do you have any recommendations or suggestions on Tech plug-in?

thanks

-John

DMeechan commented 7 years ago

I'm able to play back .mkv files fine in Chrome but there's no audio. Is there a way to fix that?

Thanks

Instagit commented 7 years ago

Hi DMeechan, it's probably because the audio isn't compatible with the browser. Can you check which audio codec is used in the file?

DMeechan commented 7 years ago

It's A52 (AC3). Apparently AC3 isn't supported in Chrome OS, though I'm running macOS so I assume it's Chrome then?

Instagit commented 7 years ago

It depends on the browser. Nextcloud uses the browser capabilities to run the video. Here's a list of the supported formats.

AC3 is not supported. You will have to transcode the audio format if you want to watch the video file directly via Nextcloud.

mcarroll76 commented 6 years ago

This can all be done in the browser with javascript. Here are some examples of codecs written in JS: https://github.com/phoboslab/jsmpeg https://github.com/mbebenita/Broadway https://github.com/audiocogs/aurora.js

Here's a video convertor in JS: https://github.com/bgrins/videoconverter.js

Here's FFmpeg, which plays nearly anything, compiled into JS: https://github.com/Kagami/ffmpeg.js

This was done with Emscripten, which can also compile into WebAssembly for those browsers that support it. Obviously, it's not going to be as efficient as the browser's native playback, but it's better than nothing.

So what we need is to modify the current player to check browser capabilities, play natively where possible, and fall back to WebAssembly then javascript players when that fails.

ghost commented 6 years ago

can it all be put into an app? I don't feel like wondering around the source code of some project I've never worked on, I want to watch some movies that happen to be mkv

update: webdav to kodi is good. but not so sure how much I like nextcloud's, or standard, webdav settings. Not 100% sure but I think it's not encrypted[i.e. I think it even send plain text passwords]. Please correct me if I'm wrong.

just found the kodi 'browse' > add-network-location > protocol dropdown with tons of choices - secure webdav worked

jult commented 6 years ago

Interesting how this issue is closed, while it is still very apparent in the latest version of nextcloud. No MKV gets played here, not in Firefox or Chrome. Any news on when this is implemented as an 'app' ?

Instagit commented 6 years ago

@jult I have given very detailed answers in the linked issues [1][2][3], which are about the same topic. When you have a suggestion on how to implement codec support in a way that doesn't cause problems in other places, by all means let's hear it.

The best way to get MKV support in browsers is bringing it up with Google and Mozilla. Here's Mozilla's stance on it:

There are no technical reasons here. We just hope the internet can be as simple as possible and hesitate to support more formats. But if it is really popular, we will consider supporting it. Bug 1429986 is to check how many attempts to play mkv on Firefox and we will check if we should support it or not.

So in fact, every time you try to play an MKV in Firefox and it fails, the chances to get official MKV support are improved a bit. :wink:

ghost commented 6 years ago

javerscrit

ghost commented 6 years ago

just kidding. why doesn't someone just fork firefox or chrome and add all the codecs?

guest271314 commented 4 years ago

Note, it is possible to create and play .mkv in Chromium, Chrome. Just cannot directly navigate to the file via address bar.

https://bugs.chromium.org/p/chromium/issues/detail?id=999580

https://plnkr.co/edit/WUVbjz?preview

https://plnkr.co/edit/Axkb8s?preview

guest271314 commented 4 years ago

FWIW see also https://github.com/guest271314/native-messaging-mkvmerge

jult commented 4 years ago

The best way to get MKV support in browsers is bringing it up with Google and Mozilla. Here's Mozilla's stance on it:

There are no technical reasons here. We just hope the internet can be as simple as possible and hesitate to support more formats. But if it is really popular, we will consider supporting it. Bug 1429986 is to check how many attempts to play mkv on Firefox and we will check if we should support it or not.

For crying out loud, we're almost 25 years into playing video in webbrowsers, we've had K-lite codec packs, linux distros ignoring all the fraunhofer institute limitations crap, ogg vorbis and webm, and still we have to resort to douchebags limiting their use of codecs because they expected to get rich from it. Disgusting, really. We have open standards that are mostly better for AV now than the paid ones, and still those damn old restricted codecs are being used? Why? Why is humanity so incredibly stupid and stubborn at learning that the money making bit is a failure for global issues and user-friendly UI. Functionality needs to go first, then you can try and make money on it.

guest271314 commented 4 years ago

Why? Why is humanity so incredibly stupid and stubborn at learning that the money making bit is a failure for global issues and user-friendly UI.

There are several reasons. Some include ego, laziness, greed. The late artist Prodigy of Mobb Deep said "Money is worthless, real power is people" at least twice, on the track "Real Power is People" https://www.youtube.com/watch?v=2hlIk3pm71w and in "Broken Apple" https://www.youtube.com/watch?v=K91Bz8HELjI 39:00.

Under the auspices of "user-friendly UI" an implementation might insert some internal non-specified user-activation scheme which they might believe solves all sorts problems, and thus is always a great idea, even when the controlling specification says nothing about user-activation, and said implementation clearly breaks API's https://bugs.chromium.org/p/chromium/issues/detail?id=1100053, https://bugs.chromium.org/p/chromium/issues/detail?id=1100746#c_ts1593504685.

freechelmi commented 3 years ago

We have open standards that are mostly better for AV now than the paid ones, and still those damn old restricted codecs are being used? Why?

The issue here is with containers , not codecs. Try to play a MKV with VP9 and Opus , you will have the same problems

[Edit] -> Not true , MKV is not an issue

guest271314 commented 3 years ago

@freechelmi What issue do you have playing MKV with VP9 and Opus on Chrome and Firefox?

freechelmi commented 3 years ago

You are right , I wrote Bullshit, Mkv is not an issue anymore , with some audio codec that could be rendered in js , we can definitley have most of the mkv works on nextcloud

guest271314 commented 3 years ago

@freechelmi I have not tried nextcloud. I have experimented playing Matroska files with various codecs in the browser using HTMLMediaElement.