How can I tune video - or fix my video issues?

David Monroe Posted in Technical Support 3 years ago

I've got a bit of a weird issue with video. FFMPEG seems to work and everything, but my server goes to 100% when trying to view uploaded videos sometimes. The videos appear to upload fine - I might be able to watch them once, but if I go back the server sits at 100% and won't work. If I run my videos through Handbrake and tune them down a bit, set web optimize before uploading, they tend to work better. I can't exactly teach this to my wife and if I tried with my other users they would never come back. I thought the FFMPEG backend should take care of that anyways.

So long story short, the videos are there, the files are good, but something just quits working during playback. I can't tell if it's an Apache issue or something else. The Apache logs show a normal GET command, but playback doesn't seem to work - sometimes. What OS or browser I use doesn't seem to make a difference. Some files seem to never play back, some seem to hit and miss, and some seem to work nearly every time. Often it's just at a freeze until I reboot the server, which seems to function fine outside of anything to do with serving up webpages at that point.

I was wondering if changing the system to convert all files to WEBM might be a better option? I was also hoping there was a known issue of some sort I could check regarding video, OSSN, or even a known issue with Apache and the way these files are served? In the modern day the rendering itself should be handled by the browser.

Apache/2.4.41 (Ubuntu)
Ubuntu 20.04.2 LTS
I've got three cores of AMD FX(tm)-4100 Quad-Core Processor exposed to the VM
When I check meminfo this is what I get - I gave it plenty:
MemTotal: 4030396 kB
MemFree: 2294896 kB
MemAvailable: 3462408 kB
OSSN 5.6
Softlab24 Premium Kernel for OSSN 5.3

Replies
Indonesian Arsalan Shah Replied 3 years ago

The only possible way is to add a mp4 video in the list of extension (in action file) to be converted again and to edit the ffmpeg tool command in video class file and set the max time from 1 to 3 minutes just like tiktok doing.

in Balamurali Govindan Replied 3 years ago

Arsalan,
Is it possible to resize and auto-compress the videos while the user is adding the files? If it is a bigger community it would be hard to educate the users to resize and compress it. Rather the upload process takes care of it, then it would be the right solution. Please guide and help.

us David Monroe Replied 3 years ago

Thank you for the info Arsalan, you too ~Z~Man. I host my own stuff on my own hardware, VM, Cable Internet connection - it's not exactly a high-traffic site - it's a family site to save kids stuff.

I absolutely WILL NOT be using YouTube for much of anything - getting off of that sort of thing is pretty much why the site exists. I will consider putting it into IPFS and embedding the content with a hard gateway address, I've made that work fairly well before, but that's not going to be for user uploads.

Being smooth for the users - not just for me and my use of Handbrake, which I guarantee my users don't understand or will even tolerate - is the goal.

I will be checking out the X-Send Apache thing, thank you.

I still think setting options in FFMPEG would be the way to go. I've been using FFMPEG for many different things - I'm a pretty solid Linux guy in general, but I haven't run a lot of webserver related stuff since before Apache2 was a thing - it's been a while. I was looking through the code in the video section yesterday. I don't quite have it figured out - I'm not a coder, but I have some ideas to run with. I may clone my VM and experiment a bit so see if I can get what I want out of it.

I initially made an attempt at using NGINX since it's supposed to be faster, more modern, whatever, but I quickly realized the software really was written for Apache2, so I decided not to fight it.

Indonesian Arsalan Shah Replied 3 years ago

It all depends on videos file. Videos are loaded via PHP not direct path to file. The component is meant to be used for small videos like 4-5MB If you load larger videos of course you need to make sure your memory is large enough to handle those files. Buffer size is 1024 * 8 bytes (video output) for fread https://www.php.net/manual/en/function.fread.php The only problem is people tends to enable larger videos and outputting using PHP requires a memory and is a big problem and we can not just make those videos to put public folder and serve without PHP.

The other solution may be is to make the videos ffmpeg command to resize those videos to 480p and compress it. You can edit this in videos component files (action files and classes)

There is x-sendfile apache module but it isn't available on providers as its a 3rd party module and its outdated you can read just for information (not for implementation)

https://stackoverflow.com/questions/36955983/downloading-large-files-with-php-using-mod-xsendfile-on-linux
https://www.h3xed.com/programming/how-to-use-x-sendfile-with-php-apache

If you wish to upload larger videos I suggest you to use youtube and then just share video URL in your network.

German Michael Zülsdorff Replied 3 years ago

Hmm ... your server resources look fine - so maybe it's a network issue ...
To isolate the issue from Ossn, I'd suggest the following:

Each of your videos is addressable like https:/YOURSITE/video/view/SOMENUMBER
So...
memorize 2 or 3 problem candidate numbers
enter the object subdirectory of your ossn data directory
locate and enter the subdirectory with the same number you have memorized
proceed to video/file
and you'll find something like 69a2c3fbc6ba3e0d6ec18d244ab34.mp4
copy that mp4 to a browser accessable location (e.g. your Ossn installation directory)
and access it directly from your browser

If you're getting similar issues this way, it's time to check your network and/or apache
if not, please contact Softlab24 directly, because this forum is dedicated to the free version of Ossn only.