I have an audiobook which consists of over 700 ra files (RealAudio) which I'm trying to batch convert to mp3 using ffmpeg. RA files are named as chapter-verse.ra (e.g. 13-01.ra)
I run a script and it gets as far as processing 32 files and then stops. For each file it displays an error, but converts it none the less.
Here is my script:
#!/bin/bash
#
outdir=/data/sounds/output
srcdir=/data/sounds
# Cleanup first
rm -f /data/sounds/output/*
ls -1 ${srcdir}/*.ra | while read file
do
infile=$(basename $file)
chapter=$(echo $infile | cut -f1 -d"-")
verse=$(echo $infile | cut -f2 -d"-")
verse=$(echo $verse | cut -f1 -d".")
echo "File $file | Target: Chapter $chapter Verse $verse"
echo
ffmpeg -i $file -loglevel error -acodec libmp3lame ${outdir}/Chapter${chapter}_Verse${verse}.mp3
done
Here is an extract of the output I'm getting:
[ac3 @ 0x221e520] frame sync error
Error while decoding stream #0:0: Invalid data found when processing input
/data/sounds/13-02.ra: Input/output error
File data/sounds/13-03.ra | Target: Chapter 13 Verse 03
data/sounds/13-03.ra: No such file or directory
File /data/sounds/13-04.ra | Target: Chapter 13 Verse 04
[ac3 @ 0x1a4d520] frame sync error
Error while decoding stream #0:0: Invalid data found when processing input
/data/sounds/13-04.ra: Input/output error
File data/sounds/13-05.ra | Target: Chapter 13 Verse 05
data/sounds/13-05.ra: No such file or directory
File /data/sounds/13-06.ra | Target: Chapter 13 Verse 06
What's puzzling is that it complains about "no such file or directory", but if I simply echo the ffmpeg command (without executing it) the script runs fine all the way till the end.
When the script aborts, I find my output directory has some files in it which all work fine, I just wish it would process all of them?! My environment:
Fedora workstation 21
ffmpeg version 2.4.8 Copyright (c) 2000-2015 the FFmpeg developers
ffmpeg -i "$file"
.