Opened 4 years ago

Closed 2 years ago

#8885 closed enhancement (fixed)

Windows 10 long path support

Reported by: stax76 Owned by:
Priority: wish Component: build system
Version: git-master Keywords:
Cc: Blocked By:
Blocking: Reproduced by developer: yes
Analyzed by developer: yes

Description

I would like to request long path support in Windows 10. Currently, long paths work only with long path prefix
?\ or 8.3 names. I would like to request native long path support that don't need a prefix or 8.3 (short) name.

https://docs.microsoft.com/en-us/windows/win32/fileio/naming-a-file#maximum-path-length-limitation

https://docs.microsoft.com/en-us/windows/win32/fileio/naming-a-file#short-vs-long-names

https://docs.microsoft.com/en-us/windows/win32/fileio/naming-a-file#enable-long-paths-in-windows-10-version-1607-and-later

This is frequently requested by staxrip users.

https://github.com/staxrip/staxrip/issues/226#issuecomment-687586840

Change History (12)

comment:1 by Carl Eugen Hoyos, 4 years ago

Component: ffmpegundetermined
Keywords: Win10 removed
Resolution: needs_more_info
Status: newclosed
Type: enhancementdefect

Please reopen this ticket if you can explain how the issue you see can be reproduced, either show the command line you tested together with the complete, uncut console output or provide source code.

comment:2 by stax76, 4 years ago

Resolution: needs_more_info
Status: closedreopened

Samples> ffmpeg -i 'C:\Users\frank\long path\iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii\iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii\iiiiiiiiiiiiiiiiiiiiiiiiiiiii\iiiiiiiiiiiiiiiiiiiiiiiiiiiiii\iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii\iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii\iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii\iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii\iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii\iiiiiiiiiiiiiiiiiiiiiiiiiiiiiii\fitness.mkv' -hide_banner
C:\Users\frank\long path\iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii\iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii\iiiiiiiiiiiiiiiiiiiiiiiiiiiii\iiiiiiiiiiiiiiiiiiiiiiiiiiiiii\iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii\iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii\iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii\iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii\iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii\iiiiiiiiiiiiiiiiiiiiiiiiiiiiiii\fitness.mkv: No such file or directory

The file exists, it works when the file is prefixed, so it's likely sufficient to modify the manifest info to make it work.

https://github.com/staxrip/staxrip/blob/master/My%20Project/app.manifest#L25

https://gitlab.com/mbunkus/mkvtoolnix/-/blob/9cdae214ae5055aa2b0c218fccff96b862d3746f/src/extract/manifest.xml.erb#L14

Desktop> ffmpeg -i '\\?\C:\Users\frank\long path\iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii\iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii\iiiiiiiiiiiiiiiiiiiiiiiiiiiii\iiiiiiiiiiiiiiiiiiiiiiiiiiiiii\iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii\iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii\iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii\iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii\iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii\iiiiiiiiiiiiiiiiiiiiiiiiiiiiiii\fitness.mkv' -hide_banner
Input #0, matroska,webm, from '\\?\C:\Users\frank\long path\iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii\iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii\iiiiiiiiiiiiiiiiiiiiiiiiiiiii\iiiiiiiiiiiiiiiiiiiiiiiiiiiiii\iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii\iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii\iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii\iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii\iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii\iiiiiiiiiiiiiiiiiiiiiiiiiiiiiii\fitness.mkv':
  Metadata:
    encoder         : libebml v1.3.4 + libmatroska v1.4.5
    creation_time   : 2017-05-18T11:30:45.000000Z
    Writing frontend: StaxRip 1.4.4.5
  Duration: 00:00:21.58, start: 0.000000, bitrate: 1117 kb/s
    Stream #0:0: Video: h264 (Main), yuv420p(tv, bt709, progressive), 1280x720 [SAR 1:1 DAR 16:9], 29.59 fps, 29.59 tbr, 1k tbn, 59.18 tbc (default)
Last edited 4 years ago by stax76 (previous) (diff)

comment:3 by Carl Eugen Hoyos, 4 years ago

The unavoidable question is now: What on earth is a manifest when discussing FFmpeg source code?

Please understand that -hide_banner makes every bug report invalid unless you want to report an issue with the option.

in reply to:  3 comment:4 by Marton Balint, 4 years ago

Replying to cehoyos:

The unavoidable question is now: What on earth is a manifest when discussing FFmpeg source code?

https://www.samlogic.net/articles/manifest.htm

So this ticket is about the inclusion of a long path aware manifest in ffmpeg.exe executable.

comment:5 by stax76, 4 years ago

I've looked at a ffmpeg build made by Patman (media-autobuild_suite based I think) using Resource Hacker and it contains a manifest without long path support enabled.

My question is where is this manifest added? I've searched the ffmpeg and media-autobuild_suite source code and didn't find any manifest file.

comment:6 by stax76, 4 years ago

Technical details from projects that have solved the issue:

https://github.com/staxrip/staxrip/issues/338

comment:8 by Carl Eugen Hoyos, 4 years ago

Component: undeterminedbuild system
Priority: normalwish
Type: defectenhancement
Version: unspecifiedgit-master

Apparently not as unrealistic as I thought.

comment:9 by Blacklands, 3 years ago

Any chance that this gets addressed?

From my understanding, the only thing that needs to change in the source code is that any hard-coded checks for the old maximum path length (260) are removed.
The MAX_LENGTH Windows macro always expands to 260, so that cannot be used, I believe.

Apart from that, only the manifest needs to be added during the build process, for Windows builds. (See e.g. here in the Microsoft docs: https://docs.microsoft.com/en-us/cpp/build/how-to-embed-a-manifest-inside-a-c-cpp-application)

comment:10 by Elad Karako, 3 years ago

f.y.i.
you should be able to seamlessly patch up most of exe/dll/ocx (etc..) by using mt.exe (available in visual studio build tools you probably already have) and a generic manifest file like this one:
https://github.com/eladkarako/manifest/blob/master/example_manifests/generic.manifest#L13

(you can add assemblyIdentity and description blocks if you want)

the commands are: (for exe use 1, for dll use 2, this is just an example, repeat as needed for any of your files).

mt.exe -nologo -manifest generic.manifest -outputresource:"ffmpeg.exe";1
mt.exe -nologo -manifest generic.manifest -outputresource:"avcodec-59.dll";2

it should properly write embed the manifest (resource 24) into the file (overwriting any existing one).

after you'll also apply a registry patch (one time):

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem]
"LongPathsEnabled"=dword:00000001

and reboot, you should be able to test it on your PC.

it should effect those functions (they would also ignore existing MAX_PATH value):
CopyFileW, CopyFile2, CopyFileExW, CreateFileW, CreateFile2, CreateHardLinkW, CreateSymbolicLinkW, DeleteFileW, FindFirstFileW, FindFirstFileExW, FindNextFileW, GetFileAttributesW, GetFileAttributesExW, SetFileAttributesW, GetFullPathNameW, GetLongPathNameW, MoveFileW, MoveFileExW, MoveFileWithProgressW, ReplaceFileW, SearchPathW, FindFirstFileNameW, FindNextFileNameW, FindFirstStreamW, FindNextStreamW, GetCompressedFileSizeW, GetFinalPathNameByHandleW.

no actual code change is needed.

https://docs.microsoft.com/en-gb/windows/win32/fileio/maximum-file-path-limitation?tabs=cmd#enable-long-paths-in-windows-10-version-1607-and-later

Last edited 3 years ago by Elad Karako (previous) (diff)

comment:12 by nil-admirari, 2 years ago

Resolution: fixed
Status: reopenedclosed
Note: See TracTickets for help on using tickets.