景观设计案例网站,山西网络营销推广seo,胶州网站建设规划,淘客网站自己做官方教程#xff1a;http://ffmpeg.org/ffmpeg.html 录音方法#xff1a; 开始找到了这个方法#xff0c;但是不行呀#xff0c;好像是没有这个oss吧。 oss 是linux 下的声音相关的东西#xff0c;与alsa 一样#xff0c;不过oss 是商业的#xff0c; 而/dev/dsp 是oss … 官方教程http://ffmpeg.org/ffmpeg.html 录音方法 开始找到了这个方法但是不行呀好像是没有这个oss吧。 oss 是linux 下的声音相关的东西与alsa 一样不过oss 是商业的 而/dev/dsp 是oss 用到的麦克的设备吧 ffmpeg -f oss -i /dev/dsp wheer.mp3ffmpeg -f oss -i /dev/dsp -ar 8000 -ab 10200 wheer.amr 采用 alsa-oss 录制就可以啦 ffmpeg -f alsa -ac 2 -i hw:0,0 out.mp3ffmpeg -f alsa -ac 2 -i hw:0,0 out.wav 科大讯飞的合成或者识别保存成的音频文件格式是16k或者8k16bit单声道pcm格式的音频。采用以下方式录音 ffmpeg -f alsa -ar 16000 -ac 1 -i hw:0 lib.wav ——停止 但是 我使用以上命令时提示说 cannot set channel count to 1 (Invalid argument)
hw:0: Input/output error 最后查阅资料发现以下参数设置 -ab bitrate 设置音频码率-ar freq 设置音频采样率-ac channels 设置通道 缺省为1-an 不使能音频纪录-acodec codec 使用codec编解码 如此按理说去掉 -ac通道设置即可运行以下命令 ffmpeg -f alsa -ar 16000 -i hw:0 lib.wav -acodec pcm_s16le但还是无法识别最后问了一下是这样录音的 ffmpeg -y -f alsa -i pluse -t 00:00:06 -ar 16000 -ac 1 lib.wav 其中 -y (global)Overwrite output files without asking.-f fmt (input/output)Force input or output file format. The format is normally auto detected for input files and guessed from the file extensionfor output files, so this option is not needed in most cases.-i url (input)input file url-t duration (input/output)When used as an input option (before -i), limit the duration of data read from the input file.When used as an output option (before an output url), stop writing the output after its duration reaches duration.duration must be a time duration specification, see (ffmpeg-utils)the Time duration section in the ffmpeg-utils(1) manual.-to and -t are mutually exclusive and -t has priority. //试试改改他的用法
ffmpeg -y -f alsa -i hw:0 -t 00:00:06 -ar 16000 -ac 1 lib.wav 这个可以了。 感谢 出处http://www.cnblogs.com/farewell-farewell/p/6111756.html