从unix命令批量转换wf文件到ffmpeg到16位 [英] Bulk converting wav files to 16-bit with ffmpeg in batch from unix command
问题描述
我想转换所有这样的文件:
ffmpeg -i BmBmGG-BmBmBmBm.wav -acodec pcm_s16le -ar 44100 BmBmGG-BmBmBmBm.wav
但是,我想要保存目录结构和名称。被覆盖或并行目录。
当输出文件具有不同的名称时,上面的命令字很好,但是同名,我收到一个错误:
数据包中的多帧数据流0
[pcm_s24le @ 0x1538ac0] PCM数据包无效,数据大小为4,但至少有6个大小为
解码流#0时出错:0:处理输入时发现无效的数据
我第一次尝试批量转换如下:
ffmpeg -i * / * / *。wav -acodec pcm_s16le -ar 44100 * / * / *。 wav
不幸的是,这给出了同样的问题。如何将它们存储在并行目录中?说新的/ / / *。wav?
for $ in $(find ./ -name'* .wav'); do
ffmpeg -i $ f -acodec pcm_s16le -ar 44100 $ {f%.wav} z.wav;
rm $ f;
mv $ {f%.wav} z.wav $ f;
done
I have a folder consisting of many subfolders, each with other subfolders and therein wav files.
I want to convert all of the files like this:
ffmpeg -i BmBmGG-BmBmBmBm.wav -acodec pcm_s16le -ar 44100 BmBmGG-BmBmBmBm.wav
BUT, I want the directory structures and names preserved. Either overwritten or in a parallel directory.
The above command words fine when the output file has a different name, however, with the same name I get an error:
Multiple frames in a packet from stream 0
[pcm_s24le @ 0x1538ac0] Invalid PCM packet, data has size 4 but at least a size of 6 was expected
Error while decoding stream #0:0: Invalid data found when processing input
I first tried bulk converting like this:
ffmpeg -i */*/*.wav -acodec pcm_s16le -ar 44100 */*/*.wav
Unfortunately, this gives the same problem. How can I store them in a parallel directory? Say new///*.wav?
This did the trick:
for f in $(find ./ -name '*.wav'); do
ffmpeg -i $f -acodec pcm_s16le -ar 44100 ${f%.wav}z.wav;
rm $f;
mv ${f%.wav}z.wav $f;
done
这篇关于从unix命令批量转换wf文件到ffmpeg到16位的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!