=====================================================
The simplest example of a ffmpeg-based mobile Sample series article List:
The simplest mobile-based example of FFmpeg: Android HelloWorld
The simplest ffmpeg-based mobile sample: Android Video Decoder
Simplest FFmpeg-based mobile sample: Android Video Decoder-Single library version
Simplest FFmpeg-based mobile sample: Android push-to-stream
The simplest ffmpeg-based mobile sample: Android video transcoding
Simplest FFmpeg-based mobile sample attachment: Android comes with player
Simplest FFmpeg-based mobile sample attachment: SDL Android HelloWorld
The simplest ffmpeg-based mobile sample: IOS HelloWorld
The simplest ffmpeg-based mobile sample: IOS Video Decoder
Simplest FFmpeg-based mobile sample: IOS push-to-stream
The simplest ffmpeg-based mobile sample: IOS video transcoding
Simplest FFmpeg-based mobile sample attachment: iOS comes with player
Simplest FFmpeg-based mobile sample: Windows Phone HelloWorld
=====================================================
The previous articles recorded the FFmpeg-based multimedia programs under the Android platform. As a control, this paper records a video player based on Android's own multimedia frame Opencore.
The use of Android's own multimedia framework is much simpler than porting ffmpeg, and it takes only a few interface functions to control the playback of the video. Do not record too much of its usage.
Source
The folder structure of the project is seen.
Java source code is located in the SRC folder.
The Java side code of the Android program is located in Src\com\leixiaohua1020\sandroidplayer\mainactivity.java. For example, see below.
/** * * The simplest android video player * simplest android player * * Lei hua Lei xiaohua * [email protected] * Communication University/Digital TV technology * Communication Un Iversity of China/digital TV technology * http://blog.csdn.net/leixiaohua1020 * * This program is a video player based on the Android interface. * * Video player based on Android API. * */package Com.leixiaohua1020.sandroidplayer;import Android.os.bundle;import Android.os.environment;import Android.app.activity;import Android.util.log;import Android.view.menu;import Android.view.view;import Android.view.view.onclicklistener;import Android.widget.button;import Android.widget.edittext;import Android.widget.videoview;public class Mainactivity extends Activity {@Override protected void onCreate (Bundle saved Instancestate) {super.oncreate (savedinstancestate); Setcontentview (R.layout.activity_main); final Videoview videoview = (videoview) Findviewbyid (R.ID.VIDEOVIEW1); Button Setbutton = (button) This.findviewbyid (R.id.button_set); Button Startbutton = (button) This.findviewbyid (R.id.button_start); Button Pausebutton = (button) This.findviewbyid (R.id.button_pause); Button Stopbutton = (button) This.findviewbyid (r.id.button_stop); final EditText urledittext= (EditText) This.findviewbyid (R.id.input_url); SetbutTon.setonclicklistener (New Onclicklistener () {public void OnClick (View arg0) {String folderurl= Environment.getexternalstoragedirectory (). GetPath (); String Urltext=urledittext.gettext (). toString ();//small FIX, Avoid '/' if (urltext.charat (0) = = '/') {urltext= Urltext.substring (1);} String inputurl=folderurl+ "/" +urltext; LOG.E ("url", Inputurl); Videoview.setvideopath (Inputurl);//videoview.setmediacontroller (new Mediacontroller (MainActivity.this));}); Startbutton.setonclicklistener (New Onclicklistener () {public void OnClick (View arg0) {Videoview.start ();}}); Pausebutton.setonclicklistener (New Onclicklistener () {public void OnClick (View arg0) {videoview.pause ();}}); Stopbutton.setonclicklistener (New Onclicklistener () {public void OnClick (View arg0) {videoview.stopplayback ();}}); } @Override Public boolean Oncreateoptionsmenu (Menu menu) {//Inflate the menu, this adds items to the A Ction Bar if it is present. Getmenuinflater (). Inflate (R.menu.main, menu); return true; } }
Execution results
The results of the app's execution on the phone, for example, are seen. Click "Set", "Start", "Pause" and "Stop" buttons to perform different actions on the video.
Note that you need to copy the video files waiting to be played to the corresponding folder in the memory card. For example, for the following situations. You need to copy the Sintel.mp4 to the root folder of the memory card.
Download
simplest ffmpeg mobile
Project Home
Github:https://github.com/leixiaohua1020/simplest_ffmpeg_mobile
Open source China: https://git.oschina.net/leixiaohua1020/simplest_ffmpeg_mobile
sourceforge:https://sourceforge.net/projects/simplestffmpegmobile/
CSDN Project: http://download.csdn.net/detail/leixiaohua1020/8924391
This solution includes various examples of using FFMPEG to process multimedia on the mobile side:
[Android]
Simplest_android_player: Android interface-based video player
Simplest_ffmpeg_android_helloworld: FFmpeg-based HelloWorld program under Android platform
Simplest_ffmpeg_android_decoder: The simplest ffmpeg-based video decoder on the Android platform
Simplest_ffmpeg_android_decoder_onelib: The simplest ffmpeg-based video decoder on the Android Platform-Library edition
Simplest_ffmpeg_android_streamer: The simplest ffmpeg-based push-to-flow device under the Android platform
Simplest_ffmpeg_android_transcoder: FFmpeg command-line tool ported under Android platform
Simplest_sdl_android_helloworld: The simplest program for porting SDL to the Android platform
[IOS]
Simplest_ios_player: Video player based on iOS interface
HelloWorld program based on FFmpeg under the Simplest_ffmpeg_ios_helloworld:ios platform
The simplest ffmpeg-based video decoder under the Simplest_ffmpeg_ios_decoder:ios platform
The simplest ffmpeg based on the Simplest_ffmpeg_ios_streamer:ios platform
FFMPEG.C command-line tool ported under Simplest_ffmpeg_ios_transcoder:ios Platform
Simplest_sdl_ios_helloworld: The simplest program to migrate SDL to the iOS platform
Simplest FFmpeg-based mobile sample attachment: Android comes with player