Last active
May 26, 2019 06:40
-
-
Save CannoHarito/bde373d0fdbc49dc0a75ff84b2cd0d9a to your computer and use it in GitHub Desktop.
関数や変数を定義したpowershellコンソールを開くバッチファイル。ffmpeg用の関数。
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
@powershell/noe /c '#'+(gc \"%~f0\"-ra)^|iex&exit/b | |
#この行以降は同一スコープのpowershellスクリプトとなります。日本語入ったのでANSIで保存して。 | |
if (!(Get-Command ffmpeg 2>$null)) { | |
Write-Error "ffmpeg.exe could not be found." | |
exit 1 | |
} | |
function mp3DirectCut($path) { | |
mp3DirectCut.exe (Resolve-Path $path) | |
} | |
ffmpeg -version | |
"aac2m4a PATH" | |
function aac2m4a ($path) { | |
$output = $(Get-ChildItem $path).Basename + ".m4a" | |
"> ffmpeg -i $path -acodec copy -bsf:a aac_adtstoasc $output" | |
ffmpeg -i $path -acodec copy -bsf:a aac_adtstoasc $output | |
} | |
"getaac PATH" | |
function getaac ($path) { | |
$output = $(Get-ChildItem $path).Basename + ".aac" | |
"> ffmpeg -i $path -acodec copy -map 0:1 $output" | |
ffmpeg -i $path -acodec copy -map 0:1 $output | |
} | |
"flac2alac PATH" | |
function flac2alac ($path) { | |
$output = $(Get-ChildItem $path).Basename + ".m4a" | |
"> ffmpeg -i $path -acodec alac $output" | |
ffmpeg -i $path -acodec alac $output | |
} | |
"audioConcatMute PATH SEC" | |
function audioConcatMute ($path, $sec) { | |
$output = $(Get-ChildItem $path).Basename + "_$sec" + $(Get-ChildItem $path).Extension | |
"> ffmpeg -i $path -f lavfi -i aevalsrc=0:0:0:0:0:0::d=$sec -filter_complex '[0:0] [1:0] concat=2:v=0:a=1 [a]' -map [a] $output" | |
ffmpeg -i $path -f lavfi -i aevalsrc=0:0:0:0:0:0::d=$sec -filter_complex '[0:0] [1:0] concat=2:v=0:a=1 [a]' -map [a] $output | |
} | |
'ls *.flac|%{ffmpeg -i $_ -acodec alac -map 0:0 "$($(Get-ChildItem $_).Basename).m4a"}' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
powershell.exe -noe -c ". C:\.....\set-ffmpeg-functions.ps1"
ps1が実行できるならドットソースするショートカットを作った方が良い。
スタートメニューのpowershellのショートカットをコピーして編集すれば、いつもの青い画面になる。