Skip to content

Instantly share code, notes, and snippets.

@gorshkov-leonid
Last active August 19, 2025 11:02
Show Gist options
  • Save gorshkov-leonid/b1ac3846298b343e7fa507f6da4dad4b to your computer and use it in GitHub Desktop.
Save gorshkov-leonid/b1ac3846298b343e7fa507f6da4dad4b to your computer and use it in GitHub Desktop.
ffmpeg.md
  1. Remove fragment
ffmpeg -ss 00:00:00 -to 00:01:39 -i record.mkv -c copy x.mkv
ffmpeg -ss 00:01:54 -to 00:05:23 -i record.mkv -c copy y.mkv
echo file x.mkv > list2.txt
echo file y.mkv >> list2.txt
ffmpeg -f concat -i list2.txt -c copy output2.mkv
  1. Rotate
ffmpeg -i INPUT.MOV -c copy -metadata:s:v:0 rotate=0 OUTPUT.MOV
@gorshkov-leonid
Copy link
Author

gorshkov-leonid commented Mar 1, 2024

How to build it from sources

# How to build:
#    https://trac.ffmpeg.org/wiki/CompilationGuide/Centos

# licensing 
#    https://ffmpeg.org/doxygen/3.0/md_LICENSE.html
#    https://github.com/FFmpeg/FFmpeg/blob/master/LICENSE.md

# disabled: 
# --enable-gpl --enable-libx264 --enable-libx265 --enable-nonfree --enable-libfdk_aac --enable-libmp3lame --enable-libopus --enable-libvpx --enable-libopus \

# webm: 
#    https://trac.ffmpeg.org/wiki/Encode/VP9
# licences: 
#    https://github.com/webmproject/libvpx/blob/main/LICENSE  new BSD (BSD 3-clause)
#    https://opus-codec.org/license/                          new BSD (BSD 3-clause)
# install libvpx
#    https://installati.one/centos/8/libvpx/
# install opus
#    https://installati.one/centos/8/opus/


echo "... build from sources ..."

yum install -y autoconf automake bzip2 bzip2-devel cmake freetype-devel gcc gcc-c++ git libtool make pkgconfig zlib-devel
yum install -y nasm yasm
yum install -y libvpx libvpx-devel

TMPDIR=$(mktemp -d)
# todo 11399 url
curl -o "${TMPDIR}/ffmpeg-snapshot.tar.bz2" "https://ffmpeg.org/releases/ffmpeg-6.1.1.tar.bz2"
tar -xjvf "${TMPDIR}/ffmpeg-snapshot.tar.bz2" -C "${TMPDIR}"

SOURCE_DIR="${TMPDIR}/ffmpeg-6.1.1"
cd "${SOURCE_DIR}"

BUILD_DIR="${TMPDIR}/ffmpeg_build"
PATH="${TMPDIR}/bin:$PATH" PKG_CONFIG_PATH="${BUILD_DIR}/lib/pkgconfig" "${SOURCE_DIR}/configure" \
  --prefix="${BUILD_DIR}" \
  --pkg-config-flags="--static" \
  --extra-cflags="-I${BUILD_DIR}/include" \
  --extra-ldflags="-L${BUILD_DIR}/lib" \
  --extra-libs=-lpthread \
  --extra-libs=-lm \
  --bindir="${TMPDIR}/bin" \
  --enable-libfreetype \
  --enable-libvpx

make
make install
yes | cp -Rf "${TMPDIR}/bin/"* "/usr/bin/"

cd -

rm -Rf "${TMPDIR}"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment