Create a FFMPEG + SDL media player on Android

Source: Internet
Author: User

We want to develop our own media player on Android. The first thing we want to think of is to use FFMPEG for implementation. FFmpeg is a cross-platform failover function. We can call the APIS provided by FFMPEG to complete the process. In addition, FFMPEG provides a small program ffplay, which itself is a media player, so we plan to use ffplay as the program's basis.

Below is the development environment I used this time:

-Android ndk: android-ndk-r4b-windows
-FFMPEG: 0.6.1
-SDL: 1.2.14

Step 1
First, create an android project.

Step 2
Create a resource $ (Project)/JNI/libs, and then test [Integrate FFMPEG to Android platform] And libavcodec. a. libavformat. a. libavutil. a. libpostproc. A And libswscale. a. Copy now.

Step 3
From the ffplay program example, you can find that the SDL function is used in the content. Because FFMPEG only supports video decoding, if you want to upload the obtained image information to the screen or play the audio, in this case, SDL is required to help you send the data to device. You can test [Integrate SDL into the Android platform] and copy libsdl. A to $ (Project)/JNI/libs.

Step 4
Put ffplay. C, cmdutils. C, and cmdutils. h under $ (Project)/JNI, and then create a makefile:

Target = libjniomx. So
Sources = $ (wildcard *. c)
Cflags =-I .. /.. /.. /build/platforms/tegra/include/openmax/il/-I/usr/local/include/SDL/-I. /FFMPEG/-STD = c99
Ldflags =-lstdc ++-LC-lm-llog-lnvomx-lavformat-lavcodec-lavutil-lswscale
Ldflags + =-L./FFMPEG/libs/-lsdl
Include ../build. mk

Step 5
Run make under $ (Project)/JNI and build the project through eclipse.

Step 6
When you install it on the Android platform, you will find that the program cannot run. We can use the debug mode to check the problem. The following message is displayed at this time:

No available video device

The trace program will get the loss of the startup/dev/graphics/fb0.

Step 7
The following links are taken as an example:
In Linux, framebuffer may have permission issues during access, so our program cannot run normally.

Step 8
Conclusion: Media Player Based on FFMPEG and SDL cannot be used on the Android platform.


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: 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.