[FFmpeg-user] Converting mkv to mp3 failures

JD jd1008 at gmail.com
Fri Jul 14 01:24:31 EEST 2017



On 07/13/2017 03:22 PM, Moritz Barsnick wrote:
> On Thu, Jul 13, 2017 at 15:11:56 -0600, JD wrote:
>
>> Your filename does not contain parentheses, brackets and single quotes
>> and unprintable characters that
>> MANY files I download contain in their names.
>> And THAT is the crux of the problem.
> That's no crux.
>
> $ for file in *.mkv; do ffmpeg -i "$file" -map 0:a -c:a libmp3lame /targetdir/"${f%.mkv}".mp3; done
>
> Fixed that for you. Never forget to quote your variables.
>
> Moritz
Thanx to all.
What I did is  tedious, but I had no choice.
Double quoting the filenames did not solve my problem.
So, I simply gathered all the filenames (find . -name \*.mkv -o -name 
\*.mp4 -o -name \*.webm)
into a file which I edited and turned it into a script that
removed single quotes, unprintable characters, square brackets, commas, and
replaced all spaces with underscores - of course, used the mv command to 
move
the files to the new names.
I retried the script as follows:



while read f; do
N=`basename "$f" | sed -e 's/mkv//' -e 's/mp4//' -e 's/webm//'`
         /bin/ffmpeg -i "$f" -map 0:a -c:a libmp3lame -ab 320k -ac 2 -y 
$D/$N"mp3"
done < VIDEO_FILES  > FFMPEG_ERRORS 2>&1

And I am still getting parse errors, because ffmpeg is UNABLE to parse 
long filenames.

What makes it even more confusing, the parse error message appears 
within or between the console output
of transcoding a previous file.




More information about the ffmpeg-user mailing list