Skip to content

Instantly share code, notes, and snippets.

@elico
Last active February 19, 2025 10:33
Show Gist options
  • Save elico/eb28eb567140f9c2adab9e73af881db3 to your computer and use it in GitHub Desktop.
Save elico/eb28eb567140f9c2adab9e73af881db3 to your computer and use it in GitHub Desktop.
$outDir = ".\out\"
$sourceDir = ".\in\"
$historyDir = ".\history\"
$workDir = ".\working\"
$imageFile = "michael.png"
$inputFormat = "mp3"
$outputFormat = "mp4"
mkdir "$sourceDir" -Force
mkdir "$outDir" -Force
mkdir "$historyDir" -Force
mkdir "$workDir" -Force
$inFiles = Get-Childitem $sourceDir -Filter "*.$inputFormat"
ForEach ($f in $inFiles) {
$newFilename = $f.Name.Replace(".mp3", ".mp4")
ffmpeg -i $f.FullName -loop 1 -i $imageFile -c:a copy -c:v libx264 -preset ultrafast -tune stillimage -shortest "$workDir$newFilename"
$f | Move-Item -Verbose -destination $historyDir
Move-Item -Verbose -Path "$workDir$newFilename" -destination $outDir
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment