Jump to content

Long file names breaks playback and metadata reading


Weevillo
Go to solution Solved by softworkz,

Recommended Posts

Weevillo

I've got some shows with sentence-long file names which are picked up in the web interface but with no metadata and without the ability to play them back on clients (tested on Android and TV version). I've enabled LongPathEnabled in the registry, which leads me to believe that there might have something to do with Emby. Is this something that can perhaps be fixed on your side?

Link to comment
Share on other sites

Weevillo
54 minutes ago, Luke said:

Hi there, can we please look at an example?

Here's a screenshot detailing what I meant with no metadata (as you know there are supposed to be areas detailing video, audio and subtitle information etc.) and the debug logs from when the server tried to play the video back on my Shield TV(it ended up showing the "to many errors" message on the client).

Screenshot 2022-01-19 204651.png

embyserver.txt

Link to comment
Share on other sites

Weevillo
17 minutes ago, Happy2Play said:

Problem long paths/long filename (>259 characters) / ffprobe error - General/Windows - Emby Community

So, I shall basically put \\?\ in front of my drive's name or was I to add it before the show's folder? In this case it would be:

"W:\Home Media Library 2\Anime TV\\?\Genius Prince's Guide to Raising a Nation Out of Debt, The (2022) [tvdb-400961]" then?

I mean, it's better then to have to change to naming in Sonarr every time but this feels like a super trivial issue. If there's nothing Emby can do but this works then thanks for your assistance.

Edited by Weevillo
Link to comment
Share on other sites

Happy2Play

Dev will have to comment, but if I understand this it would be "\\?\W:\Home Media Library 2\Anime TV" or whatever level your library points to.

Link to comment
Share on other sites

  • Solution
6 hours ago, Weevillo said:

So, I shall basically put \\?\ in front of my drive's name or was I to add it before the show's folder? In this case it would be:

"W:\Home Media Library 2\Anime TV\\?\Genius Prince's Guide to Raising a Nation Out of Debt, The (2022) [tvdb-400961]" then?

I mean, it's better then to have to change to naming in Sonarr every time but this feels like a super trivial issue. If there's nothing Emby can do but this works then thanks for your assistance.

 

  • Like 1
Link to comment
Share on other sites

  • 2 months later...
Teredactle

Thanks for this post, I am also having this issue and made the necessary changes, we'll see once files are rescanned in, if playback is no longer a problem (hopefully won't get this any longer No such file or directory)

 

Link to comment
Share on other sites

20 minutes ago, Teredactle said:

Thanks for this post, I am also having this issue and made the necessary changes, we'll see once files are rescanned in, if playback is no longer a problem (hopefully won't get this any longer No such file or directory)

 

Let us know how you get on. Thanks.

Link to comment
Share on other sites

Teredactle

So far so good, I thought I had an issue with one video not playing yesterday but now I can't find it.

Do you know if this fix adds any time to starting playback? I don't know if it's true or not, I can't really quantify it, but it "seems" like the videos from the library to which I added this prefix, start playback a bit slower than before.

Link to comment
Share on other sites

22 hours ago, Teredactle said:

So far so good, I thought I had an issue with one video not playing yesterday but now I can't find it.

Do you know if this fix adds any time to starting playback? I don't know if it's true or not, I can't really quantify it, but it "seems" like the videos from the library to which I added this prefix, start playback a bit slower than before.

Not that I know of.

Link to comment
Share on other sites

On 3/31/2022 at 9:15 PM, Teredactle said:

So far so good, I thought I had an issue with one video not playing yesterday but now I can't find it.

Do you know if this fix adds any time to starting playback? I don't know if it's true or not, I can't really quantify it, but it "seems" like the videos from the library to which I added this prefix, start playback a bit slower than before.

No, this can't be. This is a low-level Win32 API implementation and there's just one way to make such kind of change: Change the whole internal implementation to support those long paths and expose the legacy API on top of it (for compatibility).

Only when you would have misinterpreted the procedure and changed to use some UNC (network) path instead of a mapped drive letter: that would indeed be slower.

Link to comment
Share on other sites

Teredactle
11 hours ago, softworkz said:

Only when you would have misinterpreted the procedure and changed to use some UNC (network) path instead of a mapped drive letter: that would indeed be slower.

This is a weird statement, because I'm running the portable version. When I was having issues, I tried the installer, and in that version you can no longer add a library (on a network) by mapped drive, it doesn't show mapped drives and you're forced to use UNC pathnames. So what you're saying is that using UNC pathnames, playback would be slower than on mapped drives. Or is it only when using the \\?\ fix, that UNC pathnames would cause a delay when compared to mapped drives?

Link to comment
Share on other sites

1 hour ago, Teredactle said:

\\?\

Not affecting performance

1 hour ago, Teredactle said:

. So what you're saying is that using UNC pathnames, playback would be slower than on mapped drives.

Yes, in most cases.

With a mapped network drive, you get a single connection (precisely: connections) - with UNC paths, each program will  create  it's own connection, each under the individual security context

Link to comment
Share on other sites

On 4/4/2022 at 6:30 AM, softworkz said:

With a mapped network drive, you get a single connection

I forgot to mention: single connection (or connections, but all managed withing the same session-specific context) also includes caching of directory contents. You can see that in Windows explorer when browsing network folders (once below a mapped drive letter and the other below a UNC path), selecting different folders is faster when mapped as drive.

Link to comment
Share on other sites

7 hours ago, softworkz said:

I forgot to mention: single connection (or connections, but all managed withing the same session-specific context) also includes caching of directory contents. You can see that in Windows explorer when browsing network folders (once below a mapped drive letter and the other below a UNC path), selecting different folders is faster when mapped as drive.

Even so, I don't think the performance differences are meaningful in most cases and mapped drives in Windows are very problematic because Windows decides to just disconnect them at times.

Link to comment
Share on other sites

39 minutes ago, ebr said:

Even so, I don't think the performance differences are meaningful in most cases

This is my experience from more than two decades of SMB protocol in corporate environments. The behavior exists since Windows NT4 (at minimum) and hasn't changed since then, no matter whether the remote end is a router or whether it's a huge ActiveDirectory environment with Windows Server 2019 servers and the newer feature additions like DFS (distributed file system) & Co.

The performance advantages are multi-fold:

  • It is not required to perform authentication separately in each application - the session-scope connection and context is used instead 
    (when using a mapped drive letter)
    For Emby server alone, the advantage would be small, because auth would need to be done once in a while only.
    But when executing an external process (like ffmpeg or ffprobe for example), the authentication would need to be repeated each time when launching one of those. 
    I wasn't involved, but this might even be a reason why we're no longer using the SMB protocol from ffmpeg.
    .
  • The second part where advantages are very relevant and noticeable is enumeration of directory content
    First: Assuming that your process has authenticated already, there is almost no difference when addressing a single specific file directly (for reading), and using UNC paths vs. mapped drives doesn't have a significant impact
    When you are iterating a directory tree, though, the differences are very noticeable. In case of a mapped drive letter, the contents are cached: you can navigate back and forth instantly. But with UNC paths, there's no caching and each folder's contents will be re-loaded each time you navigate to one.
    .,
  • With mapped drives, you do not only get caching, you also get event-based content updates of those cached folders
    For example,
    • navigate to a network folder with its UNC path in Explorer
    • Then make a change to that folder from the server (or elsewhere)
      e.g.  add a new file to the folder that is shown in Explorer
    • Watch the Explorer window 
      => nothing happens
    • Press F5
      => the view reloads the directory contents and you'll finally see the new file
    • Now, repeat the same, but access the folder through its mapped drive letter
      => You'll see that the folder content updates automatically without needing to refresh
      => why is this better? Because with a mapped drive, you get a local cache of the file system which is updated via event subscriptions to keep it in sync and when you need to list files from a directory repeatedly, it won't require a remote request to re-load contents as it is already known to be up-to-date

 

1 hour ago, ebr said:

drives in Windows are very problematic because Windows decides to just disconnect them at times

Windows doesn't do this.

If you have seen that, then it was due to flawed implementations of the SMB protocol which are often used by cheap routers or NAS boxes and implemented in a way that they can handle only a single connection context from each network client. When you have a mapped drive letter and you try to access via UNC path simultaneously or you run an application in a different authorization context (e.g. as a Windows service or under a different user account) from which an additional connection is made, this could cause a flawed SMB server to disconnect (or invalidate) all other connections from that server.

  • Like 1
Link to comment
Share on other sites

Teredactle
3 hours ago, softworkz said:

With mapped drives, you do not only get caching, you also get event-based content updates of those cached folders
For example,

  • navigate to a network folder with its UNC path in Explorer
  • Then make a change to that folder from the server (or elsewhere)
    e.g.  add a new file to the folder that is shown in Explorer
  • Watch the Explorer window 
    => nothing happens
  • Press F5
    => the view reloads the directory contents and you'll finally see the new file
  • Now, repeat the same, but access the folder through its mapped drive letter
    => You'll see that the folder content updates automatically without needing to refresh
    => why is this better? Because with a mapped drive, you get a local cache of the file system which is updated via event subscriptions to keep it in sync and when you need to list files from a directory repeatedly, it won't require a remote request to re-load contents as it is already known to be up-to-date

 

^^^^ THIS!!!!

Great post, and I can confirm that Windows doesn't just "randomly" disconnect mapped drives; whenever this has happened, it was caused by something legit.

All this said, why then, for Emby Windows installable (i.e. not portable release) the option to use mapped drives has been removed? In troubleshooting my installation (portable) I tried the installable one only to discover when adding folders to libraries, that my mapped drives were not longer coming up as an options and I was forced to use UNC pathnames.

*I've since solved the issues and am using the portable version, but the question above I think is legitimate.

Thanks!

 

Link to comment
Share on other sites

Quote

All this said, why then, for Emby Windows installable (i.e. not portable release) the option to use mapped drives has been removed?

HI, there never was an option. This is something you setup in Windows, not in Emby Server.

Quote

Great post, and I can confirm that Windows doesn't just "randomly" disconnect mapped drives; whenever this has happened, it was caused by something legit.

Actually it does, when they idle, and this can result in the server being unable to read the contents of the drive.

Link to comment
Share on other sites

Teredactle
7 minutes ago, Luke said:

HI, there never was an option. This is something you setup in Windows, not in Emby Server.

I think you misunderstood. What I'm saying is that, on my Emby server I have mapped drives.

  1. When I use the portable emby installation, and I add folders to a library, it shows me all drives, local and mapped
  2. When I used the installable emby installation, and I tried to add folders to a library, it would only show local drive letter, it would not show me mapped drive letters, I was forced to use UNC path.

 

Link to comment
Share on other sites

That's just a matter of what was detected, but you can still manually type in the path to whatever you need.

Link to comment
Share on other sites

I'm not debating the technical accuracy of the performance differences.  I'm questioning whether or not they matter for media consumption in the vast majority of cases.

I definitely know we have spent troubleshooting time on mapped drives that are no longer there so, for our purposes, we recommend UNC paths.  You can use mapped drives if you want though.

Link to comment
Share on other sites

Teredactle
2 hours ago, Luke said:

That's just a matter of what was detected, but you can still manually type in the path to whatever you need.

I tried, it did not work. So when I used to drop down it didn't show the mapped drive, I put in the mapped drive manually and then clicked the side button that looks for folders/subfolders and it did not work. Regardless, the portable installation works so really for me it's working as I need it to.

Link to comment
Share on other sites

13 minutes ago, Teredactle said:

I put in the mapped drive manually and then clicked the side button that looks for folders/subfolders and it did not work

Hi. Browsing the location from the web interface may not work but you should be able to just enter the location and hit Save/OK.

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...