I have a high CPU usage when watching a video via the browser

Serverinfo:
https://pastebin.com/XhFbfCU8

Nextcloud.mp4 (515.6 MB)


Nextcloud.mov (296.5 MB)
1 Like

Let me clarify:

You are playing a 2 minute clip that is 711MB of size - i.e. ~46Mbps (!) - on a 4 core / 8GB machine

Is that correct?

Yes, here is all the information again.
Betriebssystem: Ubuntu Server 20.04
Prozessor: Intel® Xeon® CPU E5-2630 v4 @ 2.20GHz (4 cores)
Speicher: 7.8 GB (Swap 2 GB)
Server-Zeit: Thu May 28 17:04:18 CEST 2020
Betriebszeit: up 3 weeks, 6 days, 2 hours, 3 minutes
PHP 7.3, Apache/2.4.41, Nextcloud 18.0.4
UP/Download 200 Mbits

This actually happens with almost all videos, even with a low bit rate.
If you fast-forward it gets extremely extreme from the CPU load.
Then several Apache services suddenly start.
I don’t know why, I also created a cache and everything.
I also removed the error messages.


The Nextcloud is encrypted, but even if I upload a video without encryption via SFTP, it won’t get any better.
I have already switched off the swap and cleared more than 4 GB of RAM the same problem.
Normal downloading does not cause problems.
I think this is because when the video is played back via the browser or the VLC player, only a small part is requested, only that again and again.
I don’t know if that’s normal, but it would be nice to change it somehow.

I’m not an expert in video playback on the Nextcloud platform…

But 46Mbps is very close to the maximum bitrate allowed by the Blu-ray Disc standard.

Playing a BD with an average bitrate of close to the max allowed on a 4C/8GB machine without a discreet video card - I’d expect more problems than your video shows: stuttering, frame dropping, etc.

The server should only transfer the data to me.
An SSD RAID is used in the vServer.
I still have enough upload available.
My PC plays it, my PC and it is sufficiently equipped with the connection and performance.
For videos with a low bit rate of 10 Mbps, the problem can also be seen for a short time (20-30 seconds), if the video is preloaded, it gets better.
Maybe I just turn this function off in the browser or test switch from Apache to Nginx (Docker Nextcloud).
The VLC player only has a high load for a short time, but then it goes down quickly and remains at 20% / 4 = 5% server load with 50 Mbps.
So maybe it is normal or the web server is just as many say it is no longer up to date and the mods do not make it up to date either.
Thank you for your time, I just accept it now. : D

You need to transcode it to H.264 video format

I’m not sure that’s how it works…
In your case it looks like your server is playing it.
And transfer the stream frame by frame to your desktop…

Swap is 100%.

That’s probably I/O wait CPU load. You can check with regular top.

I have the exact same problem when playing mp4 video files on a 4c i7 / SSD server that could support 100 file transfers for such streams. Weirdly exactly like you the server struggles to fast forward while it should only be transfering blindly a file read by the client’s video player in her/his browser of choice. Why is this happening?

I don’t understand what this interpretation is based on?
Why should the server “blindly stream the data” to be decoded by the client?

I’ve never seen Nextcloud advertise Netflix functionality…:slight_smile:

What is the output of

ffmpeg -i videofile.mp4 -hide_banner

If you want we can report a bug on GitHub with a link to this post. Which server are you currently using?

Disable encryption:
sudo -u www-data php7.3 occ encryption:enable
cd /var/www/html/nextcloud/
sudo -u www-data php7.3 occ encryption:decrypt-all
sudo -u www-data php7.3 occ maintenance:mode --on
sudo -u www-data php7.3 occ encryption:disable
sudo -u www-data php7.3 occ maintenance:mode --off
You only need the encryption, if you have store files on the order unsecury Server.
On your nextcloud server, you can every time decrype
the data, with masterkey or sharekey or user password.
Warning, please make a backup for you decrypt, my first try to decrypt have not work it perfectly and 2-4 data is lost.