# Get-VideoAudio.ps1 Extracts audio in either WAV or MP3 format from a video file. ## Parameters - **`-Video`** (required): Path to input video file (absolute or relative) - **`-Output`** (optional): Path to output audio file (defaults to video filename with `.wav` or `.mp3` extension) - **`-MP3`**: Extract audio as MP3 at 320 kbps instead of WAV ## Examples **Extract audio as WAV (default):** ```powershell .\Get-VideoAudio.ps1 -Video video.mp4 # Creates video.wav in the same directory ``` **Extract audio as MP3:** ```powershell .\Get-VideoAudio.ps1 -Video video.mp4 -MP3 # Creates video.mp3 in the same directory ``` **Specify custom output path:** ```powershell .\Get-VideoAudio.ps1 -Video video.mp4 -Output audio\soundtrack.wav ``` **Extract MP3 with custom output:** ```powershell .\Get-VideoAudio.ps1 -Video video.mp4 -Output music.mp3 -MP3 ``` **Using absolute paths:** ```powershell .\Get-VideoAudio.ps1 -Video "C:\Videos\movie.mp4" -Output "D:\Audio\soundtrack.mp3" -MP3 ``` **Using relative paths:** ```powershell .\Get-VideoAudio.ps1 -Video ..\videos\clip.mp4 -Output .\audio\clip.wav ``` ## Behavior - If the video file has no audio stream, the script displays a message and exits without creating an output file - WAV format uses PCM 16-bit encoding (lossless) - MP3 format uses 320 kbps bitrate (highest quality) - If output file already exists, it will be overwritten ## Safe Execution This script supports `-WhatIf` and `-Confirm` for safe execution: - **`-WhatIf`**: Simulate the operation without actually creating files. Shows what would be done. - **`-Confirm`**: Prompt for confirmation before extracting audio. **Simulate without making changes:** ```powershell .\Get-VideoAudio.ps1 -Video video.mp4 -MP3 -WhatIf ``` **Prompt before extracting:** ```powershell .\Get-VideoAudio.ps1 -Video video.mp4 -Output soundtrack.wav -Confirm ``` ## Notes Requires `ffmpeg` and `ffprobe` to be installed and available in the system PATH.