memories icon indicating copy to clipboard operation
memories copied to clipboard

Transcoding not used for external storage

Open drhirn opened this issue 2 years ago • 31 comments

As the Memories config page states, transcoding will not be used for external storage. Why?

And what to do, if i have local files and files on a remote storage? If I enable transcoding, all videos on the external storage can't be played anymore.

drhirn avatar Apr 21 '23 16:04 drhirn

As the Memories config page states, transcoding will not be used for external storage.

To transcode a file, you need download the whole file locally first. This is problematic for large video files on external storage, so it is explicitly disabled.

If I enable transcoding, all videos on the external storage can't be played anymore.

That's possibly a bug. Do you get any error?

pulsejet avatar Apr 21 '23 16:04 pulsejet

Nothing in the logs (debug). Nextcloud just tells me "The media could not be loaded, either because the server or network failed or because the format is not supported." and "Transcoding failed, check the logs".

drhirn avatar Apr 21 '23 16:04 drhirn

Can you play if you set the quality of the video as "Direct"?

pulsejet avatar Apr 21 '23 16:04 pulsejet

Doesn't change anything.

drhirn avatar Apr 21 '23 16:04 drhirn

Trying to play from a read-only SMB-share

drhirn avatar Apr 21 '23 16:04 drhirn

Does your browser support the video to begin with? A simple test would be to disable transcoding and try playing the same video.

pulsejet avatar Apr 21 '23 16:04 pulsejet

Yes. No problems when disabling transcoding.

drhirn avatar Apr 21 '23 16:04 drhirn

Are you 100% sure? Disabling transcoding and setting quality to direct are exactly the same thing in the code ...

pulsejet avatar Apr 21 '23 16:04 pulsejet

Hehe. I assumed the same. But yes, I'm 100% sure. Just double-checked.

This is what the developer tools show when playing with enabled transcoding (quality: direct):

SW registered:  
ServiceWorkerRegistration { installing: null, waiting: null, active: ServiceWorker, navigationPreload: NavigationPreloadManager, scope: "https://example.com/apps/memories", updateViaCache: "imports", onupdatefound: null, pushManager: PushManager }
memories-main.js:2:3177869
Source map error: Error: request failed with status 404
Resource URL: https://example.com/custom_apps/memories/js/memories-main.js?v=808481ed-0
Source Map URL: memories-main.js.map?v=0b6b2008f363bc70e4b7
Will-change memory consumption is too high. Budget limit is the document surface area multiplied by 3 (2045952 px). Occurrences of will-change over the budget will be ignored. 04
VIDEOJS: WARN: The element supplied is not included in the DOM memories-vendors-node_modules_plyr_dist_plyr_min_js-node_modules_plyr_dist_plyr_css-node_modules_video-6ca800.js:2:371545
VIDEOJS: WARN: videojs.mergeOptions is deprecated and will be removed in 9.0; please use videojs.obj.merge instead. memories-vendors-node_modules_plyr_dist_plyr_min_js-node_modules_plyr_dist_plyr_css-node_modules_video-6ca800.js:2:371545
XHRGET
https://example.com/apps/memories/api/video/transcode/vdlsaebzm600/423453/index.m3u8
[HTTP/2 403 Forbidden 27ms]

VIDEOJS: ERROR: (CODE:4 MEDIA_ERR_SRC_NOT_SUPPORTED) The media could not be loaded, either because the server or network failed or because the format is not supported. 
Object { code: 4, message: "The media could not be loaded, either because the server or network failed or because the format is not supported." }
memories-vendors-node_modules_plyr_dist_plyr_min_js-node_modules_plyr_dist_plyr_css-node_modules_video-6ca800.js:2:371545
PsVideo: Direct video stream could not be opened. memories-main.js:2:3016916
PsVideo: Trying HLS stream memories-main.js:2:3016985
XHRGET
https://example.com/apps/memories/api/video/transcode/vdlsaebzm600/423453/index.m3u8
[HTTP/2 403 Forbidden 28ms]

VIDEOJS: ERROR: (CODE:4 MEDIA_ERR_SRC_NOT_SUPPORTED) The media could not be loaded, either because the server or network failed or because the format is not supported. 
Object { code: 4, message: "The media could not be loaded, either because the server or network failed or because the format is not supported." }
memories-vendors-node_modules_plyr_dist_plyr_min_js-node_modules_plyr_dist_plyr_css-node_modules_video-6ca800.js:2:371545
PsVideo: HLS stream could not be opened. memories-main.js:2:3016620
Uncaught (in promise) DOMException: The media resource indicated by the src attribute or assigned media provider object was not suitable. memories-vendors-node_modules_plyr_dist_plyr_min_js-node_modules_plyr_dist_plyr_css-node_modules_video-6ca800.js:2
Source map error: Error: request failed with status 404
Resource URL: https://example.com/custom_apps/memories/js/memories-vendors-node_modules_plyr_dist_plyr_min_js-node_modules_plyr_dist_plyr_css-node_modules_video-6ca800.js?v=1de1918b548ccbfe9249
Source Map URL: memories-vendors-node_modules_plyr_dist_plyr_min_js-node_modules_plyr_dist_plyr_css-node_modules_video-6ca800.js.map?v=1de1918b548ccbfe9249
MouseEvent.mozPressure is deprecated. Use PointerEvent.pressure instead. memories-vendors-node_modules_plyr_dist_plyr_min_js-node_modules_plyr_dist_plyr_css-node_modules_video-6ca800.js:2:380951

drhirn avatar Apr 21 '23 16:04 drhirn

I'm transcoding videos from an external storage, both playing in auto and direct mode just fine. My external storage is an rclone volume mounted as local external storage into a docker volume. It even has to decrypt the file and it works

gymnae avatar Apr 21 '23 19:04 gymnae

You're right. If I mount the smb-share locally and use "local external storage", it's working fine.

drhirn avatar Apr 22 '23 07:04 drhirn

I encountered this on my testing instance but @drhirn was faster to issue it. Is there going to be a way to enable transcoding for SMB storage? Is transcoding disabled only for SMB storage? I am running Nextcloud in Docker and mounting user data as external SMB storage with authentication even though the storage is local. This way I have the correct owner on the files that I write through Nextcloud and I can also access the files directly. It was working fine for me so far.

I can understand that the poor performance can affect the experience in case of WebDAV or Amazon S3 as these are usually not on the same machine as the Nextcloud/Memories instance.

vitis586 avatar Apr 25 '23 19:04 vitis586

Not right now. ffmpeg works best when the file is locally available; to support anything else we probably need another wrapper.

pulsejet avatar Apr 25 '23 20:04 pulsejet

Are you 100% sure? Disabling transcoding and setting quality to direct are exactly the same thing in the code ...

I do think there is something going on as well, I was able to see no noticeable difference between any of the 3 settings within the admin panel for ffmpeg transcoding. My very rough test consisted of disabling transcoding, reloading the page, having the video play in original quality, then repeating the process of disabling and refreshing the page between changing settings.

It would go from the native resolution to what appeared to be the same transcoded resolution even with the transcoding enabled, and Direct (without transcode) option set.

Video Reference

ChildLearningClub avatar May 16 '23 07:05 ChildLearningClub

The admin settings only define the default quality. The user can still select whatever quality they desire, and that will be persisted per-user.

pulsejet avatar May 16 '23 18:05 pulsejet

The admin settings only define the default quality. The user can still select whatever quality they desire, and that will be persisted per-user.

I apologize as this is now irrelevant to the current issue, but for the life of me I can’t find that user setting?

ChildLearningClub avatar May 16 '23 20:05 ChildLearningClub

Bottom right during video playback: image

If this is not visible, that likely means the video isn't transcoding to begin with. There might be errors in the go-vod logs (/tmp/go-vod/<instance-id>.log) or some permissions errors (in the memories admin interface).

pulsejet avatar May 17 '23 00:05 pulsejet

@pulsejet thank you, I see it on desktop now.

iOS Safari on the other hand only displays captions and speed. Logs show no error and it is clearly being transcoded.

IMG_7120

Unless I’m missing something else I will open a new ticket for this?

ChildLearningClub avatar May 17 '23 02:05 ChildLearningClub

@ChildLearningClub the iOS player doesn't support switching quality, but indeed it's a bug that there's no way to switch between transcoded and direct video. I opened a tracker at #650

pulsejet avatar May 17 '23 04:05 pulsejet

I apologize for getting everyone of topic, but I think this can be closed? transcoding does work for external storage, and looks like it was just an issue with how to storage was being mounted?

You're right. If I mount the smb-share locally and use "local external storage", it's working fine.

Is anyone else still having this issue?

ChildLearningClub avatar Oct 11 '23 22:10 ChildLearningClub

Well not really. The way go-vod works is by picking up files from the filesystem directly. To fully support external storage, we need to access the filesystem through Nextcloud, which will e.g. also allow transcoding files on S3

pulsejet avatar Oct 13 '23 16:10 pulsejet

Well not really. The way go-vod works is by picking up files from the filesystem directly. To fully support external storage, we need to access the filesystem through Nextcloud, which will e.g. also allow transcoding files on S3

Sorry for bumping, but is it this way even for local remote storage? As in it can't be acessed directly?

MrRinkana avatar Aug 21 '24 17:08 MrRinkana

@MrRinkana, the files need to be accessed directly for the go-vod server to transcode them. But for local remote storage this can be done with SMB Share.

ChildLearningClub avatar Aug 22 '24 12:08 ChildLearningClub

Yeah, the transcoder only works with local files for now. If you can mount the remote storage that would likely work.

pulsejet avatar Aug 22 '24 15:08 pulsejet

Yeah I was just worried that even local storage added trough the external storage app would suffer from the same "need to go through nc".

But that was a quick thing to test when I got home, I probably didn't need to ask.. Transcoding works like a charm! (At least in my case when the local storage just is a different zfs dataset that's actually faster for large files than the default storage)

Thanks anyway!

MrRinkana avatar Aug 22 '24 16:08 MrRinkana

When we say "local storage", does this just mean locally mounted in the file system? Rather than done through nextcloud external storage?

How can I add a local path to nextcloud without using the external storage feature?

mrtumnus avatar Aug 27 '24 18:08 mrtumnus

Bottom left corner when in the Memories app. You can add paths there. Is this what you are looking for?

“Local Storage” I believe he is referring to drives that are on the local network. So drives that are either connected directly to the computer he has running Nextcloud or drives that are connected through something like a NAS and maybe shared through SMB. But that are not the main directory that was selected when setting up Nextcloud initially. Hope that makes sense?

ChildLearningClub avatar Aug 27 '24 18:08 ChildLearningClub

Bottom left corner when in the Memories app. You can add paths there. Is this what you are looking for?

No, I was asking about how to add "local storage/files" so that the transcoder works properly. I have external SMB shares mapped into my Nextcloud instance, but the transcoder fails on these paths.

“Local Storage” I believe he is referring to drives that are on the local network. So drives that are either connected directly to the computer he has running Nextcloud or drives that are connected through something like a NAS and maybe shared through SMB. But that are not the main directory that was selected when setting up Nextcloud initially. Hope that makes sense?

Yeah, that's what I was thinking. But @MrRinkana seemed to indicate that he got the transcoder to work by mounting the files a different way.

mrtumnus avatar Aug 27 '24 21:08 mrtumnus

By local storage I mean the "local” option in the external storage app. It's only visible to server admins and allows adding another directory (other than the main data dir) to Nextcloud.

In my case I added '''/mnt/media''' which is a directory directly mounted into the lxc container running Nextcloud (like adding a drive), although it should work (as stated above, and by reason that nc can't differentiate such mounts) for any storage mounted outside of Nextcloud such as smb shares mounted in the os and then added to nc as a "local folder". Ofcourse if there is a long delay and low bandwidth on the smb that could be a limiting factor. You must make sure any mounts give the wwwrun user (or w/e) proper permissions as it will read/write from the storage.

In the options for the local storage mount there is a checkbox about generating previews you might want checked, dunno if it's required for trancoding though.

MrRinkana avatar Aug 28 '24 06:08 MrRinkana

By local storage I mean the "local” option in the external storage app. It's only visible to server admins and allows adding another directory (other than the main data dir) to Nextcloud.

Gotcha. That makes sense. I'll see what makes sense for me to set up.

In the meantime, I've turned off HEVC video on my phone, as that's what's apparently been prompting the need to transcode (why can't browsers just support HEVC??! /endrant).

mrtumnus avatar Aug 28 '24 21:08 mrtumnus