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 » Wed Oct 23, 2019 4:43 pm

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: 23112
Joined: Sat Feb 12, 2011 2:11 am
Location: Vancouver BC , Canada

Re: ffmpeg brings QNAP NAS to a grinding halt

Post by dolbyman » Wed Oct 23, 2019 9:33 pm

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 » Wed Oct 23, 2019 10:58 pm

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: 23112
Joined: Sat Feb 12, 2011 2:11 am
Location: Vancouver BC , Canada

Re: ffmpeg brings QNAP NAS to a grinding halt

Post by dolbyman » Wed Oct 23, 2019 11:22 pm

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: 5380
Joined: Sat Oct 01, 2011 7:50 am
Location: Minnesota

Re: ffmpeg brings QNAP NAS to a grinding halt

Post by Trexx » Thu Oct 24, 2019 2:05 am

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 » Mon Nov 04, 2019 11:08 pm

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 » Mon Mar 16, 2020 1:57 am

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 » Mon May 17, 2021 5:24 am

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 » Tue May 25, 2021 12:44 am

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.

Post Reply

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