在一个循环中执行命令的ffmpeg [英] execute ffmpeg command in a loop
本文介绍了在一个循环中执行命令的ffmpeg的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有我的文件夹中的3 .wav文件,我想将它们转换成与ffmpeg的.MP3
我写了这个bash脚本,将来作为跟随,但是当我执行它,只有第一个将被转换为MP3
我应该怎么做才能让脚本继续下去,通过了我的文件
这是该脚本:
#!/斌/庆典
找到./ -name* .WAV-print |而读˚F
做
名字= $ {F:2:$ {#F}} -6
CMD ='的ffmpeg -i$ name.wav-AB 320K -ac 2$ name.mp3'
的eval $ CMD< BR>
DONE
解决方案
#!/斌/庆典
为支持* .wav名;做
ffmpeg的-i$名-AB 320K -ac 2$ {名称%。*} .MP3
DONE
I have 3 .wav files in my folder and I want to convert them into .mp3 with ffmpeg I wrote this bash script that will come as follow, but when I execute it, only the first one will have been converted to mp3 what should I do to make script keep going through out of my files
this is the script :
#!/bin/bash
find ./ -name "*.wav" -print | while read f
do
name=${f:2:${#f}-6}
cmd='ffmpeg -i "$name.wav" -ab 320k -ac 2 "$name.mp3"'
eval $cmd<br>
done
解决方案
No reason for find, just use bash wildcard globbing
#!/bin/bash
for name in *.wav; do
ffmpeg -i "$name" -ab 320k -ac 2 "${name%.*}.mp3"
done
这篇关于在一个循环中执行命令的ffmpeg的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文