日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

使用ffmpeg录音

發布時間:2023/12/9 编程问答 25 豆豆
生活随笔 收集整理的這篇文章主要介紹了 使用ffmpeg录音 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

官方教程: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或者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 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

總結

以上是生活随笔為你收集整理的使用ffmpeg录音的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。