1500字范文,内容丰富有趣,写作好帮手!
1500字范文 > flac格式音频转wav|Linux 使用 Shell 循环遍历文件夹里的音频——简介

flac格式音频转wav|Linux 使用 Shell 循环遍历文件夹里的音频——简介

时间:2020-09-27 18:13:04

相关推荐

flac格式音频转wav|Linux 使用 Shell 循环遍历文件夹里的音频——简介

FLAC (无损音频压缩编码)-百度百科简介

使用sox工具把flac格式转wav,命令如下:

sox 1.flac 1.wav

如果你的 flac 通道数、采样率、量化进度和wav不一致的话,需要加相应参数,如:

sox 1.flac -c 1 -r 16000 -b 16 1.wav

Linux使用Shell循环遍历文件夹里的音频进行转换的代码如下:

#!/bin/bashfunction flacToWav(){echo $1ext=${1##*.}echo $extif [ $ext = 'flac' ]then#echo "True"filename=$(basename $1 .flac)echo $filenamesox $1 ${filename}.wavrm -rf $1fi}function travFolder(){echo $1flist=`ls $1`cd $1#echo $flistfor f in $flistdoif test -d $fthentravFolder $felseflacToWav $ffidonecd ../}travFolder $1

我的个人音频批量转换shell命令如下:

tar zxvf dev-other.tar.gz ./flacToWav.sh LibriSpeech/mkdir dev-othercp -r LibriSpeech/ dev-otherzip -r dev-other.zip dev-other

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。