Jump to content

Emby Server Memory Usage for External Players & Live TV?


csadoian
 Share

Recommended Posts

csadoian

I am a new Emby user ... I have been using Next PVR with Kodi for almost a year now, but I was looking for something a bit more reliable and "wife" approved.  My particular interest is for PVR use, and I have 3 Silicon Dust HDHomerun tuners I use.  I have a Prime that is connected to Comcast, and for OTA I have the Connect and the Extend, a total of 4 OTA and 3 Cable tuners.

I tested Plex for about 3 weeks, but I wasn't all that impressed with their PVR features, since it is only in beta for now.

So I started looking at Emby.  Reviews were very good, so I decided to give it a try.  I installed an Emby Server on a machine that has Windows 7 Professional, Intel Core i5 3.2Ghz, 4GB memory and a 1TB hard drive.  Setup was pretty easy.  I played with it for a couple of days and was so impressed that I signed up for Emby Premier so I could test the DVR and live TV.

I added my tuners and used Schedules Direct (I already have an account with them for my Next PVR server) for my program listings.  I played with the live tv on several devices, including Android tables, Android TV boxes and and Apple iPad.  I also scheduled some recordings, both one time and series.  Everything worked very well.  So I stopped all my recordings on my Next PVR server and transfered them over to Emby.  Everything looked to be going great!  I had finally found the perfect PVR/Media Server!

However, this weekend it all fell apart.  I'm an avid Nascar fan, so I had set up a recording for the race this past Sunday.  I also began watching the race live on my main TV, being broadcast on my local OTA station.  My main TV has an Android TV box hooked up to it, so I used the Emby app to tune to my local station.  The Emby app launches MX player to play the channel.

All went well for about 30 minutes.  Then the picture froze.  Hmmm.  Cheap Android box, I thought.  So I rebooted it and went back into the Emby app, but it couldn't communicate with the server.  So I go over to the server and it's SUPER SLOW, and the hard drive light is solid green.  I hit CTRL-ALT-DEL and after about a minute the task manager was up and I see the Emby server is using almost 3.7GB!  So the hard drive light being on was poor Windows trying to swap in virtual memory to take up the slack, which slowed the machine down to a crawl.

So I rebooted the server.  Back to normal.  Server is using around 330MB.  Restart the recording, restart the live TV.  Same thing happens in about 20 minutes.  Rebooted and tried it again.  Same thing.  Gave up and watched the race on my TV's tuner.

So today I stick another 4GB of ram in the server, for a total of 8GB.  That should make Emby happy, I thought.

So I ran a test.  I opened up a live TV channel (OTA, HD, 1080p) on my Android TV box.  I looked at the memory usage of the server and it's around 350MB.  So far so good.

After a while I see the server's memory usage is going up.  WAY UP.  I watched it over a period of time, and after an hour the server usage was 7.5GB!!  What is going on?????

So I shut down the stream and watched the server's memory usage and it went down to 7.4GB and that's it.  Of course, the server is dead slow right now.  I assume the only way to get the memory usage back down is to reboot the Emby server.

So, should I consider this normal????  What the heck is Emby doing with all that memory during a live stream?  The CPU use during the stream is only about 4%, so the machine is not being strained at all.

I certainly hope this is a bug, because if it isn't then Emby as a PVR is a bust, for me at least.

I can't figure out why a live stream would cause the Emby server to require so much internal memory.  Is it attempting to buffer the stream internally?

I guess I was spoiled with Next PVR, it barely uses 150MB during it's operation.

Using the current version of Emby (3.2.26.0).

Thanks,

Chuck





 

Link to comment
Share on other sites

mastrmind11

Gonna need logs, server specs, etc...but no, this behavior is not typical, I watch live sports all the time on the Emby client.

Link to comment
Share on other sites

csadoian

Attached are the logs.  The time period in the logs would be around 11:15am to 12:15pm on 7/24/17.

 

However, I have some new information.  The Android TV box I was using yesterday and today for the testing is running AndroidTv 1.4.17g.  When I first set the program up and was experimenting with the configuration settings of the app with regards to video I couldn't get it to play video with the default settings.  So under settings in the Android TV app I changed the setting under Live TV "Use External Player for Live TV".  I checked it.  Then when I opened a channel in LIve TV I would get a prompt from Android giving me a choice of VLC (which didn't work), Kodi and MX player.  MX player seemed to work fine, so I used it.

 

The testing I did today (and what I used yesterday when I first noticed the problem) was using the MX external player for Live TV.  When in use the server dashboard reports the client is "Direct Playing".  This is the condition that causes the server to start eating system memory.

 

I then cleared the "Use External Player for Live TV" in the Android TV app and then went back and opened up the same channel.  The dashboard reports it is transcoding the stream because the audio codec is not supported.  However, under these conditions the Emby Server does not seem to eat memory.  I let it run for about 15 minutes and the server memory stabilized at around 180MB and held steady.

 

I also went back and checked "Use External Player for Live TV" and then chose Kodi as the player.  The dashboard reported Direct Play with no transcoding, and the Emby Server started eating memory again.

 

Hopefully that will help nail down the issue.

 

So for the time being I am not using any external players (at least on Android devices).  Maybe tonight I will try an external player on my Windows computer using Emby Theater.

 

Thanks,

 

Chuck

 

Serverlogs.zip

Link to comment
Share on other sites

csadoian

Couldn't wait, I defined VLC as an external player for Emby Theater running on my Windows machine and it seems to work fine.  No memory bloat, and the server reports it as being Direct Play, no transcoding.

 

Apparently the memory issues I experienced are confined to the Android TV app, although I have not tested any other platforms.

 

Chuck

Link to comment
Share on other sites

Hi, what about Emby Theater with the internal player. Can you try that as a test? thanks.

Link to comment
Share on other sites

csadoian

I just did tests with Emby Theater for Windows using the internal player and didn't observe and memory bloat.  The dashboard shows it as direct playing.  I also got out my iPad Mini and did the same test on it, and no memory bloat with it, either.  The client on iOS shows 1.4.0, and during the test the dashboard shows it as being transcoded due to multiple reasons (Container not supported, Video codec not supported, Audio codec not supported).

 

As with my other tests, it was done using Live TV with an OTA channel broadcasting at 1080p, being supplied by an HD Homerun Connect tuner.

 

Currently my Emby server is using approx 450MB of system memory.  It started out about 7 hours ago at around 300MB, so there has been a modest increase in memory usage, but nothing like what I was seeing with the problem described above.

 

So far the problem seems to only affect the Android TV app using external video players.  I don't know if this would be related to the memory leak described in the thread referenced by parrish.

 

Chuck

Link to comment
Share on other sites

I believe there is a way to force direct play with the internal player in the android tv app. can you try that? i think that would be a good comparison. thanks.

Link to comment
Share on other sites

Untoten

I just did tests with Emby Theater for Windows using the internal player and didn't observe and memory bloat.  The dashboard shows it as direct playing.  I also got out my iPad Mini and did the same test on it, and no memory bloat with it, either.  The client on iOS shows 1.4.0, and during the test the dashboard shows it as being transcoded due to multiple reasons (Container not supported, Video codec not supported, Audio codec not supported).

 

As with my other tests, it was done using Live TV with an OTA channel broadcasting at 1080p, being supplied by an HD Homerun Connect tuner.

 

Currently my Emby server is using approx 450MB of system memory.  It started out about 7 hours ago at around 300MB, so there has been a modest increase in memory usage, but nothing like what I was seeing with the problem described above.

 

So far the problem seems to only affect the Android TV app using external video players.  I don't know if this would be related to the memory leak described in the thread referenced by parrish.

 

Chuck

What hardware acceleration are you using?

Link to comment
Share on other sites

csadoian

I believe there is a way to force direct play with the internal player in the android tv app. can you try that? i think that would be a good comparison. thanks.

 

On my Android TV box Live TV will not play unless I check the box "Direct Stream Live TV".  If this box is unchecked, the app attempts to play the live TV channel as Direct Play (according to the dashboard), but on the Android app nothing ever plays, I just have the spinning circle showing continuously.  When I check the "Direct Stream Live TV" option I can play the Live TV channel, and the dashboard says it is transcoding it because the audio code is not supported.  With this setting the server does not eat memory.

 

The server seems to eat memory if I set the Android TV app to use an external player.  When using an external player it doesn't seem to matter if "Direct Stream Live TV" is checked or not.

 

Chuck

Link to comment
Share on other sites

csadoian

What hardware acceleration are you using?

In the Emby Theater app on Windows (which I am not having any issues with), hardware acceleration is set to the default, Auto.  There is no equivalent setting on the Android TV app that I can see.

 

Chuck

Link to comment
Share on other sites

So, to re-iterate, whatever it is appears to be related to the server statically streaming a Live TV channel.

Link to comment
Share on other sites

csadoian

So, to re-iterate, whatever it is appears to be related to the server statically streaming a Live TV channel.

Yes, but only using the Android TV app AND an EXTERNAL video player.  The memory bloat does not seem to occur on the server except under these specific conditions:

 

1.  Client:   Android TV app

2.  Live TV

3.  Using external video player (doesn't seem to matter which one).

 

I have tested these clients and they did not cause any memory bloat:

 

1.  Emby Theater 2.8.1 (Windows) using internal player & external (VLC Player) on a Windows 7 64 bit system (Core i7 with an Nvideia GeForce GTS 250)

2.  Emby for Android Mobile (2.9.37) using default settings on a Samsung SM-T550 tablet running Android 6.0.1

3.  Emby for iOS 1.4.0 using default settings on an iPad Mini using iOS 10.3.2.

 

Chuck

Link to comment
Share on other sites

Thanks.  Yes, using the external player in the Android TV app would be the only one of those that is statically streaming the channel I believe.

 

Can you see in the external player, the exact url that is being played?

Link to comment
Share on other sites

csadoian
csadoian

Ok, here's an update.

 

When I checked Emby Theater for Windows yesterday, I did not see any memory bloat on the server.

 

However, when I was getting the URL for ebr (see message above) I set Emby Theater to again use VLC as an external player and then opened up a 1080p OTA live station.  After a few minutes I STOPPED THE STREAM on VLC but left VLC open so I could copy and past the URL into the message I was posting here.  After a few minutes I noticed the server's memory usage started going up, and going up fast!

 

Restarting the stream in VLC (remember, I never closed it) appears to SLOW the increase in memory usage, but it did not stop it.

 

Does this mean there is some sort of buffering going on in the server?

 

By the way, while VLC is playing the stream the server dashboard does not show my client as playing anything.  It did, at first, but after  a short period of time the status went idle again.

 

Chuck

  • Like 1
Link to comment
Share on other sites

that particular scenario looks like it's going to be expected. you stopped vlc, but we aren't aware of that until the program actually closes. so now on the server, live stream data is accumulating but no one is consuming it.

Link to comment
Share on other sites

csadoian

that particular scenario looks like it's going to be expected. you stopped vlc, but we aren't aware of that until the program actually closes. so now on the server, live stream data is accumulating but no one is consuming it.

Hmmm, correct me if I'm wrong, but I thought I read somewhere on the Emby support site that pausing live TV is not (as yet) supported.  Not being able to pause live tv implies the server should not keep a buffer (or much of one) of the live tv channel a client is viewing.

 

In any case, I would think that buffering the stream entirely in memory would not be a good idea.  I believe in most software  PVRs I have seen the buffer is spooled off to the hard drive.  I know Next PVR does that.  As a result a huge amount of memory on the server is not required.

 

Also, if the Emby Server *IS* buffering the stream entirely in memory, why wouldn't the server give it back (purge it) once the stream is terminated?

 

Chuck

Link to comment
Share on other sites

We don't actually buffer it in memory, we just relay it.

 

The reason why you don't see this problem if you pause with Emby apps is because they are playing with techniques that are designed for live streams. That means either they are using server transcoding which won't cause memory to build up, or they are using a client-side buffer for seeking purposes which means they are always consuming even when you pause.

 

Do you really need to play with an external player? Because live tv is enough work for us to support as it is. Being expected to make it work with any video player might not be realistic. I'm wondering if we should just not allow external players for live tv, or allow it but force transcoding.

Link to comment
Share on other sites

csadoian

I think what started all this was when I installed the Emby Android TV app, the default in the options under Live TV was that none of the three items were checked.  I attempted to play some Live TV channels and all I would get was the spinning circle, no sound or video.  So I started messing around with the options, and I think I ended up having the best results when I selected the "Use External Player for Live TV".  It allowed me to try a couple of players, and the free MX player seemed to do the best.  That's when I discovered the problem on Sunday when the server started eating memory and eventually got so slow that my stream locked up.

 

Eventually I discovered that all I had to do was check the option "Direct Stream Live TV" and the app would play just fine with the internal player.  If I had known that in the first place I probably would not have tried using the external player option.

 

If you can't identify and eliminate the memory issues when using an external player in direct mode, I would be ok with just eliminating the option entirely, although keeping the option and forcing it to transcode might be useful, too.

 

I was providing as much information as I could regarding what I was experiencing just in case it was related to the problems described in the other thread "Emby Server Memory Usage" and might prove useful.

 

Chuck

Edited by csadoian
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
 Share

×
×
  • Create New...