Jellyfin Forum
Large files & remuxes buffer while streaming in the same network - Printable Version

+- Jellyfin Forum (https://forum.jellyfin.org)
+-- Forum: Support (https://forum.jellyfin.org/f-support)
+--- Forum: Troubleshooting (https://forum.jellyfin.org/f-troubleshooting)
+--- Thread: Large files & remuxes buffer while streaming in the same network (/t-large-files-remuxes-buffer-while-streaming-in-the-same-network)

Pages: 1 2 3


RE: Large files & remuxes buffer while streaming in the same network - Sash - 2024-08-14

(2024-08-14, 03:03 PM)TheDreadPirate Wrote: When you are playing in MPV Shim can you open task manager and check the CPU and GPU usage?

(2024-08-14, 04:52 PM)TheDreadPirate Wrote: How much of the directions provide by @DazzlingTap2 did you follow?  I don't use MPV Shim myself, but I've seen this a couple of times and it required some reconfiguration to get MPV Shim to work smoothly.

I have followed everything that they said about the config, but I also see an issue with using Shim long term. 

It doesn't read the media directly from the source. It streams and transcodes the media and creates and deletes cache on every play, and this could affect my SSD and make it's life short.

@DazzlingTap2 did mentione about this tool embyToLocalPlayer but the guide on github is a mess and I have been getting this error

Code:
[08/14/24 22:14:10.5] ['Python path: C:\\Users\\_hide_user_\\Downloads\\Compressed\\etlp-mpv-py-embed-win32\\python_embed\\python.exe']
[08/14/24 22:14:10.5] ['ini path: C:\\Users\\_hide_user_\\Downloads\\Compressed\\etlp-mpv-py-embed-win32\\embyToLocalPlayer.ini']
[08/14/24 22:14:10.5] Windows-10-10.0.22631-SP0 Python-3.9.13
[08/14/24 22:14:12.9] C:\Users\_hide_user_\Downloads\Compressed\etlp-mpv-py-embed-win32\embyToLocalPlayer.py
[08/14/24 22:14:12.9] use mpv_embed and overwrite ini because mpv_embed folder exists
C:\Users\_hide_user_\Downloads\Compressed\etlp-mpv-py-embed-win32\mpv_embed\mpv.exe
Traceback (most recent call last):
  File "C:\Users\_hide_user_\Downloads\Compressed\etlp-mpv-py-embed-win32\embyToLocalPlayer.py", line 35, in <module>
    run_server()  # 主要逻辑入口:utils.http_server.py
  File "C:\Users\_hide_user_\Downloads\Compressed\etlp-mpv-py-embed-win32\utils\http_server.py", line 46, in run_server
    httpd = ThreadingHTTPServer(server_address, UserScriptRequestHandler)
  File "socketserver.py", line 452, in __init__
  File "http\server.py", line 136, in server_bind
  File "socketserver.py", line 466, in server_bind
PermissionError: [WinError 10013] An attempt was made to access a socket in a way forbidden by its access permissions



RE: Large files & remuxes buffer while streaming in the same network - TheDreadPirate - 2024-08-14

Is Shim configured to transcode? I thought the defaults were to NOT transcode on the server.

As for SSD endurance, this isn't a concern. Even when lots of transcoding is happening. I forget what is called on Windows, but there are tools to display the S.M.A.R.T. stats of your SSD. I had an old SSD that I used to run Jellyfin on. It was my gaming desktop's primary SSD for almost 10 years, I repurposed it for my Jellyfin server, and over the 15 years I've had the SSD only 2% drive life was used.

Here are the stats for my current SSD.

Code:
root@rat-trap:~# smartctl -A /dev/nvme0n1
smartctl 7.4 2023-08-01 r5530 [x86_64-linux-6.8.0-43-generic] (local build)
Copyright (C) 2002-23, Bruce Allen, Christian Franke, www.smartmontools.org

=== START OF SMART DATA SECTION ===
SMART/Health Information (NVMe Log 0x02)
Critical Warning:                   0x00
Temperature:                        49 Celsius
Available Spare:                    100%
Available Spare Threshold:          10%
Percentage Used:                    0%
Data Units Read:                    1,626,692 [832 GB]
Data Units Written:                 9,531,555 [4.88 TB]
Host Read Commands:                 33,567,342
Host Write Commands:                93,199,579
Controller Busy Time:               5,941
Power Cycles:                       30
Power On Hours:                     2,602
Unsafe Shutdowns:                   18
Media and Data Integrity Errors:    0
Error Information Log Entries:      0
Warning  Comp. Temperature Time:    0
Critical Comp. Temperature Time:    0
Temperature Sensor 1:               43 Celsius
Temperature Sensor 2:               49 Celsius

4.88TB of writes, mostly from transcoding. The "Percentage Used" is 0%.


RE: Large files & remuxes buffer while streaming in the same network - Sash - 2024-08-14

(2024-08-14, 05:24 PM)TheDreadPirate Wrote: Is Shim configured to transcode?  I thought the defaults were to NOT transcode on the server.

As for SSD endurance, this isn't a concern.  Even when lots of transcoding is happening.  I forget what is called on Windows, but there are tools to display the S.M.A.R.T. stats of your SSD.  I had an old SSD that I used to run Jellyfin on.  It was my gaming desktop's primary SSD for almost 10 years, I repurposed it for my Jellyfin server, and over the 15 years I've had the SSD only 2% drive life was used.

Here are the stats for my current SSD.

Code:
root@rat-trap:~# smartctl -A /dev/nvme0n1
smartctl 7.4 2023-08-01 r5530 [x86_64-linux-6.8.0-43-generic] (local build)
Copyright (C) 2002-23, Bruce Allen, Christian Franke, www.smartmontools.org

=== START OF SMART DATA SECTION ===
SMART/Health Information (NVMe Log 0x02)
Critical Warning:                  0x00
Temperature:                        49 Celsius
Available Spare:                    100%
Available Spare Threshold:          10%
Percentage Used:                    0%
Data Units Read:                    1,626,692 [832 GB]
Data Units Written:                9,531,555 [4.88 TB]
Host Read Commands:                33,567,342
Host Write Commands:                93,199,579
Controller Busy Time:              5,941
Power Cycles:                      30
Power On Hours:                    2,602
Unsafe Shutdowns:                  18
Media and Data Integrity Errors:    0
Error Information Log Entries:      0
Warning  Comp. Temperature Time:    0
Critical Comp. Temperature Time:    0
Temperature Sensor 1:              43 Celsius
Temperature Sensor 2:              49 Celsius

4.88TB of writes, mostly from transcoding.  The "Percentage Used" is 0%.

I have a samsung evo which is 2 years old, and it's already down to 84%.


RE: Large files & remuxes buffer while streaming in the same network - TheDreadPirate - 2024-08-14

Your other option is to use a RAM disk. Not sure if that is possible on Windows, but easily doable on Linux.


RE: Large files & remuxes buffer while streaming in the same network - Sash - 2024-08-14

I don't think it's possible on windows. The only option is see is getting embyToLocalPlayer to work somehow.

Btw, I noticed that I have only been having issues while playing DoVi files that aren't HDR10 compatible. 

Take this for an example. This movie's format is 

Code:
Dolby Vision, Version 1.0, Profile 5, dvhe.05.06, BL+RPU, no metadata compression
 
That does not play properly on MPV Shim or Jellyfin Media Player. And the file size or bitrate also doesn't matter when the format is that. Stuttering is always there and the only exception is if I play it directly through MPV then it runs flawlessly, but it is being tone mapped.

I'm wondering if Jellyfin doesn't support this format, because even when I had tone mapping on it wasn't able to map the colors on JFM. I had to enable force transcode for Dolby Vision from JFM Client Settings in order to get the colors right for this format.

Something like this always works

Code:
Dolby Vision, Version 1.0, Profile 8.1, dvhe.08.06, BL+RPU, no metadata compression, HDR10 compatible / SMPTE ST 2094 App 4, Version HDR10+ Profile B, HDR10+ Profile
 

And the good thing about this format is that I can disable the tone mapping for this while leaving the H/W on, and the colors are just perfect and not washed out.


RE: Large files & remuxes buffer while streaming in the same network - Sash - 2024-08-15

Just gonna mention that the large files & remuxes were stuttering on my TV and it turned out that it was my Internet. I switched from Ethernet port to WiFi on my TV to increase the speed, and that fixed it, but then I had a couple of issues on desktop with Jellyfin server, and playing some files. 

First of all I'd want to thank you guys for your help @Efficient_Good_5784 @TheDreadPirate @DazzlingTap2, I figured out a lot of things with your help, but there are a couple of things that I still didn't understand.

         1. I still have to find a way to store the playback cache of MPV Shim, embyToLocalPlayer, Jellyfin's cache in one of my HDD, and not the SSD where my Jellyfin server, Jellyfin Player, MPV Shim is currently installed. I need to do this so there isn't any read, write, & deletion on my SSD to make it life's short.

         2. MPV Shim & Jellyfin stutters a lot with this format:
Sash Wrote:Dolby Vision, Version 1.0, Profile 5, dvhe.05.06, BL+RPU, no metadata compression

Can anyone confirm that DoVi files that aren't HDR10 compatible have issues during playback? 

This format always works for me

Sash Wrote:Dolby Vision, Version 1.0, Profile 8.1, dvhe.08.06, BL+RPU, no metadata compression, HDR10 compatible / SMPTE ST 2094 App 4, Version HDR10+ Profile B, HDR10+ Profile

        3. It says, for example, "Kung Fu Panda 4 (transcode)" in the player & it's also caching the movie (screenshot attached with this post). I checked the logs of Jellyfin MPV Shim and it looks like it is transcoding because "TranscodeReasons=VideoResolutionNotSupported"
   
Can someone confirm that Jellyfin transcodes when the resolution is mismatched? I have a 2k monitor, and I'm playing 4K videos, but my gpu should be able to handle it and not stutter because these files work perfectly when I play the directly on MPV player. Btw, I have attached entire log of MPV Shim with this post.

        4. When I disable tone mapping and play the videos on MPV Shim, embyToLocalPlayer MPV, or Jellyfin web then the colors are washed out. The colors don't get washed out if I play it on Jellyfin Media Player even when the tone mapping is disabled. Does anyone have any idea why this happens? My display is HDR enbaled so I feel like the HDR should passthrough without tone mapping being on. 

   

I have also made embyToLocalPlayer work and it works better than MPV Shim on my system. 



MPV Shim Installation: 
  • Download this
  • Download latest version of MPV 
  • Install MPV Player here  C:\Program Files (x86)\mpv
  • Install Shim, and then edit conf.json of MPV Shim that will be here C:\Users\yourusername\AppData\Roaming\jellyfin-mpv-shim
Thanks to @DazzlingTap2 for this. 
DazzlingTap2 Wrote:
Code:
"mpv_ext": true,
" mpv_ext_ipc": "mpv",    
"mpv_ext_no_ovr": true,    
"mpv_ext_path": "C:\\Program Files (x86)\\mpv\\mpv.exe",   
"mpv_ext_start": true,    
"mpv_log_level": "info",
  • Copy and paste "mpv.conf" from "C:\Users\yourusername\AppData\Roaming\jellyfin-mpv-shim" to "C:\Users\yourusername\AppData\Roaming\mpv". If the folder doesn't exist then make it. 
  • Add this code to "mpv.con" that was just copied.
DazzlingTap2 Wrote:
Code:
vo=gpu-next
gpu-api=vulkan #or gpu-api=d3d11
fullscreen=yes
target-colorspace-hint=yes

DazzlingTap2 Wrote:You can also put the following mpv.conf into a configuration section of Jellyfin Media Player under Client Settings, Click on the user icon on the top right side and go to Client Settings, however this workaround to get HDR working will spawn a new MPV player where you cannot control anything.



embyToLocalPlayer Installation:

I'll explain the process here because the guide on github is Chinese and you can do the installation in fewer steps. 
  • Download latest version of "embyToLocalPlayer.zip" from this repo.
  • Extract the zip, and open embyToLocalPlayer_config.ini in Notepad or any text editing tool. 
  • Add the location of your mpv.exe in the config file & the name of the player.
For example:
Code:
mpv = C:\Program Files (x86)\mpv\mpv.exe
mpve = (Remove these locations from .ini if you are not gonna use this player)
pot = (Remove these locations from .ini if you are not gonna use this player)
hc = (Remove these locations from .ini if you are not gonna use this player)
be = (Remove these locations from .ini if you are not gonna use this player)
vlc = (Remove these locations from .ini if you are not gonna use this player)
[emby]
player = mpv
  • Install Python (The minimum supported Python version is 3.8. The minimum supported Windows version is 8.1). While installing python check "add to path".
  • Install Tampermonkey extension on your we browser, and install this script in Tampermonkey. You can click on the extenstion > Create a new script or just go to the page I linked and click on install.
  • Double-click embyToLocalPlayer_debug.bat(do not right-click to run as administrator).
  • If there is no error, then press "1" in the same window (do not close the window), and then open Jellyfin Web-UI on your browser and play the movie to see if the MPV player is called. (Just click the original play button)
    You should see a window like this if you have done everything correctly. 
Code:
[08/15/24 11:11:50.0] ['Python path: C:\\Users\\_hide_user_\\AppData\\Local\\Programs\\Python\\Python310\\python.exe']
[08/15/24 11:11:50.0] ['ini path: H:\\embyToLocalPlayer_2\\embyToLocalPlayer_config.ini']
[08/15/24 11:11:50.0] Windows-10-10.0.22631-SP0 Python-3.10.6
[08/15/24 11:11:51.4] H:\embyToLocalPlayer_2\embyToLocalPlayer.py
[08/15/24 11:11:51.4] serving at http://127.0.0.1:58000
  • Double-click embyToLocalPlayer_debug.bat Press "2" to create a windows startup process so you don't have to open embyToLocalPlayer_debug.bat everytime you want to watch something. 





RE: Large files & remuxes buffer while streaming in the same network - TheDreadPirate - 2024-08-15

1. You can configure where Jellyfin writes trancodes in Dashboard > Playback, scroll down about half way. This can be a hard drive if you desire, but we recommend SSDs since multiple transcodes, or other disk accesses, would limit write speeds thus limit transcode performance when using fast, modern hardware accelerators.
2. I vaguely recall that when you playback Dolby Vision in MPV on a PC, the GPU decoder will convert Dolby Vision to HDR10 due to licensing issues or something like that. So that may explain what is going on. Since DV8 "falls back" to HDR10, its easy to play that back by just discarding the DV enhancement layer metadata. But DV5 is a proprietary color space that probably needs to be converted to the HDR10 BT2020 color space. Much more intensive. But your GPU SHOULD be able to handle that, no problem.


RE: Large files & remuxes buffer while streaming in the same network - DazzlingTap2 - 2024-08-15

Since Sash directed me in this thread I'll post my findings here. I've already talked with him in private and resolve some problems (checking MPV shim logs and attempt to disable transcoding).

What SSD you currently have? Unless it's a crap one you shouldn't have issues with longevity. I now run all of my Windows OS and program on a single SSD. DreadedPirate provided help already on where to change location for Jellyfin server, I think for Shim and etlp, these are lightweight player/backend software that simply process web requests and open shell commands, not a lot of IO is happening.

Quote:Can anyone confirm that DoVi files that aren't HDR10 compatible have issues during playback?

No issues using MPV Shim and external MPV, colors look correct, pictures are bright and monitor enters HDR. Sometimes with funky HDR in windows it's bug out, but nothing like the stuttering issues what you described.

Quote:Can someone confirm that Jellyfin transcodes when the resolution is mismatched? I have a 2k monitor, and I'm playing 4K videos, but my gpu should be able to handle it and not stutter because these files work perfectly when I play the directly on MPV player. Btw, I have attached entire log of MPV Shim with this post.
No, that should not be the case. I have a 2560x1440p monitor also with HDR, when I playback any 4K remux DV or HDR regardless of size, I open it in web browser and chose MPV Shim as cast client, playback is smooth and monitor enters HDR mode. So I don't know why your jellyfin does that. Maybe you can try fully disable transcoding, create a user that have no transcode privilege and sign in to Shim with that instead.

Quote:4. When I disable tone mapping and play the videos on MPV Shim, embyToLocalPlayer MPV, or Jellyfin web then the colors are washed out. The colors don't get washed out if I play it on Jellyfin Media Player even when the tone mapping is disabled. Does anyone have any idea why this happens? My display is HDR enbaled so I feel like the HDR should passthrough without tone mapping being on.
Makes sense why Jellyfin Web is washed out, but etlp and Shim should not because these tools are just spawning MPV instances to playback so all that your MPV supports should be supported by these tools. Try launching mpv from your terminal with some files to see if the conf's are still working. In the mean time, in your picture PotPlayer also has correct HDR, so you can try using Pot with etlp and see if that works.