Wednesday, April 24, 2013

Shell-style exec redirects in 0.9.17

The new feature is shell-style redirects in exec-family directives. Now you can save ffmpeg (or any other executed child) output in file and pass input to it (makes no sense with ffmpeg however).

application myapp {
live on;
exec ffmpeg -i rtmp://localhost/myapp/$name -c copy
-f flv rtmp://$name 2>>/var/log/ffmpeg-$name.log;

Now you have a single log file like /var/log/ffmpeg-mystream.log for each stream where you can find all ffmpeg output including errors. You can redirect stdout (1>/var/log/ffmpeg-$name.out) and any other stream (1>&2) as well. Both truncate > and append >> modes are supported as well as usual variable substitutions .