shaka-project / shaka-packager

A media packaging and development framework for VOD and Live DASH and HLS applications, supporting Common Encryption for Widevine and other DRM Systems.
https://shaka-project.github.io/shaka-packager/
Other
1.9k stars 496 forks source link

Error when using long path in input/output (Windows) #1397

Closed vitalygashkov closed 1 month ago

vitalygashkov commented 1 month ago

System info

Operating System: Windows 11 Shaka Packager Version: 3.1.0

Issue and steps to reproduce the problem

On Windows, when using long path in file paths for input/output, an error occurs.

Packager Command:

C:\packager-win-x64.exe "input=C:\Users\me\Downloads\...\enc.mp4,stream=video,output=C:\Users\me\Downloads\...\dec.mp4" --enable_raw_key_decryption --keys "key_id=ce513f999fbd46919b585e335b81bb77:key=af5683f35bf95bd648d45c0b3dc8e0ca"

What is the expected result?

Decryption should complete successfully even if there is Cyrillic in the file path.

What happens instead?

I0505 12:13:24.213364   22540 demuxer.cc:94] Demuxer::Run() on file 'C:\Users\me\Downloads\...\enc.mp4'.
I0505 12:13:24.217739   22540 demuxer.cc:160] Initialize Demuxer for file 'C:\Users\me\Downloads\...\enc.mp4'.
E0505 12:13:24.229908    5708 packager_main.cc:628] Packaging Error: 5 (FILE_FAILURE): Cannot open file for reading C:\Users\me\Downloads\...\enc.mp4
joeyparrish commented 1 month ago

Is the command line in UTF8, or some other encoding?

vitalygashkov commented 1 month ago

Is the command line in UTF8, or some other encoding?

As I understand it, it's in UTF-8:

PS C:\Users\vitalygashkov> chcp
Active code page: 65001
joeyparrish commented 1 month ago

Okay, thanks. I believe that's the assumption we make when taking command-line inputs on all platforms. Though IIRC, there is a special wide-character main() for Windows that differs from Linux & Mac.

vitalygashkov commented 1 month ago

Okay, thanks. I believe that's the assumption we make when taking command-line inputs on all platforms. Though IIRC, there is a special wide-character main() for Windows that differs from Linux & Mac.

I apologize, I misidentified the cause of the error. In the end, it turned out that the path was too long. Windows seems to have trouble with file paths longer than 255 characters.

To fix the error, I had to add a prefix to the path: \\?\C:\Users\...