The simplest example of a mobile terminal based on FFmpeg: IOS video Transcoder and ffmpegios
========================================================== ==================
List of the simplest FFmpeg-based mobile-end example series:
The simplest Mobile End example based on FFmpeg: Android HelloWorld
The simplest example of mobile terminal based on FFmpeg: Android Video Decoder
The simplest example of mobile terminal based on FFmpeg: Android video decoder-single library version
The simplest Mobile End example based on FFmpeg: Android streamer
The simplest example of a mobile terminal based on FFmpeg: Android video Transcoder
The simplest Mobile End example based on FFmpeg attachment: built-in player for Android
The simplest example of FFmpeg-based mobile terminal attachment: SDL Android HelloWorld
The simplest Mobile End example based on FFmpeg: IOS HelloWorld
The simplest example of mobile terminal based on FFmpeg: IOS Video Decoder
The simplest example of Mobile End Based on FFmpeg: IOS streamer
The simplest example of a mobile terminal based on FFmpeg: IOS video Transcoder
The simplest example of a mobile terminal based on FFmpeg attachment: built-in player for IOS
The simplest example of FFmpeg-based mobile terminal: Windows Phone HelloWorld
========================================================== ==================
This document records the FFmpeg-based video Transcoder on IOS. The Transcoder is actually transplanted from the ffmpeg. c source code in the ffmpeg project. For the source code of ffmpeg. c, refer to the article "simple analysis (drawing) of ffmpeg. c Function Structure", which will not be repeated here.
Source code
The directory structure of the project.
The following C language files are copied from FFmpeg source code:
Cmdutils. c
Cmdutils. h
Cmdutils_common_opts.h
Config. h
Ffmpeg. h
Ffmpeg_filter.c
Ffmpeg_opt.c
In addition to the header file in the ffmpeg SDK, you also need to copy the following header file from the source code when compiling FFmpeg. c.
Libavformat/ffm. h
Libavformat/network. h
Libavformat/OS _support.h
Libavformat/url. h
Libavutil/libm. h
Fmpeg_mod.c is the modified ffmpeg. c file. Ffmpeg. CIS a program used by the command line. Therefore, you need to modify the source code when calling the code library. For example, remove some exit (0), release some variables, and change the main () function to ffmpegmain.
The Objective-C code that calls FFmpeg is located in the ViewController. m file. The content is as follows.
/*** The Simplest FFmpeg-based Transcoder-IOS * Simplest FFmpeg IOS Transcoder ** Ray Xiaohua Lei Xiaohua * leixiaohua1020@126.com * Ma Xiaoyu * maxiaoyucuc@163.com * China Media University/ digital TV Technology * Communication University of China/Digital TV Technology * http://blog.csdn.net/leixiaohua1020 ** this program is a Transcoder under the IOS platform. It is transplanted to the ffmpeg. c command line tool. ** This software is a Transcoder in IOS. it is transplanted from ffmpeg. c * command line tools. */# import "ViewController. h "# include" ffmpeg. h "int ffmpegmain (int argc, char ** argv); @ interface ViewController () @ end @ implementation ViewController-(void) viewDidLoad {[super viewDidLoad]; // Do any additional setup after loading the view, typically from a nib .} -(void) didReceiveMemoryWarning {[super didreceivemorywarning]; // Dispose of any resources that can be recreated .} -(IBAction) clickRunButton :( id) sender {char command_str_full [1024] = {0}; NSString * command_str = [NSString stringWithFormat: @ "% @", self. command. text]; NSArray * argv_array = [command_str componentsSeparatedByString :( @ "")]; int argc = argv_array.count; char ** argv = (char **) malloc (sizeof (char *) * argc); for (int I = 0; I <argc; I ++) {argv [I] = (char *) malloc (sizeof (char) * 1024 ); strcpy (argv [I], [[argv_array objectAtIndex: I] UTF8String]);} ffmpegmain (argc, argv); for (int I = 0; I <argc; I ++) free (argv [I]); free (argv) ;}@ end
Running result
The result of the App running on the mobile phone is shown in.
After you click the "Run" button, the program performs transcoding Based on the entered command. For example,/Users/leixiao00001020/Desktop/test.mp4 is transcoded to/Users/leixiao00001020/Desktop/test. mov. Shows the generated video file.
Download
Simplest ffmpeg mobile
Project Homepage
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 contains various examples of using FFmpeg to process multimedia on mobile terminals:
[Android]
Simplest_android_player: Android-Based Video Player
Simplest_ffmpeg_android_helloworld: The FFmpeg-based HelloWorld program in Android
Simplest_ffmpeg_android_decoder: the simplest FFmpeg-based video decoder on Android
Simplest_ffmpeg_android_decoder_onelib: the simplest FFmpeg-Based Video Decoder for Android-single library
Simplest_ffmpeg_android_streamer: the simplest FFmpeg-based streamer on Android
Simplest_ffmpeg_android_transcoder: The FFmpeg command line tool transplanted on the Android platform
Simplest_sdl_android_helloworld: the simplest program to port SDL to Android.
[IOS]
Simplest_ios_player: A Video Player Based on the IOS Interface
Simplest_ffmpeg_ios_helloworld: The FFmpeg-based HelloWorld program in IOS
Simplest_ffmpeg_ios_decoder: the simplest FFmpeg-based video decoder on IOS
Simplest_ffmpeg_ios_streamer: the simplest FFmpeg-based streamer on IOS
Simplest_ffmpeg_ios_transcoder: The ffmpeg. c command line tool transplanted on the IOS platform
Simplest_sdl_ios_helloworld: the simplest program to port SDL to IOS.
Copyright Disclaimer: This article is an original article by the blogger and cannot be reproduced without the permission of the blogger.