yt-dlp: fully PowerShell-powered command to download a VIDEO [such as YouTube, etc] by an URL [that has been copied by a user and resides] in the clipboard into the Downloads location.
usercmd.ini:
Code: Select all
[em_yt-dlp_clip]
cmd=Powershell -ExecutionPolicy Bypass; si -path env:path -value $env:path';'$env:commander_path\plugins\app\Get';'$env:OneDrive\Media\FFmpeg\bin\ytdlp;
param=start yt-dlp.exe """$(Get-Clipboard) -P $((New-Object -ComObject Shell.Application).NameSpace('shell:Downloads').Self.Path) -i""" -NoNewWindow -Wait #;pause
Explanations:
- uncomment [#;pause] part to see what's going on for a bit longer if needed.
- the part [si -path env:path -value $env:path';'$env:commander_path\plugins\app\Get';'$env:OneDrive\Media\FFmpeg\bin\ytdlp] adds paths to yt-dlp and ffmpeg binaries to the %PATH% environment variable for the command session; where:
[si] - alias of the Set-Item cmdlet.
[$env:path] - the %PATH% environment variable.
[';'] - the required separator between %PATH% environment variable elements.
[';'$env:commander_path\plugins\app\Get] - string adds path to the yt-dlp binary to the %PATH% environment variable.
[';'$env:OneDrive\Media\FFmpeg\bin\ytdlp] - string adds path to the ffmpeg binaries to the %PATH% environment variable.
If you keep both binaries in one place, e.g., in [';'$env:commander_path\plugins\app\Get], you can remove the part that is no longer needed, e.g., putting si part as follows [si -path env:path -value $env:path';'$env:commander_path\plugins\app\Get], respecting the [';'] %PATH% separators.
In my example paths to the binaries contain %commander_path% and %OneDrive% environment variables.
An example of a literal path might be something like this: [';'d:\something\ytdlp\bin].
In case there're spaces in the paths, [' '] would help, alike [';'d:\something' 'with' 'spaces\ytdlp\bin].
Please, consider that syntax when you would type there your own paths.
So, you have two options to involve ffmpeg in work based on the use of the %PATH% variable approach:
- keep ffmpeg binaries [ffmpeg.exe, ffplay.exe, ffprobe.exe] together with yt-dlp [yt-dlp.exe] and add the common binary path to the %PATH%.
- keep ffmpeg binaries and yt-dlp separately and add both yt-dlp and ffmpeg binaries paths to the %PATH%.
There's also the [--ffmpeg-location] parameter for the yt-dlp.exe (that allows to use ffmpeg beyond the above approach, but I won't detail it here) .
To not involve ffmpeg in work don't do the above: don't put ffmpeg binaries together with yt-dlp.exe; don't add separate ffmpeg path to the %PATH% environment variable; don't use [--ffmpeg-location] parameter.
yt-dlp.exe with ffmpeg vs
yt-dlp.exe without ffmpeg, whats the difference.
My simple test results of downloading 2:23 music video from YouTube:
- some_test_music_video.mp4, file size [ 12.7MB] # without involving ffmpeg;
- some_test_music_video.webm, file size [296.7MB] # with ffmpeg plugged in.
Edit
Another example of
yt-dlp.exe with ffmpeg vs
yt-dlp.exe without ffmpeg
Trying to download a video from reddit (
e.g. ), I'm getting:
- an mp4 video file with sound [of 12.6MB] # with ffmpeg plugged in
- an mp4 video file without sound plus a separate m4a file with sound [of the same summary size] # without involving ffmpeg