make ffmpeg not read from stdin and check output of ffmpeg

This commit is contained in:
Sem
2026-07-20 14:05:56 +02:00
parent 5e0f506bf3
commit dc7f14128d

View File

@@ -15,10 +15,14 @@ function fix_flac_file()
echo "running command ffmpeg -i $1 -c:a flac -map_metadata 0 fixed.flac"
ffmpeg -i "$1" -c:a flac -map_metadata 0 "fixed.flac"
echo "moving fixed.flac to $1"
mv "fixed.flac" "$1"
if ffmpeg -nostdin -i "$1" -c:a flac -map_metadata 0 fixed.flac
then
echo "Moving fixed.flac to $1"
mv fixed.flac "$1"
else
echo "Failed to process $1" >&2
rm -f fixed.flac
fi
}
function print_help()
@@ -51,7 +55,8 @@ else
if [ "$1" = "-l" ]
then
echo "Looping through $2"
while read flacfile; do
# Use IFS= and -r with read so backslashes and leading/trailing whitespace are preserved
while IFS= read -r flacfile; do
echo "Processing line $flacfile"
fix_flac_file "$flacfile"
done < "$2"