Invoke-YTdlp

SYNOPSIS

Runs yt-dlp with PowerShell parameters

SYNTAX

Invoke-YTdlp [-Url] <String[]> [-ExecutablePath <String>] [-Format <String>] [-FormatSort <String>]
 [-MergeOutputFormat <String>] [-RemuxVideo <String>] [-ExtractAudio] [-AudioFormat <String>]
 [-AudioQuality <String>] [-OutputTemplate <String>] [-OutputPath <String>] [-ConcurrentFragments <Int32>]
 [-LimitRate <String>] [-Retries <Int32>] [-PlaylistItems <String>] [-NoOverwrites] [-ForceOverwrites]
 [-NoPlaylist] [-EmbedMetadata] [-EmbedThumbnail] [-EmbedChapters] [-EmbedSubtitles] [-WriteSubtitles]
 [-WriteAutoSubtitles] [-SubtitleLanguages <String[]>] [-WriteThumbnail] [-ConvertThumbnails <String>]
 [-CookiesFromBrowser <String>] [-CookiesFile <String>] [-DownloadArchive <String>] [-Proxy <String>]
 [-FfmpegLocation <String>] [-RestrictFilenames] [-WindowsFilenames] [-IgnoreErrors] [-Simulate] [-Quiet]
 [-NoProgress] [-AdditionalArguments <String[]>] [-PassThru] [-ProgressAction <ActionPreference>] [-WhatIf]
 [-Confirm] [<CommonParameters>]

DESCRIPTION

The Invoke-YTdlp function is the core wrapper around the yt-dlp command line tool. The most commonly used yt-dlp options are exposed as PowerShell parameters & any other option can be supplied with the -AdditionalArguments parameter.

  • Progress is written to the information stream, use -Quiet to hide it
  • Using -Verbose adds the yt-dlp –verbose option
  • A non-zero yt-dlp exit code throws an error
  • Relative paths are resolved against the current PowerShell location
  • URLs are always passed after [ – ] so a URL can never be treated as an option

The Save-YTdlpVideo & Save-YTdlpAudio functions use this function with pre-configured highest quality settings.

EXAMPLES

EXAMPLE 1

Invoke-YTdlp -Url 'https://www.youtube.com/watch?v=cE0wfjsybIQ' -Format 'bestvideo*+bestaudio/best' -MergeOutputFormat mkv

Downloads the best quality video & audio and merges them into a mkv file in the current directory

EXAMPLE 2

Invoke-YTdlp -Url 'https://www.youtube.com/watch?v=cE0wfjsybIQ' -ExtractAudio -AudioFormat mp3 -ConcurrentFragments 12 -NoOverwrites -EmbedMetadata -OutputTemplate '%(title)s.%(ext)s' -Verbose

Matches the yt-dlp command [ yt-dlp $Url -x –audio-format mp3 -N 12 -w -v –embed-metadata -o “%(title)s.%(ext)s” ]

EXAMPLE 3

Invoke-YTdlp -Url 'https://www.youtube.com/watch?v=cE0wfjsybIQ' -Simulate -AdditionalArguments '--print', 'title'

Prints the title of the video without downloading it

EXAMPLE 4

Invoke-YTdlp -Url 'https://www.youtube.com/watch?v=cE0wfjsybIQ' -Format 'bestaudio' -WhatIf

Shows the yt-dlp command line that would be run without running it

PARAMETERS

-Url

One or more URLs (or yt-dlp search strings such as ytsearch:) to process

Type: String[]
Parameter Sets: (All)
Aliases: Uri

Required: True
Position: 1
Default value: None
Accept pipeline input: True (ByPropertyName, ByValue)
Accept wildcard characters: False

-ExecutablePath

Defines an explicit path to the yt-dlp executable

Type: String
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-Format

Video format selection

Example: bestvideo*+bestaudio/best

Type: String
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-FormatSort

Sort order used to pick the best format

Example: res,fps,hdr,vcodec,acodec,br

Type: String
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-MergeOutputFormat

Container used when video & audio streams are merged

Allowed values: ‘avi’, ‘flv’, ‘mkv’, ‘mov’, ‘mp4’, ‘webm’

Type: String
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-RemuxVideo

Remux the video into another container if necessary

Example: mp4

Type: String
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-ExtractAudio

Convert the video to an audio only file

Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False

-AudioFormat

Audio format used when -ExtractAudio is set

Allowed values: ‘best’, ‘aac’, ‘alac’, ‘flac’, ‘m4a’, ‘mp3’, ‘opus’, ‘vorbis’, ‘wav’

Type: String
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-AudioQuality

Audio quality used when -ExtractAudio is set

A value from 0 (best) to 10 (worst) for variable bitrate, or a bitrate such as 128K

Type: String
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-OutputTemplate

The yt-dlp output filename template

Example: %(title)s.%(ext)s

Type: String
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-OutputPath

The directory files are saved to

Default value: The current PowerShell location

Type: String
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-ConcurrentFragments

The number of fragments of a DASH/HLS video to download concurrently

Type: Int32
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: 0
Accept pipeline input: False
Accept wildcard characters: False

-LimitRate

The maximum download rate in bytes per second

Example: 50K or 4.2M

Type: String
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-Retries

The number of retries

Type: Int32
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: 0
Accept pipeline input: False
Accept wildcard characters: False

-PlaylistItems

The playlist items to download

Example: 1:3,7,-5::2

Type: String
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-NoOverwrites

Do not overwrite files that already exist

Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False

-ForceOverwrites

Overwrite all video & metadata files

Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False

-NoPlaylist

Download only the video if the URL refers to a video & a playlist

Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False

-EmbedMetadata

Embed metadata & chapters in the file

Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False

-EmbedThumbnail

Embed the thumbnail in the file as cover art

Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False

-EmbedChapters

Add chapter markers to the file

Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False

-EmbedSubtitles

Embed subtitles in the file

Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False

-WriteSubtitles

Write subtitle files

Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False

-WriteAutoSubtitles

Write automatically generated subtitle files

Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False

-SubtitleLanguages

The subtitle languages to download

Example: en.*,ja

Type: String[]
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-WriteThumbnail

Write the thumbnail image to disk

Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False

-ConvertThumbnails

Convert the thumbnails to another format

Example: jpg

Type: String
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-CookiesFromBrowser

The browser to load cookies from

Example: firefox or chrome:Profile 1

Type: String
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-CookiesFile

A Netscape formatted cookies file

Type: String
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-DownloadArchive

A file used to record & skip videos that have already been downloaded

Type: String
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-Proxy

A HTTP, HTTPS, or SOCKS proxy URL

Type: String
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-FfmpegLocation

The location of the ffmpeg binary or its directory

Type: String
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-RestrictFilenames

Restrict filenames to only ASCII characters

Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False

-WindowsFilenames

Force filenames to be Windows compatible

Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False

-IgnoreErrors

Ignore download & post-processing errors

Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False

-Simulate

Do not download or write anything to disk

Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False

-Quiet

Hide yt-dlp progress & informational output

Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False

-NoProgress

Do not show the yt-dlp progress bar

Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False

-AdditionalArguments

Any additional raw yt-dlp command line arguments

Example: ‘–sponsorblock-remove’, ‘sponsor’

Type: String[]
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-PassThru

Returns a file object for every file that was saved

Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False

-WhatIf

Shows what would happen if the cmdlet runs. The cmdlet is not run.

Type: SwitchParameter
Parameter Sets: (All)
Aliases: wi

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-Confirm

Prompts you for confirmation before running the cmdlet.

Type: SwitchParameter
Parameter Sets: (All)
Aliases: cf

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-ProgressAction

Type: ActionPreference
Parameter Sets: (All)
Aliases: proga

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

INPUTS

System.String

OUTPUTS

System.IO.FileInfo

NOTES

Copyright 1990-2026 Celerium

NAME: Invoke-YTdlp Type: Public

AUTHOR:  David Schulte
DATE:    2025-11-11
EMAIL:   celerium@Celerium.org

TODO:

https://github.com/yt-dlp/yt-dlp#usage-and-options

https://github.com/Celerium/Celerium.YTdlp