The simplest ffmpeg-based mobile sample: IOS video transcoding

Source: Internet
Author: User

=====================================================

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

=====================================================


This document records the FFmpeg-based video transcoding device under the iOS platform. The transcoding device is actually transplanted from the FFMPEG.C source code in the FFmpeg project. About the source of FFMPEG.C can refer to the article "FFMPEG.C function structure simple analysis (Drawing)". There is no repetition of the record here.



Source

The folder structure of the project is seen.


The following C language files are copied from the FFmpeg source code:

CMDUTILS.C
Cmdutils.h
Cmdutils_common_opts.h
Config.h
Ffmpeg.h
Ffmpeg_filter.c
ffmpeg_opt.c

In addition, when compiling ffmpeg.c, you need to ffmpeg the header files in the SDK. You also need to copy the following header files from the source code.

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.C itself is a program used by the command line, so you need to make some changes to the source code when you change to a class library call. For example, remove some exit (0), release some variables, the main () function is renamed Ffmpegmain () and so on.

The code for the OBJECTIVE-C call FFmpeg is located in the Viewcontroller.m file, as seen in the following section.
/** * Simplest FFmpeg-based transcoding-ios * simplest FFmpeg IOS transcoder * * Lei hua Lei xiaohua * [email protected] * MA xiaoyu ma xiaoyu * [EMA Il protected] * Communication University/Digital TV Technology * Communication University of China/digital TV technology * Http://blog.csdn.net/leixiaohu A1020 * * This program is a transcoding device under the iOS platform.

It is ported to the FFMPEG.C command-line tool. * * This software are 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 didreceivememorywarning]; Dispose of any resources the 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


Execution results

The results of the app's execution on the phone, for example, are seen.


After clicking the "Run" button, the program will transcode according to the command entered.

For example, for the above situation. The/users/leixiaohua1020/desktop/test.mp4 will be transcoded to/users/leixiaohua1020/desktop/test.mov. The resulting video file is, for example, seen.



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


The simplest ffmpeg-based mobile sample: IOS video transcoding

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: info-contact@alibabacloud.com 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.