Skip to content
This repository has been archived by the owner on Sep 20, 2024. It is now read-only.

FFmpeg: Subprocess arguments as list #2032

Merged
merged 17 commits into from
Sep 17, 2021
Merged

Conversation

iLLiCiTiT
Copy link
Member

@iLLiCiTiT iLLiCiTiT commented Sep 16, 2021

Issue

Some versions of python (on unix) may not be able to parse subprocess arguments so they can know which part is executable and which parts are arguments. This is mainly issue of ffmpeg arguments where in most of cases use string as full command.

Goal

Pass arguments to subprocess.Popen as list instead of string.

Changes

  • list of arguments is used directly everywhere where we know all arguments of the subprocess command
  • added function split_command_to_list which should be able return list of arguments created from passed subprocess command
  • added function path_to_subprocess_arg which decides if path should be wrapped in quotes in subprocess arguments
    • using always quotes may break split_command_to_list which can't know if quotes are intended or not
  • use split_command_to_list where subprocess arguments may not be known (where use settings values etc.)
  • use path_to_subprocess_arg for all path arguments in subprocess commands where split_command_to_list is used

How to test

  • this should be heavily tested on windows and linux
  • ideally all modified plugins
  • use paths where spaces are used (ffmpeg path, input or output)

`"C:\\ffmpeg folder\\ffmpeg.exe" -i \"D:\\input.mp4\\" \"D:\\output.mp4\"`

Should result into list:
`["C:\ffmpeg folder\ffmpeg.exe", "-i", "D:\input.mp4", "D:\output.mp4"]`
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

invalid escape sequence '\i'
invalid escape sequence '\o'

@iLLiCiTiT iLLiCiTiT self-assigned this Sep 16, 2021
@iLLiCiTiT iLLiCiTiT added the type: bug Something isn't working label Sep 16, 2021
@iLLiCiTiT iLLiCiTiT merged commit 6167a20 into develop Sep 17, 2021
@mkolar mkolar deleted the bugfix/ffmpeg_args_on_linux branch September 17, 2021 22:13
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
type: bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants