Skip to content

Instantly share code, notes, and snippets.

@fluttr
Created April 26, 2018 09:51
Show Gist options
  • Save fluttr/5dac2bf6e1156279c3293404e9421056 to your computer and use it in GitHub Desktop.
Save fluttr/5dac2bf6e1156279c3293404e9421056 to your computer and use it in GitHub Desktop.
Example of reencoding video using nvenc with metadata removal
# converts all files specified in FileGlob using ffmpeg and nvenc
function ConvertWith-Nvenc(parameter(mandatory=$true)[string]$FileGlob){ # FileGlob can contain path and wildcards
$OutputDir = "$(Split-Path -Parent "$FileGlob")\out"
mkdir "$OutputDir"
foreach($vid in (gi "$FileGlob")){
echo "converting $vid..."
ffmpeg -i "$($vid.name)" -c:v h264_nvenc -preset slow `
-ac 2 -c:a aac -strict -2 -b:a 128k `
-map_metadata -1 `
"$OutputDir\$($vid.name)"
}
}
ConvertWith-Nvenc "c:\some_path\*.mp4"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment