ffmpeg brings QNAP NAS to a grinding halt

Please post your questions about using the web-based Photo, Music, Video Stations here.
Post Reply
rednoah42
Starting out
Posts: 16
Joined: Thu Apr 12, 2018 11:22 am

ffmpeg brings QNAP NAS to a grinding halt

Post 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.
Last edited by rednoah42 on Wed Oct 23, 2019 11:16 pm, edited 3 times in total.
User avatar
dolbyman
Guru
Posts: 35021
Joined: Sat Feb 12, 2011 2:11 am
Location: Vancouver BC , Canada

Re: ffmpeg brings QNAP NAS to a grinding halt

Post 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)
rednoah42
Starting out
Posts: 16
Joined: Thu Apr 12, 2018 11:22 am

Re: ffmpeg brings QNAP NAS to a grinding halt

Post 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.
User avatar
dolbyman
Guru
Posts: 35021
Joined: Sat Feb 12, 2011 2:11 am
Location: Vancouver BC , Canada

Re: ffmpeg brings QNAP NAS to a grinding halt

Post 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
User avatar
Trexx
Ask me anything
Posts: 5393
Joined: Sat Oct 01, 2011 7:50 am
Location: Minnesota

Re: ffmpeg brings QNAP NAS to a grinding halt

Post 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
Paul

Model: TS-877-1600 FW: 4.5.3.x
QTS (SSD): [RAID-1] 2 x 1TB WD Blue m.2's
Data (HDD): [RAID-5] 6 x 3TB HGST DeskStar
VMs (SSD): [RAID-1] 2 x1TB SK Hynix Gold
Ext. (HDD): TR-004 [Raid-5] 4 x 4TB HGST Ultastor
RAM: Kingston HyperX Fury 64GB DDR4-2666
UPS: CP AVR1350

Model:TVS-673 32GB & TS-228a Offline[/color]
-----------------------------------------------------------------------------------------------------------------------------------------
2018 Plex NAS Compatibility Guide | QNAP Plex FAQ | Moogle's QNAP Faq
rednoah42
Starting out
Posts: 16
Joined: Thu Apr 12, 2018 11:22 am

Re: ffmpeg brings QNAP NAS to a grinding halt

Post 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.
rednoah42
Starting out
Posts: 16
Joined: Thu Apr 12, 2018 11:22 am

Re: ffmpeg brings QNAP NAS to a grinding halt

Post 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.
kuhsek
First post
Posts: 1
Joined: Sun May 16, 2021 8:34 am

Re: ffmpeg brings QNAP NAS to a grinding halt

Post 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.
rednoah42
Starting out
Posts: 16
Joined: Thu Apr 12, 2018 11:22 am

Re: ffmpeg brings QNAP NAS to a grinding halt

Post 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.
Poppy
Getting the hang of things
Posts: 73
Joined: Thu Sep 06, 2018 11:49 pm

Re: ffmpeg brings QNAP NAS to a grinding halt

Post 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.
Post Reply

Return to “Photo Station, Music Station, Video Station”