By using AWS re:Post, you agree to the Terms of Use
/push browser camera to aws rtmp server/

push browser camera to aws rtmp server

0

i am using python and in frontend javascript.

I am using ffmpeg to push video to rtmp server.

ffmpeg -y -f mp4 -stream_loop -1 -re -i myvideo.mp4
-b:v 3M -vcodec libx264 -r 30.0 -s 1280x720
-c:a copy -b:a 96k
-f flv "rtmps://dfdf222.global-contribute.live-video.net:443/app/"

I test with OBS software, it is working well. It is working well but I am not getting how to push to rtmp server of my browser camera? i mean from javascript?

i am trying like this:

<body>
    <video id="vid" autoplay></video>

    <a href="#" onclick="streamVideo()">open and stream</a>

    <script>
        function streamVideo () {
            console.log('ddd')
            navigator.mediaDevices.getUserMedia({
            video: {

            },
            audio: {
                
            }
            }).then(stream=>{
                console.log(stream)
                document.getElementById('vid').srcObject = stream; 
            })

        }
    </script>
</body>

It is working but not getting any way to push from browser to rtmp server. I know browser doesnt support rtmp protocol, we need to send it from the backend but can I push it to the server so that it pushes to rtmp server?

Does anyone know the way?

1 Answers
-1

Hi,

You may have to include both Stream URL and the Stream key in the FLV endpoint:

Example FFmpeg command:

ffmpeg -re -1 -i $VIDEO_FILEPATH -r 30 -c:v libx264 -pix_fmt yuv420p -profile:v main -preset veryfast -x264opts "nal-hrd=cbr:no-scenecut" -minrate 3000 -maxrate 3000 -g 60 -c:a aac -b:a 160k -ac 2 -ar 44100 -f flv rtmps://**INGEST_ENDPOINT**:443/app/**STREAM_KEY**

Please refer the following document for more details: https://docs.aws.amazon.com/ivs/latest/userguide/getting-started-set-up-streaming.html#ffmpeg

answered 14 days ago
  • Hi, You have not understand questions, i am not streaming recorded videos ! I want to live stream my webcam. like when user signup to my application, they can go live. but I am not getting any way to push from browser to rtmp. can you please help in this case?

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions