Skip to content

Commit f04444c

Browse files
committed
fix: audio was not always downloaded with video
1 parent f50815d commit f04444c

1 file changed

Lines changed: 5 additions & 6 deletions

File tree

powershell/yt-download.ps1

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,12 @@ New-Variable -Name UI_Path -Value "D:/Programmes/Internet/youtube-dl/YDL-UI_Port
4242
New-Variable -Name myCookies -Value "D:\OneDrive\Backup\Internet\youtube-dl\cookies.txt" -Option Constant
4343

4444
New-Variable -Name directory -Value (Join-Path -Path "$downloadsPath" -ChildPath "$DownloadFolderName") -Option Constant
45-
New-Variable -Name format -Value "bestvideo[vcodec^=avc1]+bestaudio[ext=m4a]/best" -Option Constant
4645
New-Variable -Name templateNameChannel -Value "%(uploader|)s%(uploader& - )s%(title).70s.%(ext)s" -Option Constant
4746
New-Variable -Name templateNameTitle -Value "%(title).70s.%(ext)s" -Option Constant
4847
# if useTitle is true then use $templateNameTitle else $templateNameChannel
4948
New-Variable -Name useTitle -Value $true -Option Constant
5049
# defaut quality for video (make it compatible to upload on 𝕏)
51-
New-Variable -Name videoQuality -Value "bestvideo*[vcodec^=avc1]+bestaudio*[acodec^=mp4a]/bestvideo*+bestaudio*/best"
50+
New-Variable -Name videoQuality -Value "bestvideo*[vcodec^=avc1]+bestaudio[acodec^=mp4a]/bestvideo*+bestaudio/best"
5251
# Videos will use this container
5352
New-Variable -Name videoContainer -Value "mp4" -Option Constant
5453
# set URLs for which the script will detect as audio
@@ -384,15 +383,15 @@ if ($url -and -not $install -and -not $uninstall) {
384383
"--audio-format", "mp3",
385384
"--audio-quality", "0",
386385
"-o", "$output",
387-
"-f", "bestaudio[ext=mp3]/bestaudio*/bestvideo*+bestaudio*",
386+
"-f", "bestaudio[ext=mp3]/bestaudio/bestvideo*+bestaudio",
388387
$DL_URL
389388
)
390389
}
391390
else {
392391
$global:options = @(
393392
"--extract-audio",
394393
"-o", "$output",
395-
"-f", "bestaudio*[ext=$QUALITY]/bestaudio*/bestvideo*+bestaudio*",
394+
"-f", "bestaudio*[ext=$QUALITY]/bestaudio/bestvideo*+bestaudio",
396395
$DL_URL
397396
)
398397
}
@@ -402,10 +401,10 @@ if ($url -and -not $install -and -not $uninstall) {
402401

403402
if ($QUALITY) {
404403
if ($QUALITY -ieq "best") {
405-
$videoQuality = "bestvideo*+bestaudio*/best"
404+
$videoQuality = "bestvideo*+bestaudio/best"
406405
}
407406
else {
408-
$videoQuality = "bestvideo*[vcodec^=avc1][height<=$QUALITY]+bestaudio*[acodec=mp4a]/bestvideo*[height<=$QUALITY]+bestaudio*/best"
407+
$videoQuality = "bestvideo*[vcodec^=avc1][height<=$QUALITY]+bestaudio[acodec=mp4a]/bestvideo*[height<=$QUALITY]+bestaudio/best"
409408
}
410409
}
411410
$global:options = @(

0 commit comments

Comments
 (0)