2
votes

I am using nginix web server and nginx-rtmp module for managing my video stream encoded in h264. Here is my nginx conf:

rtmp {
server {
    listen 1935;

    application big {
        live on;

    exec ffmpeg -re -i rtmp://localhost:1935/$app/$name -vcodec 
         libx264 -vprofile baseline -acodec libvo_aacenc -ac 1 -ar 441000 
         -f flv rtmp://localhost:1935/hls/${name};
      }
   }

   application hls
   {
      live on;
      hls_path /usr/local/nginx/html/video;
   }
}

it works well in browser, however because my mobile client is Adobe Air it would only work on Android but not Apple, because Apple doesn't support H264 encoding through AIR applications, so I was trying to transcode the stream to something supported for example mpeg. And this is how I changed my ffmpeg:

    exec ffmpeg -re -i rtmp://localhost:1935/$app/$name -vcodec 
         mpeg2video -acodec copy -b:v 10M -b:a 128k 
         -f mpegts rtmp://localhost:1935/hls/${name};

However it just won't show the video not in a browser nor on device, my assumption is that it probably failed to transcode.

Maybe I am missing something ? Any ideas are highly appreciated. Thank you.

1

1 Answers

0
votes

You probably got your answer already, but just in case:

You are not using the module properly, 1) On iOS you need to point your browser to http://localhost:80/hls/${name} to get the HLS stream. 2) You are missing in the config the http section to generate the HLS stream

See here for details: How can we transcode live rtmp stream to live hls stream using ffmpeg?