-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAAXConvert.ps1
47 lines (40 loc) · 1.12 KB
/
AAXConvert.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
####
## AAXConvert.ps1 "C:\Users\connor\Desktop\KingsCage\KingsCage_ep6_QHCF48H2s8JRMEGO5kHh8mowNe6vrJWydNewyfVKtBQa9uzmBen9QjvH2l01.aax" 149x043
####
param(
[string]$InputFile = $null,
[string]$ActivationCode = $null,
[string]$OutputFile = $null,
[switch]$mp3 = $false,
[switch]$aac = $false,
[switch]$flac = $false,
[string]$bitrate = $null
)
if (!$InputFile -or !$ActivationCode){
"Invalid file name or activation code"
exit 1
}
if (!$OutputFile){
$OutputFile = [IO.Path]::GetFileNameWithoutExtension($InputFile)
}
else{
$OutputFile = [IO.Path]::GetFileNameWithoutExtension($OutputFile)
}
if (!$mp3 -and !$aac -and !$flac){
$mp3 = $true
}
if ($flac){
ffmpeg -activation_bytes $ActivationCode -i $InputFile -vn -c:a flac "$OutputFile.flac"
}
if ($mp3){
if (!$bitrate){
$bitrate = 320
}
ffmpeg -activation_bytes $ActivationCode -i $InputFile -c:a libmp3lame -b "$($bitrate)k" "$OutputFile.mp3"
}
if ($aac){
if (!$bitrate){
$bitrate = 256
}
ffmpeg -activation_bytes $ActivationCode -i $InputFile -c:a aac -b:a "$($bitrate)k" "$OutputFile.m4a"
}