Last active
November 23, 2025 22:43
-
-
Save DarthJahus/e6b31a1a138ffd2d4628c3ee9a44a867 to your computer and use it in GitHub Desktop.
yt-dlp + transcode to AV1 (AMD)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| param( | |
| [string]$DownloadFolder = "F:\.temp\dl\Fillers", | |
| [string]$YTDL = "yt-dlp", | |
| [string]$Cookies = "A:\Secure\youtube.com_cookies.txt", | |
| [string]$DownloadArchive = ".\yt-dlp.list.txt", | |
| [int]$MinDuration = 0, | |
| [int]$MaxDuration = 0, | |
| [string[]]$Urls | |
| ) | |
| if (-not $Urls -or $Urls.Count -eq 0) { | |
| Write-Host "Erreur : aucune URL fournie." -ForegroundColor Red | |
| exit | |
| } | |
| if (-not (Test-Path $DownloadFolder)) { | |
| New-Item -ItemType Directory -Path $DownloadFolder | Out-Null | |
| } | |
| # Construction du filtre durée | |
| $durationFilter = @() | |
| if ($MinDuration -gt 0 -and $MaxDuration -gt 0) { | |
| $durationFilter = @("--match-filter", "duration >= $MinDuration & duration <= $MaxDuration") | |
| } elseif ($MinDuration -gt 0) { | |
| $durationFilter = @("--match-filter", "duration >= $MinDuration") | |
| } elseif ($MaxDuration -gt 0) { | |
| $durationFilter = @("--match-filter", "duration <= $MaxDuration") | |
| } | |
| # Construction de la commande yt-dlp sous forme de tableau | |
| $ytArgs = @( | |
| "--cookies", $Cookies, | |
| "--download-archive", $DownloadArchive, | |
| "--limit-rate", "1048576", | |
| "--embed-subs", "--sub-langs", "fr.*,en.*", | |
| "--embed-metadata", | |
| "--sponsorblock-remove", "sponsor,interaction,selfpromo", | |
| "--sponsorblock-chapter-title", "SB: %%(category_names)l", | |
| "--recode-video", "mkv", | |
| "--postprocessor-args", "FFmpeg:-map 0:v:0 -map 0:a -map 0:s? -c:v av1_amf -usage transcoding -quality quality -pix_fmt yuv420p -c:a aac -b:a 128k", | |
| "--no-keep-video", | |
| "-o", "$DownloadFolder\%(upload_date)s - %(title)s (%(uploader)s) [%(id)s].mkv" | |
| ) + $durationFilter + $Urls | |
| # Exécution | |
| & $YTDL @ytArgs |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment