Created
November 4, 2022 09:13
-
-
Save TakamiChie/04e93c5b9b086fe65b47885eb39d502f to your computer and use it in GitHub Desktop.
動画の再生速度を変更する
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 動画の再生速度を変更する。 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