Tuesday, January 7, 2014

Notify relay redirect name hashing

In latest master I implemented name MD5 hashing when notify_rely_redirect on is used. In previous versions remote URL was used as new stream name in this case. That introduced problems with recording and HLS/DASH since such names may not be permitted as file names.

Sunday, December 29, 2013

Happy streaming in 2014!

My son Andrew


Thanks to Adrian Drzewicki (webina.rs project) for the amazing t-shirt.

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;
    } 
  }
}

Saturday, December 21, 2013

Arutcam, MPEG-DASH and stat

In nginx-rtmp-module version 1.0.9 I've implemented parsing H264 SPS block. Now it's possible to see video dimensions even if no RTMP metadata came from publisher. It's important for arutcam which does not generate such metadata. In earlier versions this prevented MPEG-DASH engine from generating valid initialization fragment.

Stat page is updated as well with smart codec names and profiles.

Tuesday, November 26, 2013

Nginx-rtmp-module 1.0.7 with exec pull

I've merged updated exec engine with exec_pull enabled into master and tagged v1.0.7. Updated directives page now contains entries for new exec_pull and exec_options directives.

If you update from old version please make sure you reconfigure nginx. The new version has one file deleted, so you'll get an error otherwise.

Friday, November 22, 2013

MPEG-DASH live streaming in nginx-rtmp-module

I'm pleased to announce MPEG-DASH support in nginx-rtmp-module. Browser-side support in implemented in dash.js library.

Setting up nginx-rtmp-module


Check out dash branch of nginx-rtmp-module. Dash configuration is similar to HLS
location /dash {
  root /tmp;
}

...

application myapp {
  live on;
  dash on;
  dash_path /tmp/dash;
}
Dash module will create m4v, m4a, mpd files in its directory.

Setting up dash.js

  • Check out live branch of my dash.js fork
  • Set up nginx location serving dash.js contents and prepare streaming html. For this purpose modify (or copy) baseline.html in dash.js root and put your mpd (dash playlist) url in it instead of the default one
  • Open that html in browser and watch the stream published to nginx-rtmp-module


Issues

  • I only tested DASH streaming in Chrome, it seems other browsers are poorly supported now. However I need feedback about other browsers.
  • Video should be h264 encoded with Baseline profile. Other profiles will not work! Audio is AAC.
  • Vanilla dash.js does not play live streams well. I've submitted pull request to the project.

I want to thank Stephen Basile for his great work on dash module! He implemented all basic MPEG-DASH stuff including protocol manifest and mp4 writer.