Faplayer compilation for Android video players

Source: Internet
Author: User

Some time ago, I was working on a music and video player for Android. The music player has many good open-source projects, and most of them are quite practical. (I will write a special article about the music player when I have time.Article). However, there are not many open-source video projects, mainly related to Android video decoding. Android supports only 3GP and MP4 video formats by default. Therefore, many video players on the market come with third-party decoders. Third-party decoder, mainly FFMPEG and vlc decoder. VLC is developing an android player. You can refer to it later. This time, we mainly used an open-source project faplayer. This open-source project mainly uses VLC as the decoding library. Faplayer currently has simple control functions, but the decoding effect is satisfactory, which is close to the playing effect of mainstream Android video players. Supports conventional video formats.

Although the source code can be downloaded from the website, you need to compile the decoding library with ndk,ProgramTo run. You can use ndk to compile the VLC decoding library in Windows and Linux. However, I have not finished the problem for two days in windows, but I can only compile it in Linux. (cygwin and ndk under windows need to be installed for compiling in windows, and cygwin needs to be installed. It took me one afternoon to install cygwin, it mainly needs to download a lot of data from the network. In this regard, it is faster to directly install UBUNTU ).

The following describes how to use ndk to compile the VLC decoder library in Linux:

1. Use git clone to download the faplayer source code. It is best to use git clone for download. Download the zip package directly, and there is a problem during compilation. You need to modify the include folder.

Git clone https://github.com/tewilove/faplayer.git

 

2. Install ndkr6b

Install Google's ndk. Here I use r6b. The latest Linux version.

Http://dl.google.com/android/ndk/android-ndk-r6b-linux-x86.tar.bz2

 

3. Install Ruby

Install Ruby in Ubuntu: sudo apt-Get install Ruby

 

4. Set the environment variable of the ndk (not necessarily set, set for later use)

Input: sudo gedit/etc/profile. Open the profile file and add

Export ndkpath = "/home/username/ndk dir"

Username = is your user name

Ndk dir = is the root directory of your ndk. The root directory contains the ndk-Build File.

 

Use source/etc/profile on the terminal to refresh the content. Or restart the terminal.

 

Verify that the settings are correct:

Echo $ ndkpath: Enter the path you set if it is set correctly.

CD $ ndkpath jump to the ndk root directory

 

You must set the environment variables. Otherwise, the environment variables cannot be compiled later.

 

5. Modify the build. Sh File

The faplayer root directory contains a build. Sh file to open. Row 4th ndk-build $ @ | Exit 1

Change to $ ndkpath/ndk-build $ @ | Exit 1

It mainly sets the compiled ndk path.

6. Run./build. Sh in the terminal.

This compilation takes about 10 minutes. Compiled in the libs folder, there is a dynamic library of libvlccore. So about 11.3m.

 

Here we also need to note that the above is just to compile the libvlccore. So decoding library. In fact, the faplayer script file build. Sh can compile the entire APK file, but you also need to install ant and Android sdks and configure the relevant development environment. Because I mainly develop Android applications in windows. So as long as I get libvlccore. So, I can copy the project to the window to continue development. Copy the project to window, open it with eclipse, and re-compile it.

 

Build. Sh by default is to compile a dynamic library of the arm-v7 version, if you need to compile in the arm-A9 or below the arm-v7 version, you need to adjust the compilation parameters. It mainly refers to the compilation parameters of Android. mk.

 

Use my mobile phone defy to test the effect of playing well. Come up later ~

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.