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

Unhandled CalledProcessError when source file violates Windows file name length limits #16

Open
ghost opened this issue Dec 3, 2020 · 0 comments

Comments

@ghost
Copy link

ghost commented Dec 3, 2020

Per Microsoft's Maximum Path Length Limitation, the maximum length for a path is MAX_PATH, which is defined as 260 characters. It is possible for a source file or demuxed source file to exceed this length, which results in a CalledProcessError whenever we attempt to use this source file.

Example:

Include file '[deanzel] Tenchi Muyo! Ryo-Ohki - S01E02v2 (1448x1052 Hi10P BD Dual Audio FLAC)[49fafe63].mkv':
INFO: Retrieving source file stream/format data...
Select audio stream [0-1]: 1
INFO: Retrieving extracted audio/video stream/format data...
Traceback (most recent call last):
  File "C:\Python39\lib\runpy.py", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "C:\Python39\lib\runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "C:\Python39\lib\site-packages\batch_encoder\__main__.py", line 132, in <module>
    main()
  File "C:\Python39\lib\site-packages\batch_encoder\__main__.py", line 86, in main
    source_file = SourceFile.from_file(source_file_candidate, encoding_config)
  File "C:\Python39\lib\site-packages\batch_encoder\_source_file.py", line 48, in from_file
    video_format = subprocess.check_output(video_args).decode('utf-8')
  File "C:\Python39\lib\subprocess.py", line 420, in check_output
    return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
  File "C:\Python39\lib\subprocess.py", line 524, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['ffprobe', '-v', 'quiet', '-print_format', 'json', '-show_streams', '-show_format', '-show_chapters', '[Video][deanzel] Tenchi Muyo! Ryo-Ohki - S01E02v2 (1448x1052 Hi10P BD Dual Audio FLAC)[49fafe63].mkv']' returned non-zero exit status 1.

Note: When demuxing selected streams, we simply append the stream type to the original file name, which is what happened here.

Ideally we should more gracefully handle this case so that the end user knows the source of the failure, or circumvent it if possible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

0 participants