Skip to content

Commit

Permalink
Add instructions for compiling ffmpeg
Browse files Browse the repository at this point in the history
  • Loading branch information
nyxkrage committed Jan 1, 2023
1 parent d36046b commit 4a11b14
Show file tree
Hide file tree
Showing 5 changed files with 121 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,6 @@
[submodule "libev"]
path = libev
url = https://github.com/enki/libev.git
[submodule "ffmpeg"]
path = ffmpeg
url = https://github.com/zimbatm/ffmpeg-static
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,17 @@ $ gcc -static shutdown.c -o shutdown
$ popd
```

# Statically compiled ffmpeg
This allows the ability to record the framebuffer and to stream to twitch

``` shellsession
$ pushd twitch
$ git apply ../patches/ffmpeg/*.patch
$ ./build.sh -j$(nproc)
$ popd
```


# Finishing steps

``` shellsession
Expand Down
1 change: 1 addition & 0 deletions ffmpeg
Submodule ffmpeg added at 3206c0
103 changes: 103 additions & 0 deletions patch/ffmpeg/fix-build-flags.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
diff --git a/build.sh b/build.sh
index 5199d9b..5a4a661 100755
--- a/build.sh
+++ b/build.sh
@@ -273,7 +273,7 @@ cd $BUILD_DIR/x265*
cd build/linux
[ $rebuild -eq 1 ] && find . -mindepth 1 ! -name 'make-Makefiles.bash' -and ! -name 'multilib.sh' -exec rm -r {} +
PATH="$BIN_DIR:$PATH" cmake -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX="$TARGET_DIR" -DENABLE_SHARED:BOOL=OFF -DSTATIC_LINK_CRT:BOOL=ON -DENABLE_CLI:BOOL=OFF ../../source
-sed -i '' 's/-lgcc_s/-lgcc_eh/g' x265.pc
+sed -i 's/-lgcc_s/-lgcc_eh/g' x265.pc
make -j $jval
make install

@@ -341,7 +341,7 @@ if [ "$platform" = "linux" ]; then
sed -i "s/prefix=.*/prefix=${TARGET_DIR_SED}\nINC=-I\$(prefix)\/include/" ./Makefile
sed -i "s/SHARED=.*/SHARED=no/" ./Makefile
elif [ "$platform" = "darwin" ]; then
- sed -i "" "s/prefix=.*/prefix=${TARGET_DIR_SED}/" ./Makefile
+ sed -i "s/prefix=.*/prefix=${TARGET_DIR_SED}/" ./Makefile
fi
make install_base

@@ -358,7 +358,7 @@ cd $BUILD_DIR/vid.stab-release-*
if [ "$platform" = "linux" ]; then
sed -i "s/vidstab SHARED/vidstab STATIC/" ./CMakeLists.txt
elif [ "$platform" = "darwin" ]; then
- sed -i "" "s/vidstab SHARED/vidstab STATIC/" ./CMakeLists.txt
+ sed -i "s/vidstab SHARED/vidstab STATIC/" ./CMakeLists.txt
fi
PATH="$BIN_DIR:$PATH" cmake -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX="$TARGET_DIR"
make -j $jval
@@ -426,35 +426,10 @@ if [ "$platform" = "linux" ]; then
--extra-libs="-lpthread -lm -lz" \
--extra-ldexeflags="-static" \
--bindir="$BIN_DIR" \
- --enable-pic \
- --enable-ffplay \
- --enable-fontconfig \
- --enable-frei0r \
--enable-gpl \
- --enable-version3 \
- --enable-libass \
- --enable-libfribidi \
- --enable-libfdk-aac \
- --enable-libfreetype \
- --enable-libmp3lame \
- --enable-libopencore-amrnb \
- --enable-libopencore-amrwb \
- --enable-libopenjpeg \
- --enable-libopus \
--enable-librtmp \
- --enable-libsoxr \
- --enable-libspeex \
- --enable-libtheora \
- --enable-libvidstab \
- --enable-libvo-amrwbenc \
- --enable-libvorbis \
- --enable-libvpx \
- --enable-libwebp \
- --enable-libx264 \
- --enable-libx265 \
- --enable-libxvid \
- --enable-libzimg \
--enable-nonfree \
+ --enable-libx264 \
--enable-openssl
elif [ "$platform" = "darwin" ]; then
[ ! -f config.status ] && PATH="$BIN_DIR:$PATH" \
@@ -466,33 +441,10 @@ elif [ "$platform" = "darwin" ]; then
--extra-ldflags="-L$TARGET_DIR/lib" \
--extra-ldexeflags="-Bstatic" \
--bindir="$BIN_DIR" \
- --enable-pic \
- --enable-ffplay \
- --enable-fontconfig \
- --enable-frei0r \
--enable-gpl \
- --enable-version3 \
- --enable-libass \
- --enable-libfribidi \
- --enable-libfdk-aac \
- --enable-libfreetype \
- --enable-libmp3lame \
- --enable-libopencore-amrnb \
- --enable-libopencore-amrwb \
- --enable-libopenjpeg \
- --enable-libopus \
--enable-librtmp \
- --enable-libsoxr \
- --enable-libspeex \
- --enable-libvidstab \
- --enable-libvorbis \
- --enable-libvpx \
- --enable-libwebp \
- --enable-libx264 \
- --enable-libx265 \
- --enable-libxvid \
- --enable-libzimg \
--enable-nonfree \
+ --enable-libx264 \
--enable-openssl
fi

3 changes: 3 additions & 0 deletions setup_emacs_rootfs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,6 @@ sudo cp -r ncurses/build/share/terminfo/ "$ROOTFS_MNT/share/"
sudo cp -r .emacs.d "$ROOTFS_MNT/"
sudo cp shutdown/shutdown "$ROOTFS_MNT/sbin/shutdown"
sudo ln -s shutdown "$ROOTFS_MNT/sbin/reboot"
if [ -e "./ffmpeg/bin/ffmpeg" ]; then
sudo cp ffmpeg/bin/ffmpeg "$ROOTFS_MNT/bin/ffmpeg"
fi

0 comments on commit 4a11b14

Please sign in to comment.