This repository has been archived by the owner on Jan 6, 2025. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 798
iOS
Taner Sener edited this page Jul 20, 2019
·
7 revisions
-
Add MobileFFmpeg dependency to your
Podfile
inmobile-ffmpeg-<package name>
formatpod 'mobile-ffmpeg-full', '~> 4.2.2'
-
Execute commands.
#import <mobileffmpeg/MobileFFmpeg.h> [MobileFFmpeg execute: @"-i file1.mp4 -c:v mpeg4 file2.mp4"];
-
Check execution output.
int rc = [MobileFFmpeg getLastReturnCode]; NSString *output = [MobileFFmpeg getLastCommandOutput]; if (rc == RETURN_CODE_SUCCESS) { NSLog(@"Command execution completed successfully.\n"); } else if (rc == RETURN_CODE_CANCEL) { NSLog(@"Command execution cancelled by user.\n"); } else { NSLog(@"Command execution failed with rc=%d and output=%@.\n", rc, output); }
-
Stop an ongoing operation.
[MobileFFmpeg cancel];
-
Get media information for a file.
MediaInformation *mediaInformation = [MobileFFmpeg getMediaInformation:@"<file path or uri>"];
-
Record video and audio using iOS camera.
[MobileFFmpeg execute: @"-f avfoundation -r 30 -video_size 1280x720 -pixel_format bgr0 -i 0:0 -vcodec h264_videotoolbox -vsync 2 -f h264 -t 00:00:05 %@", recordFilePath];
-
List enabled external libraries.
NASArray *externalLibraries = [MobileFFmpegConfig getExternalLibraries];
-
Enable log callback.
- (void)logCallback: (int)level :(NSString*)message { dispatch_async(dispatch_get_main_queue(), ^{ NSLog(@"%@", message); }); } ... [MobileFFmpegConfig setLogDelegate:self];
-
Enable statistics callback.
- (void)statisticsCallback:(Statistics *)newStatistics { dispatch_async(dispatch_get_main_queue(), ^{ NSLog(@"frame: %d, time: %d\n", newStatistics.getVideoFrameNumber, newStatistics.getTime); }); } ... [MobileFFmpegConfig setStatisticsDelegate:self];
-
Set log level.
[MobileFFmpegConfig setLogLevel:AV_LOG_FATAL];
-
Register custom fonts directory.
[MobileFFmpegConfig setFontDirectory:@"<folder with fonts>" with:nil];
Copyright (c) 2018-2021 MobileFFmpeg