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 820
Android
Taner Sener edited this page Apr 2, 2019
·
26 revisions
-
Add MobileFFmpeg dependency from
jcenter()
dependencies { implementation 'com.arthenica:mobile-ffmpeg-full:4.2.1' }
-
Execute commands.
import com.arthenica.mobileffmpeg.FFmpeg; FFmpeg.execute("-i file1.mp4 -c:v mpeg4 file2.mp4");
-
Check execution output.
int rc = FFmpeg.getLastReturnCode(); String output = FFmpeg.getLastCommandOutput(); if (rc == RETURN_CODE_SUCCESS) { Log.i(Config.TAG, "Command execution completed successfully."); } else if (rc == RETURN_CODE_CANCEL) { Log.i(Config.TAG, "Command execution cancelled by user."); } else { Log.i(Config.TAG, String.format("Command execution failed with rc=%d and output=%s.", rc, output)); }
-
Stop an ongoing operation.
FFmpeg.cancel();
-
Get media information for a file.
MediaInformation info = FFmpeg.getMediaInformation("<file path or uri>");
-
Record video and audio using Android camera.
FFmpeg.execute("-f android_camera -i 0:0 -r 30 -pixel_format bgr0 -t 00:00:05 <record file path>");
-
List enabled external libraries.
List<String> externalLibraries = Config.getExternalLibraries();
-
Enable log callback.
Config.enableLogCallback(new LogCallback() { public void apply(LogMessage message) { Log.d(Config.TAG, message.getText()); } });
-
Enable statistics callback.
Config.enableStatisticsCallback(new StatisticsCallback() { public void apply(Statistics newStatistics) { Log.d(Config.TAG, String.format("frame: %d, time: %d", newStatistics.getVideoFrameNumber(), newStatistics.getTime())); } });
-
Set log level.
Config.setLogLevel(Level.AV_LOG_FATAL);
-
Register custom fonts directory.
Config.setFontDirectory(this, "<folder with fonts>", Collections.EMPTY_MAP);
Copyright (c) 2018-2021 MobileFFmpeg