Skip to content

Commit da51e60

Browse files
committed
update build for android, and build instructions
1 parent 4819418 commit da51e60

File tree

4 files changed

+25
-5
lines changed

4 files changed

+25
-5
lines changed

CMakeLists.txt

+13
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,9 @@ if (WIN32)
4242
${CMAKE_SOURCE_DIR}/lib/swscale.lib
4343
${CMAKE_SOURCE_DIR}/lib/libx264.lib
4444
${CMAKE_SOURCE_DIR}/lib/x265-static.lib
45+
${CMAKE_SOURCE_DIR}/lib/aom.lib
46+
${CMAKE_SOURCE_DIR}/lib/vpx.lib
47+
${CMAKE_SOURCE_DIR}/lib/openh264.lib
4548
${CMAKE_SOURCE_DIR}/lib/ws2_32.lib
4649
${CMAKE_SOURCE_DIR}/lib/mfplat.lib
4750
${CMAKE_SOURCE_DIR}/lib/mf.lib
@@ -59,14 +62,24 @@ elseif (ANDROID)
5962
${CMAKE_SOURCE_DIR}/lib/arm64-v8a/libavutil.a
6063
${CMAKE_SOURCE_DIR}/lib/arm64-v8a/libswresample.a
6164
${CMAKE_SOURCE_DIR}/lib/arm64-v8a/libswscale.a
65+
${CMAKE_SOURCE_DIR}/lib/arm64-v8a/libaom.a
66+
${CMAKE_SOURCE_DIR}/lib/arm64-v8a/libvpx.a
67+
${CMAKE_SOURCE_DIR}/lib/arm64-v8a/libx264.a
68+
${CMAKE_SOURCE_DIR}/lib/arm64-v8a/libx265.a
6269
) # android
6370
elseif(ANDROID_ABI STREQUAL "armeabi-v7a")
71+
add_definitions(-D__USE_FILE_OFFSET64)
72+
add_definitions(-DANDROID_PLATFORM=24)
6473
set(STATIC_LIBS
6574
${CMAKE_SOURCE_DIR}/lib/armeabi-v7a/libavcodec.a
6675
${CMAKE_SOURCE_DIR}/lib/armeabi-v7a/libavformat.a
6776
${CMAKE_SOURCE_DIR}/lib/armeabi-v7a/libavutil.a
6877
${CMAKE_SOURCE_DIR}/lib/armeabi-v7a/libswresample.a
6978
${CMAKE_SOURCE_DIR}/lib/armeabi-v7a/libswscale.a
79+
${CMAKE_SOURCE_DIR}/lib/armeabi-v7a/libaom.a
80+
${CMAKE_SOURCE_DIR}/lib/armeabi-v7a/libvpx.a
81+
${CMAKE_SOURCE_DIR}/lib/armeabi-v7a/libx264.a
82+
${CMAKE_SOURCE_DIR}/lib/armeabi-v7a/libx265.a
7083
) # android
7184
endif()
7285
else ()

README.md

+8-3
Original file line numberDiff line numberDiff line change
@@ -59,15 +59,20 @@ void audioRaw() {
5959
### Windows
6060
To get the needed libraries on Windows, you can use vcpkg:
6161
```sh
62-
vcpkg install ffmpeg[core,avcodec,avformat,avutil,swscale,swresample,amf,x264,x265,nvcodec]:x64-windows-static --recurse
62+
vcpkg install ffmpeg[core,avcodec,avformat,avutil,swscale,swresample,amf,x264,x265,nvcodec,openh264,aom,vpx]:x64-windows-static --recurse
6363
```
6464
the other libraries are part of the Windows SDK
6565

6666
## Android
67-
To get the needed libraries on Android, you can use [this](https://github.com/EclipseMenu/ffmpeg-android-maker/) script. Read the README in the repository for further instructions.
67+
To get the needed libraries on Android, you can use [this](https://github.com/EclipseMenu/ffmpeg-android-maker/) script, make sure you have pkg-config installed before running it. Read the README in the repository for further instructions.
6868
```sh
6969
git clone https://github.com/EclipseMenu/ffmpeg-android-maker/
7070
cd ffmpeg-android-maker
71-
./ffmpeg-android-maker.sh
71+
./ffmpeg-android-maker.sh --enable-libaom --enable-libvpx --enable-libx264 --enable-libx265 --android-api-level=24
7272
```
7373
You can either run it natively on Linux or using WSL on Windows.
74+
75+
When building for android32 you need to set android version 24, you can do so by adding this arg to your geode build command
76+
```sh
77+
geode build --platform android32 --config Release -- -DANDROID_PLATFORM=24
78+
```

mod.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
},
1414
"id": "eclipse.ffmpeg-api",
1515
"name": "FFmpeg API",
16-
"version": "v1.0.2",
16+
"version": "v1.0.3",
1717
"developers": ["Eclipse Team", "maxnu"],
1818
"description": "Interaction with FFmpeg made easy",
1919
"tags": ["utility", "offline"],

src/recorder.cpp

+3-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,9 @@ std::vector<std::string> Recorder::getAvailableCodecs() {
1919
const AVCodec * codec;
2020

2121
while ((codec = av_codec_iterate(&iter))) {
22-
if(codec->type == AVMEDIA_TYPE_VIDEO && avcodec_find_encoder_by_name(codec->name) != nullptr)
22+
if(codec->type == AVMEDIA_TYPE_VIDEO &&
23+
(codec->id == AV_CODEC_ID_H264 || codec->id == AV_CODEC_ID_HEVC || codec->id == AV_CODEC_ID_VP8 || codec->id == AV_CODEC_ID_VP9 || codec->id == AV_CODEC_ID_AV1 || codec->id == AV_CODEC_ID_MPEG4) &&
24+
avcodec_find_encoder_by_name(codec->name) != nullptr && codec->pix_fmts && std::find(vec.begin(), vec.end(), std::string(codec->name)) == vec.end())
2325
vec.push_back(codec->name);
2426
}
2527

0 commit comments

Comments
 (0)