Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upGitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
For --extract-audio, allow ffmpeg and ffprobe to exist in the working directory instead of just the path. #438
Comments
|
There's a reason why PATH doesn't contain Instead, your script should just modify PATH to include the directory where ffmpeg is located. In a shell script, that would look like:
Alternatively, we could also include an option like |
|
This is great to know, thank you. I'm unfortunately not too familiar with setting/changing the path, but wouldn't doing it like you said be a permanent system-wide change? Or is it temporary for the duration of the script? And do you know if it's reproducible on Windows? (I'm aiming for cross-platform compatibility.) |
|
No, the changed PATH only applies to that one invocation of youtube-dl (and its subprocesses). I don't know whether this exact syntax works in a Windows bat file. You can, however, change the environment variable for the duration of your script, like this (exact syntax may vary):
|
|
After a bit of tinkering, I got it to work. I set my environment like so before my script's execution: current_path = os.environ["PATH"] Unfortunately, on Windows, youtube-dl still does not find ffmpeg.exe/ffprobe.exe in the working directory by default. However, once I renamed ffmpeg.exe and ffprobe.exe to just ffmpeg and ffprobe, it worked perfectly. I think you might need to add a check for .exe files, since os.path.isfile(exe_file) and os.access(exe_file, os.X_OK) return False for just ffmpeg/ffprobe. (Or it's possible that I'm doing something horribly wrong.) |
|
Uh, you are right, opening an issue! |
I'm writing a script that depends on youtube-dl and its audio conversion feature, and I want to make it as portable and easy-to-use as possible. As a result, I don't want to require the user to install ffmpeg/ffprobe, only to copy them to the working directory. As far as I can tell, the only required change would be to add a check for the working directory to detect_executables, in addition to os.environ["PATH"]. As a test, I copy/pasted the required code into my script and made a similar change, and it seems to work perfectly.