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
This is frequently requested by staxrip users.
https://github.com/staxrip/staxrip/issues/226#issuecomment-687586840
Change History (12)
comment:1 by , 4 years ago
Component: | ffmpeg → undetermined |
---|---|
Keywords: | Win10 removed |
Resolution: | → needs_more_info |
Status: | new → closed |
Type: | enhancement → defect |
comment:2 by , 4 years ago
Resolution: | needs_more_info |
---|---|
Status: | closed → reopened |
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
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)
follow-up: 4 comment:3 by , 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.
comment:4 by , 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 , 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:7 by , 4 years ago
comment:8 by , 4 years ago
Component: | undetermined → build system |
---|---|
Priority: | normal → wish |
Type: | defect → enhancement |
Version: | unspecified → git-master |
Apparently not as unrealistic as I thought.
comment:9 by , 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 , 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.
comment:11 by , 2 years ago
Analyzed by developer: | set |
---|---|
Reproduced by developer: | set |
Code changes are actually required: FFmpeg uses MAX_PATH-sized buffers. Necessary patches were submitted to the mailing list:
https://ffmpeg.org/pipermail/ffmpeg-devel/2022-April/295391.html
https://ffmpeg.org/pipermail/ffmpeg-devel/2022-April/295388.html
https://ffmpeg.org/pipermail/ffmpeg-devel/2022-April/295389.html
https://ffmpeg.org/pipermail/ffmpeg-devel/2022-April/295390.html
https://ffmpeg.org/pipermail/ffmpeg-devel/2022-April/295387.html
https://ffmpeg.org/pipermail/ffmpeg-devel/2022-April/295392.html
Binaries with these patches applied can be found at https://github.com/yt-dlp/FFmpeg-Builds/releases.
comment:12 by , 2 years ago
Resolution: | → fixed |
---|---|
Status: | reopened → closed |
Fixed by the following commits:
https://github.com/FFmpeg/FFmpeg/commit/3fb924464244bc317a5d19ab25625ae35abde512
https://github.com/FFmpeg/FFmpeg/commit/4cdc14aa955805931b918d30d9c7349ab924dd52
https://github.com/FFmpeg/FFmpeg/commit/6076dbcb55d0c9b6693d1acad12a63f7268301aa
https://github.com/FFmpeg/FFmpeg/commit/f579a1d08b269b6dfc89596af20582c01950adb2
https://github.com/FFmpeg/FFmpeg/commit/6b32ad59c8fe16fc792ca5a468b95ce5232ff6d1
https://github.com/FFmpeg/FFmpeg/commit/c5aba39a041fdaac267fc8c6a2ef745a94a2b0da
https://github.com/FFmpeg/FFmpeg/commit/bc8f1bbe233b435dc474df272dac0b5b6d0ef536
https://github.com/FFmpeg/FFmpeg/commit/5d5a01419928d0c00bae54f730eede150cd5b268
https://github.com/FFmpeg/FFmpeg/commit/3b3c567ad3d45a3f5d90668a1dd32f11b89fc4b5
https://github.com/FFmpeg/FFmpeg/commit/fee765c2078ba03e346e311c86a447a116fe8c5f
https://github.com/FFmpeg/FFmpeg/commit/cc5844da988fb7ca1051775a3dac43de77bf3881
https://github.com/FFmpeg/FFmpeg/commit/dfa062ed3cae1d7ae3fdc52c7adda09cfc2e29b9
https://github.com/FFmpeg/FFmpeg/commit/13350e81fd43cbd1aa3bbb7ed567e7dc7dd2b7f5
https://github.com/FFmpeg/FFmpeg/commit/c381f5412fe810bd8118123aed9bd4f76b75b59d
https://github.com/FFmpeg/FFmpeg/commit/69364a06c65d3437e8158cdffd98c2f6d1b84dd2
Implemented with \\?\
prefixes, not with a manifest; therefore should work on Windows versions older than Windows 10 version 1607.
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.