Java/Android Programming
How to Compile Latest ffmpeg for Android and Use it in Android Studio 2023

Published
1 month agoon

FFMPEG is one of the most popular or powerful media processing library with multiple platform support and it is capable of doing Most of Media processing task.
So i show you How you Can Use ffmpeg in your Android Studio project.
How to use ffmpeg in Android studio Projects.
Follow this Steps :
- Download or Clone ffmpeg Android GitHub Repository.
- Now Create jniLibs folder inside your projects /main folder.
Example \<Your Project Directory>\<Your Project>\src\main\jniLibs
- Copy and paste these ffmpegAndroid files inside jniLibs folder.
- And after that add following code in Your cmakeList.txt file.
set(IMPORT_DIR ${CMAKE_SOURCE_DIR}/../jniLibs)
# FFmpeg include file
include_directories(${IMPORT_DIR}/${ANDROID_ABI}/include)
# Codec library
add_library(
avcodec
SHARED
IMPORTED
)
set_target_properties(
avcodec
PROPERTIES IMPORTED_LOCATION
${IMPORT_DIR}/${ANDROID_ABI}/libavcodec.so
)
# The filter library is temporarily out of use
add_library(
avfilter
SHARED
IMPORTED
)
set_target_properties(
avfilter
PROPERTIES IMPORTED_LOCATION
${IMPORT_DIR}/${ANDROID_ABI}/libavfilter.so
)
# File format libraries are required for most operations
add_library(
avformat
SHARED
IMPORTED
)
set_target_properties(
avformat
PROPERTIES IMPORTED_LOCATION
${IMPORT_DIR}/${ANDROID_ABI}/libavformat.so
)
# Tool library
add_library(
avutil
SHARED
IMPORTED
)
set_target_properties(
avutil
PROPERTIES IMPORTED_LOCATION
${IMPORT_DIR}/${ANDROID_ABI}/libavutil.so
)
# The resampling library is mainly used for audio conversion.
add_library(
swresample
SHARED
IMPORTED
)
set_target_properties(
swresample
PROPERTIES IMPORTED_LOCATION
${IMPORT_DIR}/${ANDROID_ABI}/libswresample.so
)
# Video format conversion library is mainly used for video conversion.
add_library(
swscale
SHARED
IMPORTED
)
set_target_properties(
swscale
PROPERTIES IMPORTED_LOCATION
${IMPORT_DIR}/${ANDROID_ABI}/libswscale.so
)
# The main android library, native window, requires this library
target_link_libraries(
<Your-Native-Library>
${log-lib}
android
avcodec
avfilter
avformat
avutil
swresample
swscale
)
- Also Add following code in your Module build.gradle file
defaultConfig {
//............//
ndk.abiFilters 'armeabi-v7a', 'arm64-v8a', 'x86', 'x86_64'
externalNativeBuild {
cmake {
cppFlags "-std=c++14 -fexceptions -frtti"
arguments "-DANDROID_STL=c++_shared"
}
}
}
And now just rebuild your project and start using ffmpeg c++ libraries in your Android Studio Project.
Related Topics:ffmpegffmpeg Androidffmpeg Android tutorial
Video Games Lover By Passion. Programmer by skills and part time Blogger by Hobby. And Owner of UMIRGAMING.COM and UMIRTECH.COM

You may like
Click to comment

Best Softwares3 weeks ago
How to Play AC3 or EAC3 Videos in Android Using OK Player

Editor's Choice3 weeks ago
[Latest] Play Fortnite on TCL 40XL: A Guide to Overcome Device Compatibility Issues

Games1 month ago
Fortnite on Samsung Galaxy A14 5G – How to Play and Install

Java/Android Programming1 month ago
How to Compile Latest ffmpeg for Android and Use it in Android Studio 2023

Games2 months ago
How to Install Fortnite in Samsung Galaxy A03s 2023

Best Softwares5 months ago
Best Video Editing App For Beginners and New Youtubers

Best Softwares6 months ago
Canned Video Editor App For Android – Review

Games8 months ago
Play Fortnite in Oppo A5s in 2022 without getting Errors

Games9 months ago
How to Play and Install Fortnite in Poco X3 Pro

Games11 months ago
How to Play Fortnite on POCO M4

Games1 year ago
How to play Fortnite on Motorola Moto G Fast

Games1 year ago
How to Play Fortnite on Samsung Galaxy M12

Games1 year ago
How to Play Fortnite in Galaxy A13 (2022)

Games1 year ago
Unsuspend Your Free Fire Account 2022 Trick with Proof

Games1 year ago
Fix Fortnite Device Not Supported Samsung Galaxy A12

Games3 years ago
How to play Fortnite on Samsung Galaxy A10

Games3 years ago
How to Recover Garena Free Fire Suspended Account 2021

Games4 years ago
Fix Device Not Supported Problem in Fortnite Android Chapter 2 Season 4

Games2 years ago
How to Install Fortnite in Android When Your Device Not Supported 2023

Editor's Choice4 years ago
Play Fortnite Android on incompatible Devices 2020

Tips and tricks3 years ago
Fortnite on Galaxy A11 – How to play/install

Games3 years ago
Fortnite Mobile Now available on Google Play Store – Fix Device incompatible Error

Editor's Choice4 years ago
How to Play Fortnite on Galaxy M20 without Getting Errors

Tips and tricks5 years ago
How to Solve/Fix GTA VICE CITY unfortunately Stopped Working In Android Phone

Games1 year ago
How to Play Fortnite in Galaxy A13 (2022)

Games2 years ago
Fortnite on Galaxy A12 – How to Install

Games2 years ago
How to Get Fortnite On Samsung Galaxy A32 5G in 2022

Information3 years ago
Kali Linux – How to install in Android without Root or offline

Games3 years ago
Galaxy A10e Fortnite – Solve Device Not Supported 2020

Editor's Choice4 years ago