Build SDL + FFmpeg on Ubuntu

Source: Internet
Author: User
In UbuntuLinux installed ffmpeg loaded sdl, compiled and run ffplay. c. tutorial01-08.c. The process record is as follows: 1. Install ffmpeg, is a naked, Haha, I did not load anything. If you are just getting started, there is no need to install so many options. You can add the options later. Currently, I only want to read the source code. 2. Install SDL: Because there is SDL in ubuntu, you can simply enter the following in the Command window: s

Install ffmpeg in Ubuntu Linux to load sdl, compile and run ffplay. c. tutorial01-08.c. The process record is as follows:

1. Install ffmpeg, which is a naked figure. I didn't load anything. If you are just getting started, there is no need to install so many options. You can add the options later. Currently, I only want to read the source code.

2. Install SDL:

Because SDL exists in ubuntu, you can simply enter the following in the Command window:

Sudo apt-get install libsdl1.2-dev libsdl-image1.2-dev libsdl-ttf2.0-dev libsdl-mixer1.2-dev libsdl-net1.2-dev libsdl-sound1.2-dev

Check if the SDL has been installed: sdl-config -- exec-prefix -- version -- cflags

2) ffmpeg does not talk about it anymore. There are a lot of online information and complicated steps. I installed a naked image.

Download source code
./Configure -- enable-shared -- enable-pthreads
Make

Make install

3. Compilation commands for files are complex:

Typical Example:

Gcc-o player ffplay. c cmdutils. c-I/home/han/soft/ffmpeg_src-lavformat-lavcodec-lavcore-lavdevice-lavfilter-lswscale-lavutil-I/usr/include/SDL-lSDL-lSDLmain

-Lm-lz

Or

Gcc-o tutorial07 tutorial07.c-lavformat-lavcodec-lavcore-lavdevice-lavfilter-lswscale-lavutil-lz-lm 'sdl-config -- cflags -- libs'

-Lz download:

Such errors:

/Usr/bin/ld: cannot find-lz
Collect2: ld returned 1 exit status
This is because the libz library is missing

I solved it like this: Enter the: apt-get install zlib1g-dev directly in the namespace

/Usr/bin/ld: cannot find-l * error solution ......

You can solve this problem by using this method (this is the case when I come across several ):
Yum-y install libtool-l *
For example:
/Usr/bin/ld: cannot find-lltdl
Solution:
Yum-y install libtool-ltdl *
 
-Lm: internal libraries of some mathematical formulas and other systems.

When the ffmpeg tutorial is compiled, the rint function error occurs: you only need to comment it out:

/*

Int rint (int x)

{

Return (int) (x + (x <0? -0.5: 0.5 ));

}

*/

Additional: it is best to test the movie. mpg file.

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.