|
|
如何用批处理获取一首mp3(或批量获取同一文件夹里的多个mp3)的歌曲时间长度并算出1/4和3/4处的时间点?
主要是想批量分割多个mp3成前1/4和后3/4的片段。
我参看国外的mp3相关编辑论坛有分割的,但是目前只能手动指定时间点来分割。
现在很不想手动输入时间点,自动能判断算出那2个时间点甚至多个时间点该是多方便啊,因为每个mp3的时间长度都不一样。
dpmp3split.cmd- @echo off
- set "mp3DirectCut=C:\Program Files (x86)\mp3DirectCut_2.20\mp3DirectCut.exe"
- for %%f in (%3) do (
- echo FILE "%%~f" MP3> sheet.cue
- echo TRACK 01 AUDIO>>sheet.cue
- echo INDEX 01 00:00:00>>sheet.cue
- echo TRACK 02 AUDIO>>sheet.cue
- echo INDEX 01 %1>>sheet.cue
- echo TRACK 03 AUDIO>>sheet.cue
- echo INDEX 01 %2>>sheet.cue
- "%mp3DirectCut%" sheet.cue /split
- del *02.mp3
- )
- del sheet.cue
- ren *01.mp3 *" "p01.mp3
- ren *03.mp3 *" "p02.mp3
复制代码 用这个分割片段.bat 来调用- ::在这里手动设置截取片段的两个时间点↓
- dpmp3split.cmd 01:10:00 03:30:00 *.mp3
复制代码 需要安装 mp3DirectCut 2.20 这个编辑mp3的工具,到处有下。
这里有这个软件的命令行代码
Command line options
Usage:
mp3DirectCut.exe <filename> <option(s)> <destination>
As <filename> every file type known by mp3DirectCut is possible (MP3, MP2, Project files, Cue sheets). Usually this is simply for a file to be opened. In your operating system settings you can associate mp3DirectCut to one or more of these file types and with different options. Then you can open the program easily by any file of that type. It is also possible to drag files of known types over mp3DirectCut.
If you use the <filename> parameter together with /rec you can set an individual record filename that differs from the base filename of the recording settings.
The following options can be used to let the program perform an action immediately. After finnishing, the program quits.
Note: adjustments for Normalize, Auto cue, Encoder settings and so on cannot be given over the command line. They must be made before in the normal program environment.
Examples:
mp3DirectCut "artist - song.mp3"
mp3DirectCut track01.mp3 /normalize /overwrite
mp3DirectCut audiobook.mp3 /autocue d:\split
mp3DirectCut album.cue /split
mp3DirectCut /rec
mp3DirectCut other_recname.mp3 /rec
Options:
/normalize Normalizes the file up to 0 dB. Higher or lower levels cannot be set in the command line.
/autocue Splits the given file into segments of the time set in the Autocue dialog. Also for the Split operation the current settings from normal program usage are applied. <destination> can be an existing folder to save the split files to.
/autocrop Cuts silences from beginning and end of track using the "Lowest gain" value which can be set in the configuration window or in the gain dialog.
/split Needs a Cue sheet or Project file and splits the audio file(s). If a <destination> folder is set, the split files will be saved there. The other Split settings must be adjusted in the normal program environment.
/pausesplit Runs the pause detector and splits the given file at the found pause positions. For the performed Pause detection and Save split operations, the current settings are applied. You can change them by normal program usage. <destination> can be an existing folder for the result files.
/save Opens and saves the file. Simple re-save can be used to eliminate incomplete frames or unwanted headers.
/overwrite Replaces the original file on /save or /normalize. The current "Keep date of source file" setting is valid (it can be set in the program environment). If /overwrite is not set, the given file extension will be appended once more.
/rec Starts the recording immediately. This feature is especially made for timer recordings. In a scheduler usually you can also set a duration time after which the program will be terminated. For multiple timer recordings be sure to check Add date and time or Append data in the recording settings, otherwise previous recordings will be overwritten. If a filename is given before the /rec option and Add date and time or Append data is not (!) selected, the program records into a file of that name.
/localini Regulary the program tries to write the settings into its own folder. If this fails, e.g. because of missing rights, the settings are stored in the user's Application data folder. This option prevents the program from reading from or writing to the user profile. This may be useful in special cases, e.g. if local settings are needed when the program is running from a removable drive.
有没有大触手可以把这2个批处理融合成一个文件,我确实太新手了...
关于获取mp3时间长度,我网上看到
BAT和JScript混合编程获取mp3音频文件的播放时间长度
http://bbs.bathome.net/viewthread.php?tid=29969#pid147781
谢谢高手来相助! |
评分
-
查看全部评分
|