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

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 运维知识 > linux >内容正文

linux

linux arecord 命令,如何使用arecord录音

發布時間:2025/3/20 linux 46 豆豆
生活随笔 收集整理的這篇文章主要介紹了 linux arecord 命令,如何使用arecord录音 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

如何使用arecord錄音

arecord 是ALSA聲卡驅動程序的命令行聲音文件記錄器。 它支持多種文件格式和具有多個設備的多個聲卡。 如果以交錯模式錄制,文件將在2GB文件大小之前自動分割。

使用前先查看 arecord 的幫助信息:

[root@imx6ull:~]# arecord -h

Usage: arecord [OPTION]... [FILE]...

-h, --help help

--version print current version

-l, --list-devices list all soundcards and digital audio devices

-L, --list-pcms list device names

-D, --device=NAME select PCM by name

-q, --quiet quiet mode

-t, --file-type TYPE file type (voc, wav, raw or au)

-c, --channels=# channels

-f, --format=FORMAT sample format (case insensitive)

-r, --rate=# sample rate

-d, --duration=# interrupt after # seconds

-s, --samples=# interrupt after # samples per channel

-M, --mmap mmap stream

-N, --nonblock nonblocking mode

-F, --period-time=# distance between interrupts is # microseconds

-B, --buffer-time=# buffer duration is # microseconds

--period-size=# distance between interrupts is # frames

--buffer-size=# buffer duration is # frames

-A, --avail-min=# min available space for wakeup is # microseconds

-R, --start-delay=# delay for automatic PCM start is # microseconds

(relative to buffer size if <= 0)

-T, --stop-delay=# delay for automatic PCM stop is # microseconds from xrun

-v, --verbose show PCM structure and setup (accumulative)

-V, --vumeter=TYPE enable VU meter (TYPE: mono or stereo)

-I, --separate-channels one file for each channel

-i, --interactive allow interactive operation from stdin

-m, --chmap=ch1,ch2,.. Give the channel map to override or follow

--disable-resample disable automatic rate resample

--disable-channels disable automatic channel conversions

--disable-format disable automatic format conversions

--disable-softvol disable software volume control (softvol)

--test-position test ring buffer position

--test-coef=# test coefficient for ring buffer position (default 8)

expression for validation is: coef * (buffer_size / 2)

--test-nowait do not wait for ring buffer - eats whole CPU

--max-file-time=# start another output file when the old file has recorded

for this many seconds

--process-id-file write the process ID here

--use-strftime apply the strftime facility to the output file name

--dump-hw-params dump hw_params of the device

--fatal-errors treat all errors as fatal

Recognized sample formats are: S8 U8 S16_LE S16_BE U16_LE U16_BE S24_LE S24_BE U24_LE U24_BE S32_LE S32_BE U32_LE U32_BE FLOAT_LE FLOAT_BE FLOAT64_LE FLOAT64_BE IEC958_SUBFRAME_LE IEC958_SUBFRAME_BE MU_LAW A_LAW IMA_ADPCM MPEG GSM SPECIAL S24_3LE S24_3BE U24_3LE U24_3BE S20_3LE S20_3BE U20_3LE U20_3BE S18_3LE S18_3BE U18_3LE U18_3BE G723_24 G723_24_1B G723_40 G723_40_1B DSD_U8 DSD_U16_LE DSD_U32_LE DSD_U16_BE DSD_U32_BE

Some of these may not be available on selected hardware

The available format shortcuts are:

-f cd (16 bit little endian, 44100, stereo)

-f cdr (16 bit big endian, 44100, stereo)

-f dat (16 bit little endian, 48000, stereo)

根據幫助信息可知:

使用 arecord -l 命令列出聲卡和數字音頻設備:

[root@imx6ull:~]# arecord -l

**** List of CAPTURE Hardware Devices ****

card 0: wm8960audio [wm8960-audio], device 0: HiFi wm8960-hifi-0 []

Subdevices: 1/1

Subdevice #0: subdevice #0

card 0: wm8960audio [wm8960-audio], device 1: HiFi-ASRC-FE (*) []

Subdevices: 1/1

Subdevice #0: subdevice #0

得到聲卡和數字音頻設備列表后,可根據其信息進行以下操作:

-d 指定錄音時間(秒)

-D 參數用于指定音頻設備 PCM

以 hwx,x 開頭(聲卡號,設備號)

根據上面列出的設備,如果選擇 HiFi wm8960-hifi-0 來錄制聲音的話那么 pcm 設備就為 hw0,0,如果是 HiFi wm8960-hifi-1 則 pcm 設備為 hw0,1,HiFi wm8960-hifi-2 則 pcm 設備為 hw0,2 ...以此類推。

-r 指定采樣頻率: 5512/8000/11025/16000/22050/32000/44100/48000/64000/88200/96000/176400/192000

-f 指定采樣格式上面的幫助信息列出了: cd/cdr/dat/S16_LE/S32_LE/...

示例:

[root@imx6ull:~]# arecord -D default:CARD=mcasp0 -d 100000 -f cd -t raw duration—100000s_format-cd.raw

[root@imx6ull:~]# arecord -D default:CARD=mcasp0 -d 100000 -f dat -t raw duration—100000s_format-dat.raw

[root@imx6ull:~]# arecord -D default:CARD=mcasp0 -d 100000 -f S16_LE -r 16000 -t raw duration—100000s_format-S16_LE_rate-16000.raw

[root@imx6ull:~]# arecord -Dhw:0,1 -r8000 -f cd test.wmv

[root@imx6ull:~]# arecord -Dhw:0,0 -r8000 -f S16_LE -c 2 test.wmv

[root@imx6ull:~]# arecord -Dhw:0,2 -r48000 -f S32_LE -c 2 test.wmv

總結

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

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