ffmpeg and standard file descriptors
I have had problems before with the ffmpeg (http://ffmpeg.org/) libraries assuming that file descriptor 2 is standard error, causing all sorts of strange errors when actually it is pointing to something else. In my case it was in use as mapped memory so ffmpeg ended up writing diagnostic messages directly over my memory blocks.
Well it seems that similar issues happen with standard input and the ffmpeg tool. In interactive use it will print out a prompt asking you to press 'q' to abort encoding. If you run it from a script that has had all the file descriptors closed (as they don't need to be open and all output is via syslog) then sometimes (but not always) ffmpeg will just abort half way through the encoding process. However it will not issue an error or a bad status. It just stops as if you had pressed 'q' leaving a somewhat shrunken video file as a result.
I cannot find any way of preventing this interactive behaviour when run in batch mode and it doesn't seem to be smart enough to detect the absence of a terminal and avoid being interactive. It appears the only way to prevent getting short files is to open a fake file descriptor 0 so that ffmpeg thinks somewhere is there watching it. Not an ideal solution.
- admin's blog
- Login or register to post comments
