[FFmpeg-user] Transcode from mp4 to wav fails for several files

JD jd1008 at gmail.com
Mon Dec 25 20:53:46 EET 2017


Using
ffmpeg version N-88150-gae100046ca-static 
https://johnvansickle.com/ffmpeg/  Copyright (c) 2000-2017 the FFmpeg 
developers
   built with gcc 6.4.0 (Debian 6.4.0-8) 20171010
   configuration: --enable-gpl --enable-version3 --enable-static 
--disable-debug --disable-ffplay --disable-indev=sndio 
--disable-outdev=sndio --cc=gcc-6 --enable-fontconfig --enable-frei0r 
--enable-gnutls --enable-gray --enable-libfribidi --enable-libass 
--enable-libvmaf --enable-libfreetype --enable-libmp3lame 
--enable-libopencore-amrnb --enable-libopencore-amrwb 
--enable-libopenjpeg --enable-librubberband --enable-librtmp 
--enable-libsoxr --enable-libspeex --enable-libvorbis --enable-libopus 
--enable-libtheora --enable-libvidstab --enable-libvo-amrwbenc 
--enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 
--enable-libxvid --enable-libzimg
   libavutil      56.  0.100 / 56.  0.100
   libavcodec     58.  0.100 / 58.  0.100
   libavformat    58.  0.100 / 58.  0.100
   libavdevice    58.  0.100 / 58.  0.100
   libavfilter     7.  0.100 /  7.  0.100
   libswscale      5.  0.100 /  5.  0.100
   libswresample   3.  0.100 /  3.  0.100
   libpostproc    55.  0.100 / 55.  0.100

I downloaded from youtube the following playlist:
https://www.youtube.com/playlist?list=PLTcOKgEfeA--41UT4f6MF3LngqLpgK2HY

using youtube-dl with options specified in /etc/youtube-dl.conf which 
contains the following options:

# Default configuration for youtube-dl.

-ci
-f best
-v
--sub-lang en
--convert-subs srt
--embed-subs
--fixup warn
--audio-quality 320k

because sometimes I am downloading movie videos.

So, the playlist is downloaded as:

01. Once Upon A Time... Storybook Love-fEN1CxYdQGE.mp4
02. I Will Never Love Again-UNiqBZKL3q0.mp4
03. Florin Dance-ri7q63uaKqU.mp4
04. Morning Ride-zV1nLvDMnb8.mp4
05. The Friend's Song-OFFC-aFbw88.mp4
06. The Cliffs Of Insanity-QRH-7zv46mM.mp4
07. The Swordfight-L8FGBKpIMzc.mp4
08. Guide My Sword-73PxXl-D7kE.mp4
09. The Fireswamp & The Rodents Of Unusual Size-4pD6K0sXUpY.mp4
10. Revenge-vjRDf7klEx4.mp4
11. A Happy Ending-ibB4ADNBl9M.mp4
12. Storybook Love-cxx9lRrUO_E.mp4

sans the track numbers, which I added later by changing the track name 
to include the track numbers.

Now, I want to transcode them to wav format using the script:

#!/bin/bash
SHELL=/bin/bash
rm -f ERRORS *.wav
/bin/ls -1 *.mp4 | while read f; do
n=${f%mp4}wav
ffmpeg -i "$f" -ab 312k "$n"
echo "ffmpeg exited with status code $? for file $f" >> ERRORS
echo ""
if [ -f "$n" ]; then
         ls -l "$n"
else
         echo "$n was NOT created. Transcode failed." >> ERRORS
fi
done

ERRORS file contains

$ cat ERRORS
ffmpeg exited with status code 0 for file 01. Once Upon A Time... 
Storybook Love-fEN1CxYdQGE.mp4
ffmpeg exited with status code 1 for file BZKL3q0.mp4 <<<< Notice the 
failure to read file name!!!
BZKL3q0.wav was NOT created. Transcode failed. <<<< Notice the failure 
to read file name!!!
ffmpeg exited with status code 0 for file 03. Florin Dance-ri7q63uaKqU.mp4
ffmpeg exited with status code 1 for file The Cliffs Of 
Insanity-QRH-7zv46mM.mp4
The Cliffs Of Insanity-QRH-7zv46mM.wav was NOT created. Transcode failed.
ffmpeg exited with status code 0 for file 07. The Swordfight-L8FGBKpIMzc.mp4

and the script exits.
No output for files whose names do not even appear in the ERRORS file.

Clearly, there is a problem with the shell reading the file names from 
stdin.
But I have no idea why it is failing to read '/some/' file names

Only 3 wav files created:

$ ll *wav
-rw-rw----. 1 jd jd 16515150 Dec 25 11:30 01. Once Upon A Time... 
Storybook Love-fEN1CxYdQGE.wav
-rw-rw----. 1 jd jd 16347214 Dec 25 11:30 03. Florin Dance-ri7q63uaKqU.wav
-rw-rw----. 1 jd jd 28872782 Dec 25 11:30 07. The Swordfight-L8FGBKpIMzc.wav

So, could someone zero in on the script and see what I am missing?
`Cause I cannot see what's wrong.

Thanx!

JD


More information about the ffmpeg-user mailing list