Sunday, December 29, 2013

One common exec issue

I'm often asked to help with exec directive not starting child ffmpeg (or any other process). One common error is the following

  • ffmpeg is NOT in /bin or /usr/bin
  • full path is not specified in exec, only binary name

In this case exec will not start child process because nginx wipes its environment before starting workers. So child processes have empty PATH variable and cannot find the executable. In such cases the binary is usually looked up in default locations like /bin or /usr/bin.

To solve the issue please add env PATH directive to nginx.conf. It will preserve PATH environment variable.


...
# keep $PATH
env PATH;
...

rtmp {
  server {
    listen 1935;
    application myapp {
        live on;
        exec ffmpeg -i rtmp://localhost/myapp/$name
                    -c copy -f flv rtmp://localhost/app2/$name;
    }
    application app2 {
      live on;
    } 
  }
}

1 comment:

  1. Experience the flavors of Ukraine at a top-rated "Ukrainian restaurant NYC." Nestled in the heart of the city, this culinary gem offers a delectable menu of traditional Ukrainian dishes prepared with the finest ingredients and authentic recipes. From hearty soups and stews to mouthwatering dumplings and savory meat dishes, each bite is a tantalizing taste of Eastern European cuisine. Whether you're a longtime fan of Ukrainian food or new to its delights, this restaurant promises a dining experience that's both delicious and memorable.

    ReplyDelete