[FFmpeg-user] Converting mkv to mp3 failures
forbyta at gmx.com
Fri Jul 14 02:24:54 EEST 2017
On Fri, 14 Jul 2017, Moritz Barsnick wrote:
>> done < VIDEO_FILES > FFMPEG_ERRORS 2>&1
> I don't know why, but I have seen it before, and the '< VIDEO_FILES' may
> be flooding ffmpeg's stdin. Do try "-nostdin".
This is a common problem with bash/sh and "while" loops. The while loop
is reading from STDIN and any commands within the loop are reading from
the SAME STDIN. When you redirect STDIN to the while loop, you also
redirect it to the commands within the loop. In this case, that means
both the while loop and ffmpeg are competing to read from "VIDEO_FILES".
As you suggest, -nostdin should fix this... it'd think anyway. If not, it
should work to redirect STDIN to the ffmpeg command, eg:
ffmpeg ... < /dev/null
done < SOME_FILE
If you really need the command within the loop to read from STDIN, then
you need to get trickier and start playing around with file descriptors.
A better option is just to use perl or some other scripting language that
handles this better.
More information about the ffmpeg-user