Q:

System.cmd avoid pushing to logs

I'm running a bash command in Ubuntu via System.cmd:
System.cmd("ffmpeg", ["-i", video_path, "-ss", thumbnail_time, "-vframes", "1", "-f", "image2", temp_path])

Unfortunately, system output is so heavy so I don't want to see it, especially in my tests. How can I make System.cmd doesn't appear in my logs?

A:

The reason you're getting output from ffmpeg in your terminal even though System.cmd/3 is supposed to return the output of the command as a binary is that by default System.cmd/3 does not capture stderr output.
One way to fix this is to ask System.cmd/3 to capture stderr too. You can do that by passing stderr_to_stdout: true as the third argument:
System.cmd("ffmpeg"‌​, ["-i", video_path, "-ss", thumbnail_time, "-vframes", "1", "-f", "image2", temp_path], stderr_to_stdout: true)

Another way is to lower the log level of ffmpeg so that it doesn't log as many things as it does by default. You can do this by adding 2 parameters to the start: "-loglevel" and one of "quiet",  "panic", or any other log level you want. "quiet" will send absolutely no output to stderr, even if the command doesn't run successfully. These are documented in the ffmpeg's man page.

