0
votes

I currently have a nginx server setup with the rtmp plugin for video streaming. I'm streaming to it with ffmpeg and then displaying the stream on a web browser with adobe flash player.

I have the video streaming successfully but I have not been able to get audio.

This is the ffmpeg command I use to start the stream

ffmpeg -f video4linux2 -s 320x240 -r 16 -i /dev/video0 -f alsa -i hw:0 -an -f flv rtmp://123.456.789.51:31002/rover/mystream

The stream then goes to nginx which is running on this conf file

worker_processes  1;

error_log  logs/user/error.log debug;

events {
    worker_connections  1024;
}

rtmp {
    server {
        listen 31002;

        application rover {
            live on;
            #meta copy;
            #interleave on;
            allow publish all;
            allow play all;

            hls on;
            #record keyframes;
            #record_path /tmp;
            #record_max_size 128K;
            #record_interval 30s;
            #record_suffix .this.is.flv;

            #on_publish http://localhost:8080/publish;
            #on_play http://localhost:8080/play;
            #on_record_done http://localhost:8080/record_done;
        }
    }
}

http {
    server {
        listen      26360;

        location /stat {
            rtmp_stat all;
            rtmp_stat_stylesheet stat.xsl;
        }

        location /stat.xsl {
            root nginx-rtmp-module-master/;
        }

        location /control {
            rtmp_control all;
        }

        #location /publish {
        #    return 201;
        #}

        #location /play {
        #    return 202;
        #}

        #location /record_done {
        #    return 203;
        #}

        location /rtmp-publisher {
            root /path/to/test;
        }

        location / {
            root nginx-rtmp-module-master/test/www;
        }
    }
}

I then access the stream from a browser using this set up for the adobe flash player and strobe media player.

<object width="470" height="320">
    <param name="movie" value="http://osmf.org/dev/2.0gm/StrobeMediaPlayback.swf">
    </param>
    <param name="flashvars" value="src=rtmp%3A%2F%2F184.173.103.51%3A31002%2Frover%2Fmystream&autoPlay=true"></param>
    <param name="allowFullScreen" value="true"></param>
    <param name="allowscriptaccess" value="always"></param>
    <param name="wmode" value="direct"></param>
    <embed src="http://osmf.org/dev/2.0gm/StrobeMediaPlayback.swf" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" wmode="direct" width="470" height="320" flashvars="src=rtmp%3A%2F%2F184.173.103.51%3A31002%2Frover%2Fmystream&autoPlay=true"></embed>
</object>

Could I get some suggestions as to how I couldn't be getting audio? I'm streaming video from my webcam and specifying audio from my mic.

1

1 Answers

5
votes

Do you know what "-an" option is in ffmpeg? If you want audio, you should not use it.