Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 510
Macchiato Avatar asked Feb 14 '12 04:02

Macchiato


People also ask

What is FFmpeg library?

FFmpeg is a free and open-source software project consisting of a suite of libraries and programs for handling video, audio, and other multimedia files and streams. At its core is the command-line ffmpeg tool itself, designed for processing of video and audio files.

How do I combine two videos in android programmatically FFmpeg?

ffmpeg -f concat -i mylist.txt -c copy output.mp4 This process is a way of concatenating the files and not re-encoding. Hence, it should be done speedily & conveniently. If there is no error message, you are sure to receive a final merged video named by 'output. mp4' in the MP4 folder.


1 Answers

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.

like image 66
Andrew Avatar answered Sep 17 '22 22:09

Andrew