Page 1 of 1

ffmpeg brings QNAP NAS to a grinding halt

Posted: Wed Oct 23, 2019 4:43 pm
by rednoah42
Since recent updates, probably since Media Console was introduced, my QNAP NAS is become effectively useless most of the time, because it's somehow running ffmpeg in the background, which eats up all the RAM, and once SWAP is heavily used, everything grinds to a halt.

I can barely login via SSH anymore. It takes 10-20 seconds just to login.

According to top, the culprit is ffmpeg trying to extract subtitles from video files, which is apparently extremely inefficient and slow for this particular task:

Code: Select all

/usr/local/medialibrary/bin/ffmpeg -y -i /tmp/3122.mkv -map 0:s:26? -c:s srt -f srt /share/CACHEDEV1_DATA/Multimedia/Movies/.@__thumb/.genSub/3122.si26.srt

:?: Any ideas how to disable this "feature" so I can use my NAS again?



EDIT:

Additional information for QNAP developers:

Code: Select all

Matroska: 10.7 GiB, 2h 2mn
1 Video stream: AVC
1 Audio stream: E-AC-3 JOC
29 Text streams: UTF-8 / UTF-8 / UTF-8 / UTF-8 / UTF-8 / UTF-8 / UTF-8 / UTF-8 / UTF-8 / UTF-8 / UTF-8 / UTF-8 / UTF-8 / UTF-8 / UTF-8 / UTF-8 / UTF-8 / UTF-8 / UTF-8 / UTF-8 / UTF-8 / UTF-8 / UTF-8 / UTF-8 / UTF-8 / UTF-8 / UTF-8 / UTF-8 / UTF-8
:idea: If you have a large file with many subtitles, the indexer will loop over each subtitle track, and then somehow very inefficiently run ffmpeg to extract each subtitle track. It's probably relatively fast for small files with 0 to 1 subtitle tracks, but it doesn't scale at all to large files with many subtitle tracks.

Re: ffmpeg brings QNAP NAS to a grinding halt

Posted: Wed Oct 23, 2019 9:33 pm
by dolbyman
what nas model?
best thing to do is to ditch qnaps multimedia apps and go for 3rd party (I use plex..works great)

Re: ffmpeg brings QNAP NAS to a grinding halt

Posted: Wed Oct 23, 2019 10:58 pm
by rednoah42
I've got a TS-228A, so 1 GB of RAM and 4-core aarch64 CPU, which is plenty. Latest QTS. Synology DS213J (1-core armv7 / 512 MB memory) that I upgraded from feels 10x faster.


Definitely a software issue. I used DLNA just fine, but a recent QTS release somehow tied DLNA to their Video Station, and so you have to enable the latter to get new content into the former, and their new "in-depth" indexing is apparently super broken.

Re: ffmpeg brings QNAP NAS to a grinding halt

Posted: Wed Oct 23, 2019 11:22 pm
by dolbyman
if your NAS was build before .. err 2016(?) then free twonky should still be installed, but apparently in current firmware versions twonky can only be enabled when media indexing is enabled as well (stupid)

TS-x28 supports Plex though .. so I would look into that

Re: ffmpeg brings QNAP NAS to a grinding halt

Posted: Thu Oct 24, 2019 2:05 am
by Trexx
It looks like you have some option configured in multimedia console that is generating/working with a subtitle file.

Even apps such as Plex use cpu only for some forms of subtitle processing which on an arm based unit will be very painful.


Sent from my iPhone using Tapatalk

Re: ffmpeg brings QNAP NAS to a grinding halt

Posted: Mon Nov 04, 2019 11:08 pm
by rednoah42
Plex is great as long as I don't enable subtitles. For some reason, if you enable subtitles in Plex, it'll re-encode the video to burn subtitles into the video stream, or maybe just transcoding the subtitle into the container, IDK, in any case, my NAS is to slow for that. That being said, Samsung TV has no problem picking up subtitles when direct-playing videos via DLNA, so that's why I'd prefer DLNA working correctly again (as it did in the past).

Additionally, the latest update also broke DLNA thumbnails. This recent Media Console update really broke all my QNAP use cases... not cool.

Re: ffmpeg brings QNAP NAS to a grinding halt

Posted: Mon Mar 16, 2020 1:57 am
by rednoah42
After waiting in vain for QNAP to fix the issue, I just decided to override their ** mysubextractor tool and make it do nothing.

patch.sh

Code: Select all

#!/bin/sh
echo '#!/bin/sh
exit 1' > /usr/local/medialibrary/bin/mysubextractor

:idea: I've configured cron to call this regularly fix things up just in case QNAP updates restore the original broken behaviour.

Re: ffmpeg brings QNAP NAS to a grinding halt

Posted: Mon May 17, 2021 5:24 am
by kuhsek
rednoah42 wrote: Mon Mar 16, 2020 1:57 am :idea: I've configured cron to call this regularly fix things up just in case QNAP updates restore the original broken behaviour.
@rednoah42: Can you go a little more in detail on where exactly i can find the entry for mysubextractor.
Im a linux novice but can follow a guide, I just have no idea what are you doing with those 3 code lines and where to execute them.

Thanks to god for this Thread. I have the same problem as soon as i enabled the Mediastreaming AddOn (yes i want to watch stuff on my older smart tv).
Full on 70-80% I/O on the harddisk constantly. Halfed my normal throughput, slowed down ui responsiveness, made navigating smb directories a torture.
I've tried *every* option in the UI, nothing had any effect except completely disabling the media streaming addon.

Re: ffmpeg brings QNAP NAS to a grinding halt

Posted: Tue May 25, 2021 12:44 am
by rednoah42
This is a shell script:

Code: Select all

#!/bin/sh
echo '#!/bin/sh
exit 1' > /usr/local/medialibrary/bin/mysubextractor
echo prints '...' to mysubextractor using I/O redirection:

Code: Select all

echo '#!/bin/sh
exit 1' > /usr/local/medialibrary/bin/mysubextractor
'...' happens to be a shell script that does nothing:

Code: Select all

#!/bin/sh
exit 1
We have replaced mysubextractor with another executable, which is now called instead, and does nothing whenever it is called.

Re: ffmpeg brings QNAP NAS to a grinding halt

Posted: Thu Nov 04, 2021 5:14 am
by Poppy
This can still be a problem (although it seems only for some people!) with all the latest versions of things - and it seems to just loop round even a few mkv files infinitely with only a slight pause before starting round again. You can just watch the memory getting chomped up with QBoost! (excluding mkv files from thumbnail generation does not seem to stop mysubextractor either!

The script given above works just fine though.