Question Details

No question body available.

Tags

python file-conversion handbrakecli

Answers (1)

February 22, 2026 Score: 3 Rep: 1,165 Quality: Low Completeness: 70%

Your issue is caused by how you're passing the -i and -o arguments to subprocess.run().

Right now you're doing this:

f"-i {path}/{file}",
f"-o {path}/{makenewname(file)}"

This passes -i /path/to/file.mkv as one single argument, but HandBrakeCLI expects:

-i
/path/to/file.mkv

as two separate arguments.

When passed incorrectly, HandBrake receives a malformed input path (with leading space), which is why it logs:

hbstreamopen: open  /path/to/my/videos/S00E00.mkv failed
scan: unrecognized file type

Notice the extra space before /path/....

Check this your old and Updated code, I hope is will help you.