On Mar 10, 7:53=A0pm, Lance Ivy <la... / cainlevy.net> wrote:
> I'm encoding videos from a background process and found a video where
> the audio sync is off ... but only when the encoder is run inside a
> daemon. After some work boiling down the Daemons code, I was able to
> reduce the entire problem down to this:
>
> http://pastie.org/863675
>
> I haven't simplified the ffmpeg command itself because eventually I
> began using the resulting file size to indicate the problem. When line 4
> is commented out and the audio syncs correctly, the file size is about
> 7400 bytes larger.
>
> What I don't understand is how STDIN.reopen could have any effect on the
> ffmpeg command. I tried directing the first-pass ffmpeg output to a
> standard file instead of /dev/null, but it made no difference. I also
> tried changing STDIN.reopen to a temporary file ... no difference.
>
> Could anyone with deeper knowledge shed some light on the problem, or
> suggest further tests?

Why are you messing with the inherited STD handlers? Can't you
redirect ffmpeg output to /dev/null using pipes?

ffmpeg .... > /dev/null 2>&1

That will redirect STDOUT (1) and STDERR (2) to /dev/null

http://blog.segment7.net/articles/2006/08/17/stdout-vs-stdout

--
Luis Lavena