Jump to content

Buffering/Stuttering when playing high bit-rate HVEC on FireTV 4K


austinchief
Go to solution Solved by austinchief,

Recommended Posts

Q-Droid

One more thing (I know...) - if transcoding and not throttling that could definitely flood the pipes and add latency to both the network and storage.

 

Link to comment
Share on other sites

austinchief
36 minutes ago, Q-Droid said:

Can you restart Emby server and post the hardware detection log?

And which CPU do you have in the Emby server? "an older AMD quad core" or the "i5-8400"

EmbyServer restarted and attached hardware detection log

 

I have the i5-8400.   It's been so long, I thought it was an older AMD ... but after digging in, found it was the i5-8400.

hardware_detection-63813450318.txt

Link to comment
Share on other sites

austinchief
16 minutes ago, Q-Droid said:

One more thing (I know...) - if transcoding and not throttling that could definitely flood the pipes and add latency to both the network and storage.

 

This issue is happening with only a single stream playing ... adding a competing stream that requires transcoding simply makes things worse!

Link to comment
Share on other sites

austinchief
37 minutes ago, Q-Droid said:

Also keep mbit vs mbyte in mind. A single 100mbit stream is still only ~10mbytes and well within even USB thumb drive speeds and a fraction of what even slow HDDs can handle.

 

Heard!   

My network bandwidth should not be the bottleneck ... I have 1Gbps  wired network, and AC Wifi which is getting consistently north of 250Mbps via each AP (I have 6 active APs throughout my house).

The DS1812+ should be able to provide 75-100MBps read throughout minimum.

The fact that moving the media file from the NAS to my EmbyServer linux machine and it plays without pause/stuttering seems to point to either: 1) DS1812+ NAS hardware can't keep up for some reason or 2) The EmbyServer linux box has hardware I/O limitations over SMB

My gut is telling me the NAS is the bottleneck ... but want to ensure the EmbyServer is not causing a bottleneck.

Link to comment
Share on other sites

austinchief
26 minutes ago, Q-Droid said:

One more thing (I know...) - if transcoding and not throttling that could definitely flood the pipes and add latency to both the network and storage.

 

I am an Emby Premiere subscriber and have enabled HW acceleration and have throttling enabled.

Link to comment
Share on other sites

Q-Droid

You shouldn't have high CPU usage when direct streaming so I suspect that at least audio might be transcoding. And that goes back to my comment re: throttling. Transcoding audio is done in CPU and usually very fast which means it can pull the file data at a high rate.

You don't seem to have any HW accel support working right now. If you forced it to transcode it would use a lot of CPU but also slow down the transfer rate. Have you tested this, transcoding to 1080 or 720? I think the i5 might be able to do this but won't know until you give it a shot.

Do you see any encoders/decoders in the Transcoding -> Advanced settings page?

What's your server local storage/boot disk?

 

Edited by Q-Droid
Link to comment
Share on other sites

austinchief
9 minutes ago, Q-Droid said:

You shouldn't have high CPU usage when direct streaming so I suspect that at least audio might be transcoding. And that goes back to my comment re: throttling. Transcoding audio is done in CPU and usually very fast which means it can pull the file data at a high rate.

You don't seem to have any HW accel support working right now. If you forced it to transcode it would use a lot of CPU but also slow down the transfer rate. Have you tested this, transcoding to 1080 or 720? I think the i5 might be able to do this but won't know until you give it a shot.

Do you see any encoders/decoders in the Transcoding -> Advanced settings page?

What's your server local storage/boot disk?

 

I don't see a Transcoding -> Advanced Settings page.    

 

I have HW acceleration turned on and have a GeForce GTX1060 graphics card installed.    The HW detection log shows Emby seeing the device, but I see this message:

"Message": "Failed to initialize VA /dev/dri/renderD128. Error -1"

Is this why you say HW accel support is not working?    Any idea how to fix this?    

I have 2 monitors hooked up to the graphic card as I use the linux box for basic applications (Mail, Webbrowser, terminal apps, etc) ... no gaming.    The HD is a 1TB SSD M.2 drive for the EmbyServer.

When I look at the Emby Dashboard, it shows direct play only ... no transcoding of either video or audio.    I've seen transcoding on audio only ... that happens when I playback thru a web browser.    On FireTV 4k, it always shows direct playback .

Link to comment
Share on other sites

Q-Droid

Yes, it looks like it couldn't properly access your Nvidia GPU and the Intel iGPU is not even showing up.

This is the section:image.png.a9aece1eef7ebdfa8534f7bc7502c424.png

 

This would be the place to start to get your HW accel support configured: https://support.emby.media/support/solutions/articles/44001160207-hardware-acceleration-on-linux

To get the Intel iGPU working it needs to be detected by the kernel before Emby can test for it. Since you have a discreet GPU card installed and driving the displays you have to make sure the iGPU is also enabled in BIOS. Usually called IGD Multi-Monitor or IGFX Multi-Monitor or Internal Graphics.  It depends on the motherboard/BIOS. Your kernel version is right on the edge of when Coffee Lake support became stable and might have to include boot options or upgrade the kernel. But don't do those until you've checked Emby after changing the BIOS.

Then also check that the OS emby user also has video (and render if exists) groups.

These changes are not to deal with your lag and latency but to get your HW accel working and reduce CPU usage.  Different problem...but it might help if a little bit.

Link to comment
Share on other sites

austinchief
4 minutes ago, Q-Droid said:

Yes, it looks like it couldn't properly access your Nvidia GPU and the Intel iGPU is not even showing up.

This is the section:image.png.a9aece1eef7ebdfa8534f7bc7502c424.png

 

This would be the place to start to get your HW accel support configured: https://support.emby.media/support/solutions/articles/44001160207-hardware-acceleration-on-linux

To get the Intel iGPU working it needs to be detected by the kernel before Emby can test for it. Since you have a discreet GPU card installed and driving the displays you have to make sure the iGPU is also enabled in BIOS. Usually called IGD Multi-Monitor or IGFX Multi-Monitor or Internal Graphics.  It depends on the motherboard/BIOS. Your kernel version is right on the edge of when Coffee Lake support became stable and might have to include boot options or upgrade the kernel. But don't do those until you've checked Emby after changing the BIOS.

Then also check that the OS emby user also has video (and render if exists) groups.

These changes are not to deal with your lag and latency but to get your HW accel working and reduce CPU usage.  Different problem...but it might help if a little bit.

I see the advanced menu now ... thanks for pointing that out to me!    When I do that, NO encoders/decoders are found.  I'll look at the link and see what I can find!

Link to comment
Share on other sites

austinchief
37 minutes ago, Luke said:

Let us know how you get on. Thanks.

I’ve got the GPU in the i5-8400 detected now.   That doesn’t help with the stuttering though … will help with transcoding.

Link to comment
Share on other sites

Q-Droid

Have you monitored network and disk I/O on your Emby server while streaming to the FireTV? Also monitor the same for the NAS. I think the FireTV has a system monitor overlay you can enable to see those stats for the device. Without that info it's hard to pin down the source of the problem or at least know what to exclude.

  • Like 1
Link to comment
Share on other sites

rbjtech

Your i5-8400 should have very little utilisation doing this task with direct play - max 1-2%

There is something very wrong if it's hitting ~60% doing a direct stream.

Taking a step back - we know the raw network capacity between the server and NAS is @1Gbps - re-run the iperf3 test but test for a minute and use a NAS file as the source.

ie

on the nas -

iperf3 -s -F "use a large local media file here"

on the server

iperf3 -c -t 60 -i 10

When it is running on both the NAS and the Server - watch the CPU utilisation. (top -i etc) on both the client and server.

I highly suspect this will be very minimal. - Record the results.  remember this is MAX utilisation - 1Gbps. (~112 Mbytes/sec from the NAS)

If you wanted to - you could force a bandwidth limitation on iperf3 - but I don't think there is a need to here.

Now install VLC on the fireTV - and point it to the UNC share on the NAS (may need permissions etc)

Now direct play a media file from the FireTV DIRECTLY from the NAS (bypassing emby)

Again - watch for CPU utilisation on the NAS and record it.

IF all those cpu utilisation numbers are super low (and I suspect they will be) - then repeat the normal direct playback via emby - and check it's the emby process with the high utilisation.

Lets see the numbers and we can take it from there.

 

 

 

 

 

Edited by rbjtech
Link to comment
Share on other sites

Q-Droid

By the way System X-Ray is the Amazon Fire device system info overlay and can be enabled from the Developer Tools menu.

Link to comment
Share on other sites

austinchief

Ok ... I think I found the root cause!!!

On my linux hardware which runs EmbyServer, I had my NAS shares mounted using CIFS.    I switched to NFS mount and now the same high bit-rate movie that was pausing  2-3x per minute for 4-6 seconds has now played for nearly 10min without a single pause!

AND ... my CPU utilization is bouncing between 0.8-10% ... hanging around 2-4%!!!!

Link to comment
Share on other sites

  • Solution
austinchief
1 hour ago, austinchief said:

Ok ... I think I found the root cause!!!

On my linux hardware which runs EmbyServer, I had my NAS shares mounted using CIFS.    I switched to NFS mount and now the same high bit-rate movie that was pausing  2-3x per minute for 4-6 seconds has now played for nearly 10min without a single pause!

AND ... my CPU utilization is bouncing between 0.8-10% ... hanging around 2-4%!!!!

1hr 22min and NO pause/stuttering!!!!

mounting shares via CIFS was the bottleneck!!!!!    mounting using NFS protocol solves the problem!!!!!

Link to comment
Share on other sites

Q-Droid

Weird. I'm all in favor of using NFS instead but CIFS is used by so many here even on Linux-to-Linux 🥴 without major problems. There shouldn't be that much overhead or perf degradation with CIFS unless something config related on the client or server is way out of whack. Either way if NFS works better then stick with it.

 

Link to comment
Share on other sites

austinchief
7 minutes ago, Q-Droid said:

Weird. I'm all in favor of using NFS instead but CIFS is used by so many here even on Linux-to-Linux 🥴 without major problems. There shouldn't be that much overhead or perf degradation with CIFS unless something config related on the client or server is way out of whack. Either way if NFS works better then stick with it.

 

It is the ONLY change I did and immediately noticed a huge reduction in CPU utilization, then playback pause-free, and the cherry ontop of the cake:    I did a forced library scan during playback with NO pausing!    The forced library scan used to cause playback of even 720p media!!!!!

I don't fully understand it, but my guess is its a combination of CIFS and age of my hardware (decade old NAS and 5 generations old CPU/MB/RAM for EmbyServer).   

Guessing this will buy me some time before being forced to upgrade my NAS and/or EmbyServer linux hardware.

Thanks for everyone's help!

Link to comment
Share on other sites

rbjtech
6 hours ago, austinchief said:

It is the ONLY change I did and immediately noticed a huge reduction in CPU utilization, then playback pause-free, and the cherry ontop of the cake:    I did a forced library scan during playback with NO pausing!    The forced library scan used to cause playback of even 720p media!!!!!

I don't fully understand it, but my guess is its a combination of CIFS and age of my hardware (decade old NAS and 5 generations old CPU/MB/RAM for EmbyServer).   

Guessing this will buy me some time before being forced to upgrade my NAS and/or EmbyServer linux hardware.

Thanks for everyone's help!

CIFS/SMB (even v3) is a very 'chatty' protocol - I've seen issues with it many times within Emby, especially on the 'Shield' running as a server.  I think it's a combination of the OS, driver and the SMB chatty protocol (+ possibly some emby file/stream worker inefficiencies) that introduces the bottleneck on some systems as Q-Droid has said above - you were just unfortunate to be one of those users.  NFS is much more efficient and is not conflicting with the HTTP streaming client side.   

Nice fix :)

Edited by rbjtech
  • Agree 1
  • Thanks 1
Link to comment
Share on other sites

  • 5 months later...
billxsand
On 3/2/2023 at 8:46 AM, ebr said:

Hi.  What type of audio?  As a test, if you set the app to "mix down to stereo" does it make a difference?

I could KISS you! OMG I have been having this problem for YEARS and suddenly the lagging is GONE !

 

edit: it's back but I think i am on the right track... Thank you

Edited by billxsand
Link to comment
Share on other sites

On 3/3/2023 at 9:31 PM, Q-Droid said:

Have you monitored network and disk I/O on your Emby server while streaming to the FireTV? Also monitor the same for the NAS. I think the FireTV has a system monitor overlay you can enable to see those stats for the device. Without that info it's hard to pin down the source of the problem or at least know what to exclude.

@Q-Droiddo you recall the recent forum topic where someone was looking at network throughput for downloads between emby server and clients? I think you were involved there but I can't find it.

Link to comment
Share on other sites

Q-Droid
6 hours ago, Luke said:

@Q-Droiddo you recall the recent forum topic where someone was looking at network throughput for downloads between emby server and clients? I think you were involved there but I can't find it.

Was it this one about ZFS?

 

Link to comment
Share on other sites

  • 4 months later...
toolis

Hi,

First of all, I would like to apologise in advance for my poor tech knowledege. Secondly, I have the same issue of 4k movies lagging and I was browsing through the internet to find a solution and stumbled upon this thread. Unfortunately, my case is not the same. However, let me tell you and see if you can recommend sth for my case.

I run emby on my 10 year old pc  (i5-4460), I have 100mbps home connection (96 at most actually), I run the app on a Samsung 4k smart TV which is connected to the same network with LAN cable and I have my movies stored to hdd hard drives, either in the tower or in a fantec drives case, connected to my pc through usb.

Give it to me honestly!!! Am I doomed if I want to watch a 4k movie without lagging? If not, what is there to do?

Also, I can't find "mix down to stereo" option. Where EXACTLY is it? Also, is it on pc config? Is it on TV app?

 

Thanks in advance....

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

rbjtech
40 minutes ago, toolis said:

Hi,

First of all, I would like to apologise in advance for my poor tech knowledege. Secondly, I have the same issue of 4k movies lagging and I was browsing through the internet to find a solution and stumbled upon this thread. Unfortunately, my case is not the same. However, let me tell you and see if you can recommend sth for my case.

I run emby on my 10 year old pc  (i5-4460), I have 100mbps home connection (96 at most actually), I run the app on a Samsung 4k smart TV which is connected to the same network with LAN cable and I have my movies stored to hdd hard drives, either in the tower or in a fantec drives case, connected to my pc through usb.

Give it to me honestly!!! Am I doomed if I want to watch a 4k movie without lagging? If not, what is there to do?

Also, I can't find "mix down to stereo" option. Where EXACTLY is it? Also, is it on pc config? Is it on TV app?

 

Thanks in advance....

Hi - You are better off asking in the Samsung Client Forum - as this forum is for Android clients.

Samsung Smart TV - Emby Community

That being said - your likely issue is incompatibility between the Samsung Client/TV and the sources files - leading to Emby having to convert(or transcode) the file to get it to play properly and your PC may not have sufficient power to to this.    It may however, just be a case of you selecting the correct audio track before you begin playback ...

Link to comment
Share on other sites

billxsand
8 hours ago, rbjtech said:

Hi - You are better off asking in the Samsung Client Forum - as this forum is for Android clients.

I would typically agree with you, but the SEO Gods have chosen this thread and I am here to end it once and for all.

 

 

9 hours ago, toolis said:

Hi,

First of all, I would like to apologise in advance for my poor tech knowledege. Secondly, I have the same issue of 4k movies lagging and I was browsing through the internet to find a solution and stumbled upon this thread. Unfortunately, my case is not the same. However, let me tell you and see if you can recommend sth for my case.

I run emby on my 10 year old pc  (i5-4460), I have 100mbps home connection (96 at most actually), I run the app on a Samsung 4k smart TV which is connected to the same network with LAN cable and I have my movies stored to hdd hard drives, either in the tower or in a fantec drives case, connected to my pc through usb.

I am you from 6 months in the future. It's time to get a new NAS. I just finished my build after a week of actual building and a month of data and app migration, and just now I streamed my main problem 4k movie (The Bob's Burgers Movie) with NO ISSUES.

But first I want to get this out of the way -

Quote

Also, I can't find "mix down to stereo" option. Where EXACTLY is it? Also, is it on pc config? Is it on TV app?

TV Emby App Settings > Application Settings > Playback > Audio output > Downmix to Stereo

 

Quote

Give it to me honestly!!! Am I doomed if I want to watch a 4k movie without lagging? If not, what is there to do?

The issue is that we are trying to stream NEW CODECS from OLD HARDWARE.

For Black Friday I bought myself a brand new Samsung TV, the S90C. When the issue persisted, I looked at my now 12 year old NAS. After inspecting the ffmpeg and emby logs, I am fairly certain it was trying to convert an audio codec was released AFTER the CPU came out. Not positive on this, but it doesn't matter, because the bottom line is that if you want to stream the latest greatest 4k movies you need better hardware.

You can test this out if you have a recent gaming PC by setting up a test emby server on that and seeing if the issue persists. As was the case for me, the issue went away, so I knew it was time for a new NAS .

I asked around on the various sites and a very helpful user gave me this list. along with this comment.

https://pcpartpicker.com/list/JdwGh3

I followed his tip on the SAS HBA as I have 7 drives and it was excellent advice.

a note on the case-  the R5 is no longer on sale and the Meshify from Fractal has much better airflow. Personally I am happy with my purchase as I am a bigger fan of the industrial design of the R5 and i have no issues with HDD temps.

Once you get everything switched over and up and running, DON'T FORGET to switch the 'Audio output' setting BACK TO 'AUTO' on your EMBY CLIENT. 🤦‍♂️ Ask me how I know!

Also I switched from TrueNAS to Unraid and while the fact that it costs $$ (on TOP of a new build) sucks, i do find the platform much more easy and straight-forward. TrueNAS is constantly changing and upending things, hopefully that is not the case with Unraid. 

 

It is time to pull the band-aid, my friend. Good luck to you. 🍀

 

~Mods - Sorry for the long and tangential comment, but as I said, I hope to help people solve this issue once and for all. It is time to let go of our decade old repurposed gaming PC's. The time has come. Thank you and goodnight. !!

Edited by billxsand
formatting
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...