Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extract frames from videos in mounted paths longer than 256 chars on Windows #1809

Closed
lfcnassif opened this issue Aug 11, 2023 · 13 comments · Fixed by #1810
Closed

Extract frames from videos in mounted paths longer than 256 chars on Windows #1809

lfcnassif opened this issue Aug 11, 2023 · 13 comments · Fixed by #1810
Assignees

Comments

@lfcnassif
Copy link
Member

lfcnassif commented Aug 11, 2023

Just tried to process an iCloud backup in a network share and I noticed no video thumbs were generated, although the videos play fine if double clicked from IPED UI and are show fine into HexViewer. Additionally, thumbs of image files were generated fine, including external ones like SVG which uses imagemagick external conversion. So I think the long paths, longer than 256 chars, perhaps are not a problem, because files can be read. But maybe they are an issue for mplayer or there is a possible issue with the mplayer command line, not sure...

@lfcnassif
Copy link
Member Author

The cause is the long path indeed. Just processed 2 videos in a local long path without special chars. The one with 256 chars in the full path had video thumbs created, while the one with 257 chars in the path had not.

@lfcnassif lfcnassif changed the title VideoThumbTask not working on videos with long paths on mounted network share VideoThumbTask not working on videos with paths longer than 256 chars on Windows Aug 11, 2023
@lfcnassif
Copy link
Member Author

lfcnassif commented Aug 11, 2023

I know NTFS has a max path length, but not sure why java (HashTask, ParsingTask, HexViewer...) and imagemagick are able to read the files while mplayer isn't...

@lfcnassif
Copy link
Member Author

Mplayer verbose output on the 2 videos:

CMD = CMD = E:\git\iped\target\release\iped-4.1.4/tools/mplayer/mplayer.exe -demuxer lavf -nosound -noautosub -noconsolecontrols -vo null -ao null -frames 0 -identify N:\long_path\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\ccccccc_.mp4 E:\git\iped\target\release\iped-4.1.4/tools/mplayer/mplayer.exe -demuxer lavf -nosound -noautosub -noconsolecontrols -vo null -ao null -frames 0 -identify N:\long_path\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\ccccccc.mp4 

TIMEOUT = 300000
TIMEOUT = 300000
MPlayer Redxii-SVN-r38109-6.2.0 (i686) (C) 2000-2018 MPlayer Team
Using FFmpeg N-91255-g7b80df677a (2018-06-09 12:36:24 +0530)
Compiled on 2018-06-10 04:01:36 EDT (rev. 1)
Filename is too long, can not load file or directory specific config files

Playing N:\long_path\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\ccccccc.mp4.
libavformat version 58.17.100 (internal)
libavformat file format detected.
[mov,mp4,m4a,3gp,3g2,mj2 @ 01d5c6e0]Protocol name not provided, cannot determine if input is local or a network protocol, buffers and access patterns cannot be configured optimally without knowing the protocol
ID_VIDEO_ID=0
[lavf] stream 0: video (h264), -vid 0
ID_AUDIO_ID=0
[lavf] stream 1: audio (aac), -aid 0, -alang und
VIDEO:  [H264]  640x352  24bpp  30.000 fps  2054.6 kbps (250.8 kbyte/s)
==========================================================================
Opening video decoder: [ffmpeg] FFmpeg's libavcodec codec family
libavcodec version 58.20.100 (internal)
Selected video codec: [ffh264] vfm: ffmpeg (FFmpeg H.264)
==========================================================================
ID_VIDEO_CODEC=ffh264
Clip info:
 major_brand: mp42
ID_CLIP_INFO_NAME0=major_brand
ID_CLIP_INFO_VALUE0=mp42
 minor_version: 0
ID_CLIP_INFO_NAME1=minor_version
ID_CLIP_INFO_VALUE1=0
 compatible_brands: mp42isom
ID_CLIP_INFO_NAME2=compatible_brands
ID_CLIP_INFO_VALUE2=mp42isom
ID_CLIP_INFO_N=3
ID_FILENAME=N:\long_path\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\ccccccc.mp4
ID_DEMUXER=lavf
ID_VIDEO_FORMAT=H264
ID_VIDEO_BITRATE=2054616
ID_VIDEO_WIDTH=640
ID_VIDEO_HEIGHT=352
ID_VIDEO_FPS=30.000
ID_VIDEO_ASPECT=0.0000
ID_START_TIME=0.00
ID_LENGTH=4.37
ID_SEEKABLE=1
ID_CHAPTERS=0
Audio: no sound
Starting playback...


Exiting... (End of file)
ID_EXIT=EOF
MPlayer Redxii-SVN-r38109-6.2.0 (i686) (C) 2000-2018 MPlayer Team
Using FFmpeg N-91255-g7b80df677a (2018-06-09 12:36:24 +0530)
Compiled on 2018-06-10 04:01:36 EDT (rev. 1)
Filename is too long, can not load file or directory specific config files

Playing N:\long_path\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\ccccccc_.mp4.
File not found: 'N:\long_path\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\ccccccc_.mp4'
Failed to open N:\long_path\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\ccccccc_.mp4.


Exiting... (End of file)
ID_EXIT=EOF
DURATION: 4370
CMD = E:\git\iped\target\release\iped-4.1.4/tools/mplayer/mplayer.exe -demuxer lavf -speed 100 -dr -nosound -noconsolecontrols -noautosub -noaspect -sws 1 -lavdopts wait_keyframe -vo jpeg:smooth=50:nobaseline:quality=50 -ao null -frames 21 N:\long_path\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\ccccccc.mp4 -vf framestep=5,scale=256:141 
TIMEOUT = 45000
CMD = cmd /c dir /x N:\long_path\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\ccccccc_.mp4 
TIMEOUT = 1000
MPlayer Redxii-SVN-r38109-6.2.0 (i686) (C) 2000-2018 MPlayer Team
Using FFmpeg N-91255-g7b80df677a (2018-06-09 12:36:24 +0530)
Compiled on 2018-06-10 04:01:36 EDT (rev. 1)
Filename is too long, can not load file or directory specific config files

Playing N:\long_path\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\ccccccc.mp4.
libavformat version 58.17.100 (internal)
libavformat file format detected.
[mov,mp4,m4a,3gp,3g2,mj2 @ 01d5c6e0]Protocol name not provided, cannot determine if input is local or a network protocol, buffers and access patterns cannot be configured optimally without knowing the protocol
[lavf] stream 0: video (h264), -vid 0
[lavf] stream 1: audio (aac), -aid 0, -alang und
VIDEO:  [H264]  640x352  24bpp  30.000 fps  2054.6 kbps (250.8 kbyte/s)
jpeg: Progressive JPEG disabled.
jpeg: Baseline JPEG disabled.
Opening video filter: [scale w=256 h=141]
Opening video filter: [framestep=5]
==========================================================================
Opening video decoder: [ffmpeg] FFmpeg's libavcodec codec family
libavcodec version 58.20.100 (internal)
Selected video codec: [ffh264] vfm: ffmpeg (FFmpeg H.264)
==========================================================================
Clip info:
 major_brand: mp42
 minor_version: 0
 compatible_brands: mp42isom
Audio: no sound
Starting playback...
Movie-Aspect is undefined - no prescaling applied.
[swscaler @ 01fccf20]bilinear scaler, from yuv420p to rgb24 using MMXEXT
VO: [jpeg] 256x141 => 256x141 RGB 24-bit 
jpeg: output directory: .
V:   0.0   0/  0 ??% ??% ??,?% 0 0 100.00x                                     
V:   0.2   0/  0 ??% ??% ??,?% 0 0 100.00x                                     
V:   0.3   0/  0 ??% ??% ??,?% 0 0 100.00x                                     
V:   0.5   0/  0 ??% ??% ??,?% 0 0 100.00x                                     
V:   0.7   0/  0 765% 225%  0.0% 0 0 100.00x                                   
V:   0.8   0/  0 720% 216%  0.0% 0 0 100.00x                                   
V:   1.0   0/  0 690% 210%  0.0% 0 0 100.00x                                   
V:   1.2   0/  0 660% 205%  0.0% 0 0 100.00x                                   
V:   1.3   0/  0 645% 202%  0.0% 0 0 100.00x                                   
V:   1.5   0/  0 640% 193%  0.0% 0 0 100.00x                                   
V:   1.7   0/  0 624% 192%  0.0% 0 0 100.00x                                   
 Volume in drive N is NVME
 Volume Serial Number is 0C51-572E

 Directory of N:\long_path\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa

19/09/2022  19:00         2.967.754              ccccccc_.mp4
               1 File(s)      2.967.754 bytes
               0 Dir(s)  277.313.835.008 bytes free
CMD = E:\git\iped\target\release\iped-4.1.4/tools/mplayer/mplayer.exe -nosound -noautosub -noconsolecontrols -vo null -ao null -frames 0 -identify N:\long_path\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\ccccccc_.mp4 
TIMEOUT = 15000
V:   1.8   0/  0 616% 190%  0.0% 0 0 100.00x                                   
V:   2.0   0/  0 600% 190%  0.0% 0 0 100.00x                                   
V:   2.2   0/  0 590% 189%  0.0% 0 0 100.00x                                   
V:   2.3   0/  0 582% 188%  0.0% 0 0 100.00x                                   
V:   2.5   0/  0 572% 188%  0.0% 0 0 100.00x                                   
V:   2.7   0/  0 566% 187%  0.0% 0 0 100.00x                                   
V:   2.8   0/  0 561% 187%  0.0% 0 0 100.00x                                   
V:   3.0   0/  0 563% 183%  0.0% 0 0 100.00x                                   
V:   3.2   0/  0 559% 186%  0.0% 0 0 100.00x                                   
V:   3.3   0/  0 558% 186%  0.0% 0 0 100.00x                                   



Exiting... (End of file)
MPlayer Redxii-SVN-r38109-6.2.0 (i686) (C) 2000-2018 MPlayer Team
Using FFmpeg N-91255-g7b80df677a (2018-06-09 12:36:24 +0530)
Compiled on 2018-06-10 04:01:36 EDT (rev. 1)
Filename is too long, can not load file or directory specific config files

Playing N:\long_path\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\ccccccc_.mp4.
File not found: 'N:\long_path\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\ccccccc_.mp4'
Failed to open N:\long_path\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\ccccccc_.mp4.


Exiting... (End of file)
ID_EXIT=EOF

@lfcnassif
Copy link
Member Author

lfcnassif commented Aug 11, 2023

I'll try the same workaround used on #1170 to pass the paths to mplayer.

@wladimirleite
Copy link
Member

Just tested here and got the same error.
I tried using a more recent MPlayer build for Windows, but still got the same issue.

@wladimirleite
Copy link
Member

wladimirleite commented Aug 11, 2023

Looking at MPlayer code, there are a few places that check the path length against a constant maximum value, and then show the message we are getting:

#define MSGTR_FilenameTooLong "Filename is too long, can not load file or directory specific config files\n"

(...)

if (strlen(file) > PATH_MAX - 14) {
        mp_msg(MSGT_CPLAYER, MSGL_WARN, MSGTR_FilenameTooLong);
        return;
}

The problem is that PATH_MAX is platform dependent, defined in limits.h.
So the builds we are using probably had PATH_MAX set to 256 in their compiling environment.

EDIT: It seems FFmpeg also have this message, and similar checks.

@lfcnassif
Copy link
Member Author

I see... It didn't work for me too. If some day mplayer removes this MAX_PATH check we would need to reference the file path like this:
"\\\"\\\\?\\" + file.getAbsolutePath() + "\\\""

when passing the path to java ProcessBuilder because, on Windows, it messes up the quotes (or back slashes), if I remember from #1170.

@lfcnassif
Copy link
Member Author

So, I'm closing this as won't fix for now...

@lfcnassif lfcnassif added wontfix dependencies Pull requests that update a dependency file labels Aug 11, 2023
@wladimirleite
Copy link
Member

A possible (non-ideal) workaround would be copying the file in IPED's Temp folder (if full path has more than 256 chars) and then passing it to MPlayer, but I am not sure if it is worth the effort, as this is not a usual scenario.

@lfcnassif
Copy link
Member Author

Just as example for reference, here is the command used on #1170 before replacing it for a File.delete():
e34fd76#diff-79d4ed92eea446976d402f9b392b0886ed92cf220b969d02b04adb39d67e9418R278

@lfcnassif
Copy link
Member Author

lfcnassif commented Aug 11, 2023

A possible (non-ideal) workaround would be copying the file in IPED's Temp folder (if full path has more than 256 chars) and then passing it to MPlayer, but I am not sure if it is worth the effort, as this is not a usual scenario.

Hum, this should work... I'll give it a try!

@lfcnassif
Copy link
Member Author

As expected, it worked! Thanks @tc-wleite for the suggestion! I think it is worth, since the change is simple and many users use IPED to process cloud warrant returns, where those long paths are pretty common. So I'll reopen and send a PR, if you could take a quick look at the code changes in VideoThumbsMaker, I would appreciate, no need for testing!

@lfcnassif
Copy link
Member Author

I'm re-tagging this as enhancement since I didn't expect any module to work on file paths longer than 256 chars and because this is a clear restriction of mplayer, not a dependency bug.

@lfcnassif lfcnassif added enhancement and removed bug dependencies Pull requests that update a dependency file labels Aug 12, 2023
@lfcnassif lfcnassif changed the title VideoThumbTask not working on videos with paths longer than 256 chars on Windows Make VideoThumbTask work on videos with paths longer than 256 chars on Windows Aug 12, 2023
@lfcnassif lfcnassif changed the title Make VideoThumbTask work on videos with paths longer than 256 chars on Windows Make VideoThumbTask work on videos with mounted paths longer than 256 chars on Windows Aug 12, 2023
@lfcnassif lfcnassif changed the title Make VideoThumbTask work on videos with mounted paths longer than 256 chars on Windows Make VideoThumbTask work on videos in mounted paths longer than 256 chars on Windows Aug 12, 2023
@lfcnassif lfcnassif changed the title Make VideoThumbTask work on videos in mounted paths longer than 256 chars on Windows Extract frames from videos in mounted paths longer than 256 chars on Windows Aug 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants