Macchiato
Macchiato

Reputation: 815

How to play video using FFMPEG library in Android?

I was able to build ffmpeg library by using rock player build script.

Now I have this .so file, how do I play video? And I want to display this video inside a small LinearLayout in my Activity.

Is it possible?

Update: I know that it's easy to play video using VideoView or MediaPlayer + SurfaceView. I just wanted to understand more about ffmpeg library and how to display the frames inside an Android Activity.

Upvotes: 17

Views: 18265

Answers (3)

Andrew
Andrew

Reputation: 742

Have a look at this player: https://github.com/bbcallen/ijkplayer

Basically what you need to do is build a JNI interface through to the MediaPlayer class (or possibly ExoPlayer in newer Android though I haven't done this yet).

If you look at the repo link you will see that this needs to be done on top of ffplay more than ffmpeg as the former is the player and the latter the decode/encode/package tool.

Upvotes: 2

Alex Cohn
Alex Cohn

Reputation: 57173

See for example an Android app in github: https://github.com/havlenapetr/FFMpeg. This project may be somewhat outdated, but its part that is responsible for video display is quite understandable. You can look for more recent contributions on github.

Upvotes: 0

Kevin Parker
Kevin Parker

Reputation: 17206

There are a few ways of doing this. You should have a look at Dolphin Player, an open source media player for Android. Its actually rather complex, you could also look at the VLC source code which makes use of FFMPEG but VLC is an extensive very complete wrapper to play videos.

Upvotes: 0

Related Questions