想把 .flac 转成 .wav
#!/usr/bin/env bash
set -e
find . -iname "*.flac" | while read f
do
target=${f//flac/wav}
echo ${f}
echo ${target}
done
echo "###############################"
find . -iname "*.flac" | while read f
do
target=${f//flac/wav}
echo ${f}
echo ${target}
ffmpeg -y -i "${f}" "${target}"
done
输出:
./Remember Me (Lullaby) - Gael García Bernal,Gabriella Flores,Libertad García Fonzi.flac
./Remember Me (Lullaby) - Gael García Bernal,Gabriella Flores,Libertad García Fonzi.wav
./Rewrite The Stars - Zac Efron,Zendaya.flac
./Rewrite The Stars - Zac Efron,Zendaya.wav
###############################
./Remember Me (Lullaby) - Gael García Bernal,Gabriella Flores,Libertad García Fonzi.flac
./Remember Me (Lullaby) - Gael García Bernal,Gabriella Flores,Libertad García Fonzi.wav
ffmpeg version 3.4.2 Copyright (c) 2000-2018 the FFmpeg developers
......
......
/Rewrite The Stars - Zac Efron,Zendaya.flac
/Rewrite The Stars - Zac Efron,Zendaya.wav
ffmpeg version 3.4.2 Copyright (c) 2000-2018 the FFmpeg developers
......
......
/Rewrite The Stars - Zac Efron,Zendaya.flac: No such file or directory
可以看到, 第二个循环里, 处理第二首歌, 那个 .
消失了?...
如果我设置了 set -ex 可以看到是这样的
第一个循环
...省略
+ read f
+ target='./Rewrite The Stars - Zac Efron,Zendaya.wav'
+ echo ./Rewrite The Stars - Zac Efron,Zendaya.flac
./Rewrite The Stars - Zac Efron,Zendaya.flac
+ echo ./Rewrite The Stars - Zac Efron,Zendaya.wav
./Rewrite The Stars - Zac Efron,Zendaya.wav
...省略
第二个循环里
...省略
+ read f
+ target='/Rewrite The Stars - Zac Efron,Zendaya.wav'
+ echo /Rewrite The Stars - Zac Efron,Zendaya.flac
/Rewrite The Stars - Zac Efron,Zendaya.flac
+ echo /Rewrite The Stars - Zac Efron,Zendaya.wav
/Rewrite The Stars - Zac Efron,Zendaya.wav
+ ffmpeg -y -i '/Rewrite The Stars - Zac Efron,Zendaya.flac' '/Rewrite The Stars - Zac Efron,Zendaya.wav'
...省略
都是一样的循环啊...
两首歌名
Remember Me (Lullaby) - Gael García Bernal,Gabriella Flores,Libertad García Fonzi.flac
Rewrite The Stars - Zac Efron,Zendaya.flac
1
goofool 2018-04-19 10:55:01 +08:00
什么点
|
2
jasonyang9 2018-04-19 11:02:07 +08:00
|
3
happywowwow OP @goofool
@jasonyang9 ./Rewrite The Stars - Zac Efron,Zendaya.flac 变成了 /Rewrite The Stars - Zac Efron,Zendaya.flac |
4
happywowwow OP @jasonyang9 也有尝试了, 浮现了. 可能得就是这两个歌名, 因为我之前处理的文件夹里有很多歌曲, 发现总是这里两首的时候过不去.
|
5
happywowwow OP @goofool
@jasonyang9 搞定. 怀疑是 ffmpeg 用到了 stdin 吃了几个字符把. ``` #!/usr/bin/env bash set -e for f in *flac; do target=${f//flac/wav} echo ${f} echo ${target} ffmpeg -y -stats -i "${f}" "${target}" done ``` |