Compile Ffmpeg in Ubuntu and summarize stream playback implementation

Source: Internet
Author: User
After studying for a week, I finally set up the server today. I am comfortable, So to sum up, the operating system I use is: Ubuntu9.10 I refer to here to install the compiled plug-ins, but some plug-ins cannot be installed, note: If the command makeinstall fails in Ubuntu, use sudomakeinstall to run the command with the root permission, because some common users of directories cannot create the basic compilation process and the price package to be installed. The above blog is very detailed.

After studying for a week, I finally set up the server today.

My operating system is: Ubuntu 9.10

I refer to here to install the compiled plug-ins, but some plug-ins cannot be installed,

Note: If the command make install fails in Ubuntu, use sudo make install to run the command with the root permission, because some common users cannot create directories.

The basic compilation process and the price package to be installed are described in detail in the above blog. There are also many tutorials on the Internet,

1. Install the required tools and libraries for compilation:

(1) run the following command:

Sudo apt-get purge ffmpeg x264 libx264-dev

Clear the original installation package

(2) run the following command:

Sudo apt-get install build-essential subversion git-core checkinstall yasm texi2html libfaac-dev libfaad-dev libmp3lame-dev libsdl1.2-dev libtheora-dev libx11-dev libxvidcore4-dev zlib1g-dev

Ii. Compile and install the x264 Library

Git clone git: // git.videolan.org/x264.git

Cd x264

./Configure

Make

Sudo make install

Sometimes, you can use the new IDE software installer for installation.

3. Compile and install ffmpeg:

Svn checkout svn: // svn.ffmpeg.org/ffmpeg/trunk ffmpeg

Cd ffmpeg

. /Configure-enable-gpl-enable-nonfree-enable-pthreads-enable-libfaac-enable-libfaad-enable-libmp3lame-enable-libtheora-enable-libx264-enable-libxvid-enable-x11grab-enable-libopencore -amrnb-enable-libopencore-amrwb-enable-libopencore-amrnb-enable-version3

Make

Sudo make install

I encountered a strange problem here. The compilation was successful, but the compiled ffmpeg had a problem and an error occurred while decoding the streaming media. So I manually downloaded the ffmpeg source code package from the official website.

After the compilation is complete, enter the command ffserver, ffmpeg, and ffplay and you will be prompted to describe where the installation is complete, generally under/usr/local/bin. /configure parameter specified

Next, we will use ffserver, ffmpeg, and ffplay to play the time stream.

Step 1:

Ffserver. conf configuration

Port 8090

BindAddress 0.0.0.0

# MaxHTTPConnections 2000

MaxClients 1000

MaxBandwidth 1000

CustomLog-

NoDaemon

File "test. flv"

Format flv

File "blurrent"

Format flv

File/tmp/feed1.ffm

FileMaxSize 2 M

ACL allow 127.0.0.1

Feed feed1.ffm

Format flv

The URL http://www.ffmpeg.org/

Parameter description:

I have created three streams above. Blue and testflv are both directly created using local files.

File "blurrent"

Format flv

Create a stream, Blue, and play it in flv format.

Feed feed1.ffm>

File/tmp/feed1.ffm

FileMaxSize 2 M

ACL allow 127.0.0.1

Indicates creating a buffer zone under/tmp/. The size of feed1.ffm is 2 MB, which can be modified as needed.

ACL allow 127.0.0.1 indicates the IP address that can be accessed

Feed feed1.ffm

Format flv

Indicates the stream mytest created with the buffer feed1.ffm.

Do not worry about other things. OK. After ffserver. conf is configured, we start the ffserver server.

Start command:

Open the terminal and enter the ffserver-f ffserver. conf command to start ffserver

Note that the path of your ffserver. conf is usually run by the terminal in the current ffserver. conf folder.

After the startup is successful, you don't need to worry about it. We can start another terminal test to check whether the configuration is successful.

Input:

Ffplay http: // localhost: 8090/Blue

Or

Ffplay http: // localhost: 8090/testflv

If the video can be played normally, it indicates that the configuration is successful.

Now we need to use ffmpeg to import data words into the buffer zone feed1.ffm.

Note: because our current cache is only 2 MB, when the buffer content is full, it will automatically Overwrite

Open a new terminal:

Input: ffmpeg-I inputfile-an http: // localhost: 800/feed1.ffm

Start ffmpeg

Inputfile is the input file name. To achieve the video playing effect, I used an mp4-format movie, which was written into the buffer zone feed1.ffm.

If there is no problem, the data will be converted, and the conversion will continue. It means that the conversion is in progress. I just started to download the version with svn, and there is a problem with the execution here, after downloading an ffmpeg source code package from the official website, the package runs successfully.

Okay. Now let's test it with ffplay.

Enter ffplay http: // localhost: 8090/mytest

OK to achieve the desired effect .. If you have any questions, please contact me.

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.