Skip to content

Commit

Permalink
Split fetching FFmpeg from build_ffmpeg.sh
Browse files Browse the repository at this point in the history
It makes it harder to work with a different branch. Also make
the FFmpeg instructions consistent with those of the other
extensions (e.g., by removing the "jni" part of the path from
the FFMPEG_EXT_PATH variable.

PiperOrigin-RevId: 310937751
  • Loading branch information
ojw28 committed May 14, 2020
1 parent 0fb4ba7 commit 8ae8bf7
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 13 deletions.
27 changes: 21 additions & 6 deletions extensions/ffmpeg/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ follows:

```
cd "<path to exoplayer checkout>"
FFMPEG_EXT_PATH="$(pwd)/extensions/ffmpeg/src/main/jni"
FFMPEG_EXT_PATH="$(pwd)/extensions/ffmpeg/src/main"
```

* Download the [Android NDK][] and set its location in a shell variable.
Expand All @@ -41,19 +41,34 @@ NDK_PATH="<path to Android NDK>"
HOST_PLATFORM="linux-x86_64"
```

* Fetch FFmpeg:

```
cd "${FFMPEG_EXT_PATH}/jni" && \
git clone git://source.ffmpeg.org/ffmpeg ffmpeg
```

* Checkout an appropriate branch of FFmpeg. We cannot guarantee compatibility
with all versions of FFmpeg. We currently recommend version 4.2:

```
cd "${FFMPEG_EXT_PATH}/jni/ffmpeg" && \
git checkout release/4.2
```

* Configure the decoders to include. See the [Supported formats][] page for
details of the available decoders, and which formats they support.

```
ENABLED_DECODERS=(vorbis opus flac)
```

* Fetch and build FFmpeg. Executing `build_ffmpeg.sh` will fetch and build
FFmpeg 4.2 for `armeabi-v7a`, `arm64-v8a`, `x86` and `x86_64`. The script can
be edited if you need to build for different architectures.
* Execute `build_ffmpeg.sh` to build FFmpeg for `armeabi-v7a`, `arm64-v8a`,
`x86` and `x86_64`. The script can be edited if you need to build for
different architectures:

```
cd "${FFMPEG_EXT_PATH}" && \
cd "${FFMPEG_EXT_PATH}/jni" && \
./build_ffmpeg.sh \
"${FFMPEG_EXT_PATH}" "${NDK_PATH}" "${HOST_PLATFORM}" "${ENABLED_DECODERS[@]}"
```
Expand All @@ -62,7 +77,7 @@ cd "${FFMPEG_EXT_PATH}" && \
built in the previous step. For example:

```
cd "${FFMPEG_EXT_PATH}" && \
cd "${FFMPEG_EXT_PATH}/jni" && \
${NDK_PATH}/ndk-build APP_ABI="armeabi-v7a arm64-v8a x86 x86_64" -j4
```

Expand Down
5 changes: 1 addition & 4 deletions extensions/ffmpeg/src/main/jni/build_ffmpeg.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,7 @@ for decoder in "${ENABLED_DECODERS[@]}"
do
COMMON_OPTIONS="${COMMON_OPTIONS} --enable-decoder=${decoder}"
done
cd "${FFMPEG_EXT_PATH}"
(git -C ffmpeg pull || git clone git://source.ffmpeg.org/ffmpeg ffmpeg)
cd ffmpeg
git checkout release/4.2
cd "${FFMPEG_EXT_PATH}/jni/ffmpeg"
./configure \
--libdir=android-libs/armeabi-v7a \
--arch=arm \
Expand Down
5 changes: 2 additions & 3 deletions extensions/vp9/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,8 @@ cd "${VP9_EXT_PATH}/jni" && \
git clone https://chromium.googlesource.com/webm/libvpx libvpx
```

* Checkout the appropriate branch of libvpx (the scripts and makefiles bundled
in this repo are known to work only at specific versions of the library - we
will update this periodically as newer versions of libvpx are released):
* Checkout an appropriate branch of libvpx. We cannot guarantee compatibility
with all versions of libvpx. We currently recommend version 1.8.0:

```
cd "${VP9_EXT_PATH}/jni/libvpx" && \
Expand Down

0 comments on commit 8ae8bf7

Please sign in to comment.