pulsejet / memories

Fast, modern and advanced photo management suite. Runs as a Nextcloud app.
https://memories.gallery
GNU Affero General Public License v3.0
3.22k stars 87 forks source link

Transcoding is not working on Edge and Chrome, on FF works but - with lots of macroblocking #1288

Open galandilias opened 2 months ago

galandilias commented 2 months ago

Describe the bug

I am playing with transcoding in my setup, and results are somewhat disturbing. Depending on the client I get proper results or definitely not...

All tests I run are on local network.

2024/09/11 20:25:34 9ca61zat7y60-max: /usr/bin/ffmpeg -loglevel warning -ss 33.000000 -hwaccel cuda -i /somepath/nextcloud/userx/files/somevid.mp4 -copyts -fflags +genpts -vf "format=nv12|cuda,hwupload,scale_cuda=force_original_aspect_ratio=decrease:passthrough=0" -map "0:v:0" "-c:v" h264_nvenc -preset p6 -tune ll -rc vbr -rc-lookahead 30 -cq 24 -map "0:a:0?" "-c:a" aac -ac 1 -start_number 11 -avoid_negative_ts disabled -f hls -hls_flags split_by_time -hls_time 3 -hls_segment_type mpegts -hls_segment_filename /tmp/go-vod/ocp1guza5guk/9ca61zat7y60-1086897133/max-%06d.ts -force_key_frames "expr:gte(t,n_forced*3)" -
2024/09/11 20:25:35 ffmpeg-error: [AVHWDeviceContext @ 0x5595eb7b5440] cu->cuMemAlloc(&data, size) failed -> CUDA_ERROR_OUT_OF_MEMORY: out of memory
2024/09/11 20:25:35 ffmpeg-error: [vf#0:0 @ 0x5595eb758f40] Error while filtering: Cannot allocate memory
2024/09/11 20:25:35 ffmpeg-error: Failed to inject frame into filter network: Cannot allocate memory
2024/09/11 20:25:35 ffmpeg-error: Error while filtering: Cannot allocate memory
2024/09/11 20:25:35 ffmpeg-error: [h264_nvenc @ 0x5595eb78e2c0] Failed locking bitstream buffer: invalid param (8):
2024/09/11 20:25:35 ffmpeg-error: [vost#0:0/h264_nvenc @ 0x5595eb7b5080] Error submitting video frame to the encoder

ffmpeg commands from the log file executed by hand directly in the terminal of course lead to no error at all.

Any ideas?

Steps To Reproduce

Just play the videos back.

Platform

- OS: Windows 11 (client), Android 10 (client), Gentoo (server)
- Browser: Chrome, Edge, Firefox - all latest versions
- Memories Version: 7.3.1
- built-in go-vod
- Nextcloud Version: 29.0.6
- PHP Version: 8.1
- ffmpeg-6.1.1-r8

Nvidia P620

+-----------------------------------------------------------------------------------------+
| NVIDIA-SMI 550.107.02             Driver Version: 550.107.02     CUDA Version: 12.4     |
+-----------------------------------------+------------------------+----------------------+

Screenshots

No response

Additional context

galandilias commented 2 months ago

I have just tried same playback on jellyfin (also nvenc) and there no problems on any browser - gotta be sth with go-vod

Civlac commented 1 month ago

If you disable hardware acceleration, are you getting the same issue? I believe this is a compatibility issue with the file format from the Nvidia encoder.

I have found on my instance that video will stop playing if I'm using Nvidia acceleration. If I use CPU, the video will play without issue. I don't run into any CUDA memory errors, but that's likely down to hardware.

On Edge, I can see the browser is requesting the video despite not being able to play: image image

Civlac commented 1 month ago

on jellyfin (also nvenc) and there no problems

Does Jellyfin use ffmpeg? Are you able to see the command it's using to transcode? That may help us.