ALSA中aplay -Dhw:0,0 和 aplay -Dplughw:0,0 的区别
aplay -Dhw:0,0 -c 2 -r 48000 -f S16_LE /usr/share/sounds/alsa/Front_Left.wav
Playing WAVE \’/usr/share/sounds/alsa/Front_Left.wav\’ : Signed 16 bit Little Endian, Rate 48000 Hz, Monoaplay: set_params:1305: Channels count non available
aplay -Dplughw:0,0 -c 2 -r 48000 -f S16_LE /usr/share/sounds/alsa/Front_Left.wav
可以正常播放.
其中的区别就是hw 和 plughw , 参考 Difference between “hwplug” and “hw”得出结论
hw
: accesses the hardware device directly. // 直接访问硬件
plughw
: inserts sample rate and format conversion plugins, if needed. //经过采样率和格式转换插件。
可以通过
mediainfo
查看文件信息, 发现为1通道格式,而Codec driver 是需要播放的2 channel的,所以需要plug转换为2 channel才可以播放.
特意找了一个2 channel / 48kHz , 验证了猜想结果. 不加plug可以正常播放
? alsa mediainfo Front_Left.wavGeneralComplete name : Front_Left.wavFormat : WaveFile size : 139 KiBDuration : 1 s 480 msOverall bit rate mode : ConstantOverall bit rate : 768 kb/sAudioFormat : PCMFormat settings : Little / SignedCodec ID : 1Duration : 1 s 480 msBit rate mode : ConstantBit rate : 768 kb/sChannel(s) : 1 channelSampling rate : 48.0 kHzBit depth : 16 bitsStream size : 139 KiB (100%)
hw
accesses the hardware device directly.
plughw
inserts sample rate and format conversion plugins, if needed.
《ALSA中aplay -Dhw:0,0 和 aplay -Dplughw:0,0 的区别》来自互联网同行内容,若有侵权,请联系我们删除!
还没有评论,来说两句吧...