MP3ファイルを無音部分で分割する (Macのコマンドライン)
MP3ファイルの最後の部分に、「10秒くらいの無音区間」+「無関係な音楽」がくっついているものがあって聞きづらい。 GUIで波形データを直接編集したり、編集後にコードするのは面倒なので、コマンドラインから自動的に削除したいと思っていました。
mp3splt
というプログラムをつかうと簡単にできました(github repo: mp3splt/mp3splt
)。作者の方に感謝です。
1
2
3
4
5
6
7
8
9
10
11
12
# Install:
brew install mp3splt
# Usage:
mp3splt -s -pmin=<無音区間の秒数>,th=<無音判定の判定位レベル(dB)。-48くらいがよいとのこと> <mp3ファイル名>
# Example:
mp3splt -s -pmin=10,th=-54 ラジオ.mp3
# Output:
ラジオ_silent_1.mp3 # <== このファイルが、ほしい出力。
ラジオ_silent_2.mp3 # <== このファイルが、無音区間後の無関係な音楽。消してしまってよい。
ヘルプメッセージ
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
mp3splt 2.6.2 (09/11/14) - using libmp3splt 0.9.2
Matteo Trotta <mtrotta AT users.sourceforge.net>
Alexandru Munteanu <m AT ioalex.net>
THIS SOFTWARE COMES WITH ABSOLUTELY NO WARRANTY! USE AT YOUR OWN RISK!
USAGE:
mp3splt [OPTIONS] FILE1 [FILE2] ... [BEGIN_TIME] [TIME] ... [END_TIME]
TIME FORMAT: min.sec[.0-99], even if minutes are over 59
or EOF-min.sec[.0-99] (or EOF for End Of File).
OPTIONS (split mode options)
-t + TIME: to split files every fixed time len. (TIME format same as above).
-c + file.cddb, file.cue or "query" or "query{album}" or "internal_sheet".
Get splitpoints and filenames from a .cddb or .cue file or from Internet
("query"). Use -a to auto-adjust splitpoints.
-s Silence detection: automatically find splitpoint. (Use -p for arguments)
-w Splits wrapped files created with Mp3Wrap or AlbumWrap.
-l Lists the tracks from file without extraction. (Only for wrapped mp3)
-e Error mode: split mp3 with sync error detection. (For concatenated mp3)
-r Trim using silence detection (Use -p for arguments)
-A + AUDACITY_FILE: split with splitpoints from the audacity labels file
-S + SPLIT_NUMBER: split in SPLIT_NUMBER equal time files
-v Prints current version and exits
-h Shows this help
(other options)
-T + TAGS_VERSION: for mp3 files, force output tags as version 1, 2 or 1 & 2.
TAGS_VERSION can be 1, 2 or 12
(default is to set the same version as the file to split)
-m + M3U_FILE: Appends to the specified m3u file the split filenames.
-f Frame mode (mp3 only): process all frames. For higher precision and VBR.
-b [Experimental] Bit reservoir handling for gapless playback (mp3 only).
-a Auto-Adjust splitpoints with silence detection. (Use -p for arguments)
-p + PARAMETERS (th, nt, off, min, rm, gap, trackmin, shots, trackjoin): user arguments for -s, -a, -t.
-o + FORMAT: output filename pattern. Can contain those variables:
@a: artist tag, @p: performer tag (might not exists), @b: album tag
@t: title tag, @n: track number identifier, @N: track tag number
(a digit may follow the 'n' or 'N' for the number of digits to output),
@f: original filename, @g: genre
-g + TAGS: custom tags for the split files.
TAGS can contain those variables:
@a, @b, @t, @y, @c, @n, @g, @o (set original tags),
@N (auto increment track number).
TAGS format is like [@a=artist1,@t=title1]%[@o,@N=2,@a=artist2]
(% means that we set the tags for all remaining files)
-G + regex=REGEX: set tags from input filename. REGEX defines how to extract
the tags from the filename. It can contain those variables:
(?<artist>), (?<album>), (?<title>), (?<tracknum>), (?<year>), (?<comment>), (?<genre>)
-d + DIRNAME: to put all output files in the directory DIRNAME.
-k Consider input not seekable (slower). Default when input is STDIN (-).
-O + TIME: Overlap split files with TIME (slower).
-n No Tag: does not write ID3v1 or vorbis comment. If you need clean files.
-x No Xing header: does not write the Xing header. Use with -n if you wish
to concatenate the split files
-N Don't create the 'mp3splt.log' log file when using '-s'.
-P Pretend to split: simulation of the process, without creating any
files or directories
-E + CUE_FILE: export splitpoints to CUE file (use with -P if needed)
-q Quiet mode: try not to prompt (if possible) and print less messages.
-Q Very quiet mode: don't print anything to stdout and no progress bar
(also enables -q).
-D Debug mode: used to debug the program.
Please read man page for complete documentation.