Skip to content

Instantly share code, notes, and snippets.

@cpuuntery
Last active June 1, 2021 20:05
Show Gist options
  • Save cpuuntery/52f1423d64657099f2659a8770d1fa24 to your computer and use it in GitHub Desktop.
Save cpuuntery/52f1423d64657099f2659a8770d1fa24 to your computer and use it in GitHub Desktop.
.\ffmpeg.exe -i [input file] -ss [start time] -to [end time] -c copy [output]
#This will detect the duration automatically for you. You just need to specify the start time. This is useful for removing the first 30 second for example. The filename is Regexed and the output is 1.ogg
Get-ChildItem | Where-Object {$_.Name -match “\[\d\d\].*ogg”} | ForEach-Object {.\ffmpeg.exe -i $_.Name -ss 0 -to ((.\ffprobe -v error -show_entries format=duration -of default=noprint_wrappers=1:nokey=1 $_.Name) -7) -c copy 1.ogg}
#The filename is Regexed and the output is 1.ogg. But you need to enter the end Time
Get-ChildItem | Where-Object {$_.Name -match “\[\d\d\].*ogg”} | ForEach-Object {.\ffmpeg.exe -i $_.Name -ss 0 -to 0 -c copy 1.ogg}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment