问题描述
我有文件的大批量,我想关于使用债务工具中央结算狮身人面像斯芬克斯4.运行识别功能需要满足以下格式:
I have a big batch of files I'd like to run recognition on using CMU Sphinx 4. Sphinx requires the following format:
- 16千赫
- 16位
- 单
- 小尾数
我的文件是像44100千赫,32位立体声MP3文件。我试着用Tritonus,然后将其更新版本JavaZoom,用code从转换。然而, AudioSystem.getAudioInputStream(文件)
引发 UnsupportedAudioFileException
,我一直无法找出原因,所以我提出的。
My files are something like 44100 khz, 32 bit stereo mp3 files. I tried using Tritonus, and then its updated version JavaZoom, to convert using code from bakuzen. However, AudioSystem.getAudioInputStream(File)
throws an UnsupportedAudioFileException
, and I haven't been able to figure out why, so I have moved on.
现在我想的ffmpeg。命令的ffmpeg -i input.mp3 -ac 1 -ab 16 -ar 16000 output.wav
好像它应该做的伎俩(除小端),但是当我请与Audacity的输出,它仍然标注为32位浮点。我在也使用 -a codeC pcm_s16le
,这从它的名字似乎被输出的16位小端;然而,依然无畏的告诉我,输出 32位浮点
。
Now I am trying ffmpeg. The command ffmpeg -i input.mp3 -ac 1 -ab 16 -ar 16000 output.wav
seems like it should do the trick (except for little endian), but when I check the output with Audacity, it still labels it as "32-bit float". The command I found on this site also uses -acodec pcm_s16le
, which from its name seems to be outputting 16 bit little endian; however, Audacity still tells me the output is 32 bit float
.
谁能告诉我如何将音频文件转换成CMU狮身人面像4所要求的格式?
Can anyone tell me how to convert audio files into the format required by CMU Sphinx 4?
推荐答案
你真的尝试从FFmpeg的CMU中狮身人面像4的输出? 32位浮点可能是在Audacity的默认采样格式(编辑> preferences>质量的)。我猜这将任何导入的文件对这些设置,所以它可能没有报告的实际文件的参数,但也许在Audacity的工作文件。
Did you actually try the output from ffmpeg in CMU Sphinx 4? 32-bit float is probably your default sampling format in Audacity (Edit > Preferences > Quality). I'm guessing it converts any imported file to these settings, so it may not be reporting the parameters of the actual file, but perhaps the working file in Audacity.
删除 16 -AB
。这将指示连接codeR使用16位/ s和ffmpeg的会忽略它pcm_s16le反正。所以,你的命令如下:
Remove -ab 16
. This would instruct the encoder to use 16 bits/s and ffmpeg will ignore it for pcm_s16le anyway. So your command will look like:
ffmpeg -i input.mp3 -acodec pcm_s16le -ac 1 -ar 16000 output.wav
要所有的MP3文件转换目录中的在Linux中:
To convert all mp3 files in a directory in Linux:
for f in *.mp3; do ffmpeg -i "$f" -acodec pcm_s16le -ac 1 -ar 16000 "${f%.mp3}.wav"; done
或Windows:
for /r %i in (*) do ffmpeg -i %i -acodec pcm_s16le -ac 1 -ar 16000 %i.wav
您可以看到文件的信息
,的ffmpeg
, ffprobe
, mediainfo
其他实用程序中:
You can see file information with file
, ffmpeg
, ffprobe
, mediainfo
among other utilities:
$ file hjl0bC.wav
hjl0bC.wav: RIFF (little-endian) data, WAVE audio, Microsoft PCM, 16 bit, mono 16000 Hz
$ ffmpeg -i hjl0bC.wav
[...]
Stream #0:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 16000 Hz, mono, s16, 256 kb/s
这篇关于转换音频文件CMU狮身人面像4个输入的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!