Jump to content

Emby server spawning endless ffmpeg processes, crashing server


McChen

Recommended Posts

Having a big problem with Emby Server recently, version 3.0.7200.0 on Windows 10 64-bit. The server begins spawning multiple ffmpeg processes, but no client is connecting or transcoding. From the log it looks like it is scanning the recorded TV files from my Windows Media Center and trying to generate preview images? The server gets overrun by these ffmpeg processes which keep spawning and never get killed off. The ffmpeg processes use up all the disk I/O and eventually all the RAM. Log is attached.

server-63610135311.txt

Edited by McChen
  • Like 1
Link to comment
Share on other sites

so is this entirely an issue with the serverwmc plugin or something with emby as well?

 

I have had serverwmc installed and running in emby for awhile and never had issues with it. I haven't changed anything recently unless the plugin updated. I can see a revision history for the serverwmc plugin, but no release dates, so not sure if it got auto updated. On the serverwmc server, nothing there has changed in awhile.

Link to comment
Share on other sites

If server wmc does not return an image then we attempt to extract one from the file. it appears to be failing for your files for whatever reason. We don't currently have settings exposed to disable that, it's something to consider.

Link to comment
Share on other sites

Hmm...that's useful info. Emby and ServerWMC plugin has been pretty stable for me for quite awhile now. Just in the past week it started going haywire, so trying to figure out what has changed. It may have been the 3.0.7200 release maybe? Still trying to figure out if the ServerWMC plugin has updated recently. I wonder if when it was working ServerWMC was extracting the images or if Emby was. Anyways, any more ideas on how I can narrow this down further? Should I be reaching out to the ServerWMC folks about this?

Link to comment
Share on other sites

It's only 5 recordings in the log, you can just assign them your own image and the server will stop trying to extract them.

Link to comment
Share on other sites

I actually have around 100ish recordings, I just had to shut down Emby after a short time as the ffmpeg processes quickly overwhelm the server and make it unresponsive. And I assume that if a new recording is made, it is going to cause ffmpeg to go crazy again trying to extract the image from the new file. So I need to find a way to more permanently fix this. Any ideas?

Link to comment
Share on other sites

well, not a lot of progress yet on this issue.

 

I've tried rolling back to earlier versions of Emby and the ServerWMC plugin, thinking that maybe this was a change in a later version as everything was running fine up to about 2 weeks ago. Rolled Emby back to .7100, .7000, and .6400 and the ServerWMC plugin to .66 and .64, no change in behavior. Upgraded the ServerWMC backend to the just released 1236 build, no change. Tried several of the latest Zeranoe builds of ffmpeg instead of the Emby included one, no change.

 

I still can't figure out if when this thing was working if ServerWMC was returning an image or if it was doing like now where ffmpeg is invoked to get the image.

 

At this point, I'm thinking maybe something is wrong with the cache, database or something else with my install. May try to wipe it clean and start over again and see if that does anything.

Link to comment
Share on other sites

When ffmpeg takes a long time to extract an image we kill it, however every once in a while we see certain files where it just hangs completely and cannot be killed. I am wondering if that's what's happening here. I am tempted to just stop trying to extract images for wtv, I just don't want to have to deal with complaints from those who it is working for.

Link to comment
Share on other sites

I would love to see the ability to control the number of thumbnail extractions that are permitted at once, as this is opening far more than is reasonable.

 

This happened while running Emby 3.1.168.0 beta

 

2016-09-28 09:20:40.9650 Error MediaEncoder: ffmpeg image extraction failed for file:"D:\Recorded TV\Hawaii Five-0_WHP-DT_2016_07_22_20_59_00.wtv"
2016-09-28 09:20:40.9650 Error MediaEncoder: I-frame image extraction failed, will attempt standard way. Input: file:"D:\Recorded TV\Hawaii Five-0_WHP-DT_2016_07_22_20_59_00.wtv"
2016-09-28 09:21:00.7350 Info MediaEncoder: Killing ffmpeg process
2016-09-28 09:21:01.7350 Error MediaEncoder: ffmpeg image extraction failed for file:"D:\Recorded TV\Hawaii Five-0_WHP-DT_2016_06_10_20_59_00.wtv"
2016-09-28 09:21:01.7350 Error MediaEncoder: I-frame image extraction failed, will attempt standard way. Input: file:"D:\Recorded TV\Hawaii Five-0_WHP-DT_2016_06_10_20_59_00.wtv"
2016-09-28 09:21:21.1750 Info MediaEncoder: Killing ffmpeg process

 

The number of ffmpeg processes that are permitted to open doesn't seem to have a limit:

 

57ec012e4bcbe_Untitled.png

Edited by SeanM
Link to comment
Share on other sites

what I can't figure out is that why emby/serverwmc has been working great for me for about 2 years or so and now it is suddenly having this problem. ffmpeg is now choking on pretty much all .wtv files it seems. Even ones that have been there for many months and never had a problem with until 2 weeks ago. I thought it must be a recent update, but i rolled everything back and still no dice, so i'm stumped at the moment.

Link to comment
Share on other sites

How about a method to keep track of the processes, so even if the killing of the process fails, another will not start (or if it fails, only allow a certain number to ever be open at any given time).  This would not fix the underlying issue, but it would at least prevent the PC from getting bogged down to the point of unusable for future issues as well.  

 

A hard option to toggle on/off thumbnail extraction for live TV would also be a nice feature.

 

Thank you.

Edited by SeanM
Link to comment
Share on other sites

SeanM's suggestion seems reasonable. I would rather have a way to just stop trying to extract altogether.

 

On my Emby, it never seemed to use the extracted image anyways. If I go into the details for a file, it does show me an extracted image, but it is never used as an icon, I just get a generic blue icon. The recently recorded view, it does display the show or the channel icon i think for those recordings, but not an extracted image.

 

I find on my machine even just 2-3 ffmpeg processes kill the machine as each ffmpeg process has a voracious appetite for disk I/O, each trying to consume about 50MB/s. On my machine, the .wtv files are on a 2.5" spinning disk, which has like 100-120MB max throughput, so it doesn't take much to completely consume the disk I/O.

Link to comment
Share on other sites

The underlying problem appears to be ffmpegs handling of the wtv and/or the syntax changes.

 

As a test, I ran the same syntax that Emby uses with ffmpeg to attempt to generate the thumbnail:

 

"D:\ffmpeg\ffmpeg.exe" -i file:"D:\Recorded TV\Blindspot_WGALHD_2016_05_09_22_00_00.wtv" -map 0:v:1 -threads 0 -v quiet -vframes 1 -vf "scale=600:trunc(600/dar/2)*2,thumbnail=30" -f image2 "E:\1f0b323e-e250-4c48-8446-caedb11025c9.jpg"

 

Complaints from ffmpeg:
[mpeg2video @ 0000000000388940] Invalid frame dimensions 0x0.   Last message repeated 33 times
[wtv @ 000000000031c980] Stream #4: not enough frames to estimate rate; consider  increasing probesize
[swscaler @ 0000000000314560] deprecated pixel format used, make sure you did set range correctly
[image2 @ 00000000003bf3a0] Frame rate very high for a muxer not efficiently supporting it.
Please consider specifying a lower framerate, a different muxer or -vsync 2

 

I did attempt adding the -vsync 2 flag , still hangs up for what appears to be indefinitely.  

 

As a test I simplified the command line to:

"D:\ffmpeg\ffmpeg.exe" -i file:"D:\Recorded TV\Blindspot_WGALHD_2016_05_09_22_00_00.wtv" -map 0:v:1 -threads 0 -v quiet -vframes 1 -f image2 "E:\1f0b323e-e250-4c48-8446-caedb11025c9.jpg"

 

Removing the scaling, and it completes instantly..  Seems like some syntax tweaking for ffmpeg is needed..

 

 

Link to comment
Share on other sites

Luke,

 

That seemed to do the trick..  Generated a valid thumbnail basically instantly..   

 

is 30 , 30 frames or 30 seconds?  With it dropped, does it just pick the very first frame?   Although if the 1st frame resolves this issue, I would easily live with that.

Edited by SeanM
Link to comment
Share on other sites

I don't know what the default is without that. Essentially what that param means is that in order to extract an image, it will extract 30 frames and then choose the best one. the lower the value, the more all-black and blurry extractions you will see, but it will also be faster.

Link to comment
Share on other sites

Ok thank you.   i will say that both with thumb=30 and without, it seems to generate the same thumbnail (or at least the frames chosen are so close in this instance I can't tell the difference).  One method just takes forever (although it did finally complete).

Edited by SeanM
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...