使用ffmpeg录音
官方教程:http://ffmpeg.org/ffmpeg.html
录音方法:
开始找到了这个方法,但是不行呀,好像是没有这个oss吧。
oss 是linux 下的声音相关的东西,与alsa 一样,不过oss 是商业的, 而/dev/dsp 是oss 用到的麦克的设备吧
ffmpeg -f oss -i /dev/dsp wheer.mp3 ffmpeg -f oss -i /dev/dsp -ar 8000 -ab 10200 wheer.amr
采用 alsa-oss 录制,就可以啦
ffmpeg -f alsa -ac 2 -i hw:0,0 out.mp3 ffmpeg -f alsa -ac 2 -i hw:0,0 out.wav
科大讯飞的合成或者识别,保存成的音频文件格式是16k或者8k,16bit,单声道pcm格式的音频。采用以下方式录音
ffmpeg -f alsa -ar 16000 -ac 1 -i hw:0 lib.wav
q——停止
但是 我使用以上命令时,提示说
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 extension for 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
关注我】。(●'◡'●)
如果,您希望更容易地发现我的新博客,不妨点击一下绿色通道的【因为,我的写作热情也离不开您的肯定与支持,感谢您的阅读,我是【Jack_孟】!
本文来自博客园,作者:jack_Meng,转载请注明原文链接:https://www.cnblogs.com/mq0036/p/6541804.html
【免责声明】本文来自源于网络,如涉及版权或侵权问题,请及时联系我们,我们将第一时间删除或更改!
posted on 2017-03-13 11:15 jack_Meng 阅读(5554) 评论(0) 编辑 收藏 举报
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析
· DeepSeek 开源周回顾「GitHub 热点速览」
· 物流快递公司核心技术能力-地址解析分单基础技术分享
· .NET 10首个预览版发布:重大改进与新特性概览!
· AI与.NET技术实操系列(二):开始使用ML.NET
· 单线程的Redis速度为什么快?
2015-03-13 学习动态性能表(22)V$resource_limit
2015-03-13 学习动态性能表(21)v$lincense
2015-03-13 学习动态性能表(20)--v$waitstat
2015-03-13 学习动态性能表(19)--v$undostat
2015-03-13 学习动态性能表(18)--v$system_event
2015-03-13 学习动态性能表(17)--v$segstat&v$segment_statistics
2015-03-13 学习动态性能表(16)--v$rowcache