sergey-dryabzhinsky / nginx-rtmp-module

NGINX-based Media Streaming Server
http://nginx-rtmp.blogspot.com
BSD 2-Clause "Simplified" License
1.02k stars 216 forks source link

exec doesn't seem to work #222

Open lwilletts opened 7 years ago

lwilletts commented 7 years ago

Using following rtmp block, the exec command to run ffmpeg to transcode the stream seemingly does nothing. I might have made a mistake in the configuration, but I'm attempting to take the input from the application livestream, transcode the stream to lower quality, and then push to twitch. FFmpeg doesn't seem to even be started as I've tried using redirects to get an output to go to a file, but the file doesn't get created and there is no evidence of the ffmpeg process running on the system.

matiaspl commented 7 years ago

Double check you have a semicolon trailing your ffmpeg command, and that you supply the full path to the ffmpeg binary in your exec.

Matt

20.02.2017 19:51 "Laurence Willetts" notifications@github.com napisał(a):

Using following rtmp block https://paste.ngx.cc/aa, the exec command to run ffmpeg to transcode the stream seemingly does nothing. I might have made a mistake in the configuration, but I'm attempting to take the input from the application livestream, transcode the stream to lower quality, and then push to twitch. FFmpeg doesn't seem to even be started as I've tried using redirects to get an output to go to a file, but the file doesn't get created and there is no evidence of the ffmpeg process running on the system.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/sergey-dryabzhinsky/nginx-rtmp-module/issues/222, or mute the thread https://github.com/notifications/unsubscribe-auth/AB049nmgMucJQvaEELgXtBzpOtWxBBwWks5reeCdgaJpZM4MGg9Q .

lwilletts commented 7 years ago

Confirmed, full path being supplied makes no difference. Semicolon is definitely there as nginx wouldn't load the config otherwise.

matiaspl commented 7 years ago

What's showing up in your access and error log? Any sight of exec being fired?

Matt

20.02.2017 23:38 "Laurence Willetts" notifications@github.com napisał(a):

Confirmed, full path being supplied makes no difference.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/sergey-dryabzhinsky/nginx-rtmp-module/issues/222#issuecomment-281198367, or mute the thread https://github.com/notifications/unsubscribe-auth/AB049njBWqYmp7lugVNkbaloj55HqQ5oks5rehXsgaJpZM4MGg9Q .

lwilletts commented 7 years ago

Sorry for the delayed response. It seems running exec does not fire ffmpeg at all. No mention of this being made in either the access or error log whatsoever. I am at a loss of ideas to why it isn't working and thinking of instead just hammering out a shell script to fire ffmpeg and output to a separate app when the PUBLISH notification to 'livestream' in access.log is fired. However this is super messy and would prefer to try and get exec to fire ffmpeg.

EDIT: my mistake, PUBLISH log only is shown when stream ends. Need a way to know when the stream starts to fire automatically.

codegastudio commented 7 years ago

Hello, I don't know if you have solved your problem but in my case i did it by adding absolute path off ffmpeg command

application src {
        live on;

        exec /usr/local/bin/ffmpeg -i rtmp://localhost:1935/src/$name 
        -c copy -b 128K -f flv rtmp://localhost:1935/hls/$name_low 
        -c copy -b 256k -f flv rtmp://localhost:1935/hls/$name_mid 
        -c copy -b 512K -f flv rtmp://localhost:1935/hls/$name_hi 
        -c copy -f flv rtmp://localhost:1935/dash/$name;

        allow publish 127.0.0.1;
        deny publish all;
    }

Hope this will help you