Skip to content

Instantly share code, notes, and snippets.

@TakamiChie
Created November 4, 2022 09:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save TakamiChie/04e93c5b9b086fe65b47885eb39d502f to your computer and use it in GitHub Desktop.
Save TakamiChie/04e93c5b9b086fe65b47885eb39d502f to your computer and use it in GitHub Desktop.
動画の再生速度を変更する
# 動画の再生速度を変更する。 ex). movspeed file.mp4 2 -> file.mp4を2倍速再生にしたoutfile.mp4というファイルが出力される
# ffmpegのインストールが必要
# ref: http://tecsingularity.com/ffmpeg/speedchange/
#
# $infile 処理対象となる動画ファイル
# $speed 速度変更させる値。2倍速にしたい場合2
# $outfile 出力するファイル。省略時は入力ファイルと同じフォルダにoutfile.mp4という名前で出力される
function movspeed (
[parameter(mandatory=$true)][String] $infile,
[parameter(mandatory=$true)][float] $speed,
[parameter(mandatory=$false)][String] $outfile=""
) {
if($outfile -eq ""){ $outfile = (Split-Path $infile -Parent) + "\outfile.mp4" }
ffmpeg -i ""${infile}"" -vf setpts=PTS/${speed} -af atempo=${speed} ${outfile}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment