Use FFmpeg to push rtmp streams under Windows platforms

Source: Internet
Author: User

Use FFmpeg to push rtmp streams under Windows platforms

It's customary to use ffmpeg to simulate push rtmp streaming under Linux, but the home computer is a Windows system that needs to use the bandwidth in the home to test the performance of the streaming media server. So we've studied how to push the stream quickly in Windows systems.

First Download Install FFmpeg

Download the FFmpeg compression package under Windows, unzip it to the current directory, see (How to upload the image quickly and uploaded?). )

We are using the Ffmpeg.exe file under the Ffmpeg-20180429-19c3df0-win64-static\bin path.

Write two scripts to implement push flow

You can use Windows batch or PowerShell scripts, but you have to implement two copies, so it's best to reuse shell scripts under Linux.

Installing Cygwin

Download the installation Cygwin.

Two X Cygwin commands
    • Jump to another drive letter

$ cd /cygdrive/f

    • Set the environment variable to add the bin directory of the ffmpeg to the environment variable

$ export PATH=$PATH:/cygdrive/f/Harlan/Software/ffmpeg-20180429-19c3df0-win64-st atic/bin/

Cyclic push-stream shell script

Create a shell script file pushstream.sh, which reads as follows

#!/bin/bashfor((;;)); do ffmpeg -re  -i "..\videos\test-$1.mp4"  -c copy  -f flv "rtmp://stream_media_server_address:1935/live/test-$1/test-$1"sleep 1; done

Note Add a parameter of $.

A shell script that pushes a multi-channel stream

Start the process of pushing the stream as a daemon and create a script push_all.sh:

#!/bin/bashsetsid ./pushstream.sh 20 >/dev/null 2>&1 < /dev/null &setsid ./pushstream.sh 30 >/dev/null 2>&1 < /dev/null &setsid ./pushstream.sh 40 >/dev/null 2>&1 < /dev/null &setsid ./pushstream.sh 60 >/dev/null 2>&1 < /dev/null &

Execute the following command to start the script:

$ ./push_all.sh

You can see that there are four streams in the background while pushing:

Using ffmpeg to push rtmp streams under Windows platforms

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.