https://ffmpeg.org/releases/ffmpeg-5.1.tar.gz
环境说明:
fedora 35 x86_64
内核版本:6.0.7
# 安装编译工具和依赖包
dnf install gcc make gcc-c++ yasm yasm-devel cmake automake libtool graphviz xmlto nasm libogg-devel libvorbis libvorbis-devel libvpx libvpx-devel libwebp-devel libass libass-devel
# 安装x264
git clone http://git.videolan.org/git/x264.git
cd x264 && ./configure --enable-static --enable-pic --enable-shared
make && make install
# 安装x265
dnf install hg -y
hg clone http://hg.videolan.org/x265
cd x265/build/linux
sh make-Makefiles.bash
make
make install
# aac音频
git clone --depth 1 git://git.code.sf.net/p/opencore-amr/fdk-aac
cd fdk-aac/
autoreconf -fiv
./configure --disable-shared
make && make install
ldconfig
# mp3库
curl -L -O https://sourceforge.net/projects/lame/files/lame/3.100/lame-3.100.tar.gz
tar -zxf lame-3.100.tar.gz
cd lame-3.100/
./configure --disable-shared --enable-nasm
make && make install
#
curl -L -O https://archive.mozilla.org/pub/opus/opus-1.3.1.tar.gz
tar -zxf opus-1.3.1.tar.gz
cd opus-1.3.1
./configure --disable-shared
# 解压ffmpeg 5.1源码
tar -zxf ffmpeg-5.1.tar.gz
cd ffmpeg-5.1
./configure --enable-gpl --enable-nonfree --enable-libfdk-aac --enable-libmp3lame --enable-libopus --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-openssl --enable-zlib --enable-libfreetype --enable-iconv --enable-libwebp --enable-libspeex --enable-ffplay --enable-pic --enable-libass --disable-shared
make -j2
make install
#检查成果
ffmpeg -version
ffmpeg version 5.1 Copyright (c) 2000-2022 the FFmpeg developers
built with gcc 11 (GCC)
configuration: --enable-gpl --enable-nonfree --enable-libfdk-aac --enable-libmp3lame --enable-libopus --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-openssl --enable-zlib --enable-libfreetype --enable-iconv --enable-libwebp --enable-libspeex --disable-shared --enable-ffplay --enable-pic --enable-libass
libavutil 57. 28.100 / 57. 28.100
libavcodec 59. 37.100 / 59. 37.100
libavformat 59. 27.100 / 59. 27.100
libavdevice 59. 7.100 / 59. 7.100
libavfilter 8. 44.100 / 8. 44.100
libswscale 6. 7.100 / 6. 7.100
libswresample 4. 7.100 / 4. 7.100
libpostproc 56. 6.100 / 56. 6.100
# 测试
# 视频加速2倍 输出为265编码的视频 无音频
ffmpeg -i test-4k-h265-audio.mp4 -an -r 50 -filter:v setpts=0.5*PTS -c:v libx265 x2_x265.mp4
# 音视频同时加速2倍
ffmpeg -i test-4k-h265-audio.mp4 -filter_complex "[0:v]setpts=0.5*PTS[v];[0:a]atempo=2.0[a]" -map "[v]" -map "[a]" -c:v libx265 x2_x265.mp4
参考资料:
FFmpeg 音视频倍速控制_音视频开发进阶的博客-CSDN博客
支持更多编码和库:
./configure --enable-gpl --enable-nonfree --enable-libfdk-aac --enable-libmp3lame --enable-libopus --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-openssl --enable-zlib --enable-libfreetype --enable-iconv --enable-libwebp --enable-libspeex --disable-shared --enable-ffplay --enable-pic --enable-libass --enable-static --enable-sdl --enable-libtheora --enable-libspeex --enable-libv4l2 --enable-libopenjpeg --enable-libgsm --enable-ladspa --enable-libpulse --enable-libsoxr --enable-libcdio --enable-opengl --enable-openal --enable-libssh
make
make install
# 验证成果
ffmpeg -version
ffmpeg version 5.1 Copyright (c) 2000-2022 the FFmpeg developers
built with gcc 11 (GCC)
configuration: --enable-gpl --enable-nonfree --enable-libfdk-aac --enable-libmp3lame --enable-libopus --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-openssl --enable-zlib --enable-libfreetype --enable-iconv --enable-libwebp --enable-libspeex --disable-shared --enable-ffplay --enable-pic --enable-libass --enable-static --enable-sdl --enable-libtheora --enable-libspeex --enable-libv4l2 --enable-libopenjpeg --enable-libgsm --enable-ladspa --enable-libpulse --enable-libsoxr --enable-libcdio --enable-opengl --enable-openal --enable-libssh
libavutil 57. 28.100 / 57. 28.100
libavcodec 59. 37.100 / 59. 37.100
libavformat 59. 27.100 / 59. 27.100
libavdevice 59. 7.100 / 59. 7.100
libavfilter 8. 44.100 / 8. 44.100
libswscale 6. 7.100 / 6. 7.100
libswresample 4. 7.100 / 4. 7.100
libpostproc 56. 6.100 / 56. 6.100
ffprobe -version
ffprobe version 5.1 Copyright (c) 2007-2022 the FFmpeg developers
built with gcc 11 (GCC)
configuration: --enable-gpl --enable-nonfree --enable-libfdk-aac --enable-libmp3lame --enable-libopus --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-openssl --enable-zlib --enable-libfreetype --enable-iconv --enable-libwebp --enable-libspeex --disable-shared --enable-ffplay --enable-pic --enable-libass --enable-static --enable-sdl --enable-libtheora --enable-libspeex --enable-libv4l2 --enable-libopenjpeg --enable-libgsm --enable-ladspa --enable-libpulse --enable-libsoxr --enable-libcdio --enable-opengl --enable-openal --enable-libssh
libavutil 57. 28.100 / 57. 28.100
libavcodec 59. 37.100 / 59. 37.100
libavformat 59. 27.100 / 59. 27.100
libavdevice 59. 7.100 / 59. 7.100
libavfilter 8. 44.100 / 8. 44.100
libswscale 6. 7.100 / 6. 7.100
libswresample 4. 7.100 / 4. 7.100
libpostproc 56. 6.100 / 56. 6.100
ffplay -version
ffplay version 5.1 Copyright (c) 2003-2022 the FFmpeg developers
built with gcc 11 (GCC)
configuration: --enable-gpl --enable-nonfree --enable-libfdk-aac --enable-libmp3lame --enable-libopus --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-openssl --enable-zlib --enable-libfreetype --enable-iconv --enable-libwebp --enable-libspeex --disable-shared --enable-ffplay --enable-pic --enable-libass --enable-static --enable-sdl --enable-libtheora --enable-libspeex --enable-libv4l2 --enable-libopenjpeg --enable-libgsm --enable-ladspa --enable-libpulse --enable-libsoxr --enable-libcdio --enable-opengl --enable-openal --enable-libssh
libavutil 57. 28.100 / 57. 28.100
libavcodec 59. 37.100 / 59. 37.100
libavformat 59. 27.100 / 59. 27.100
libavdevice 59. 7.100 / 59. 7.100
libavfilter 8. 44.100 / 8. 44.100
libswscale 6. 7.100 / 6. 7.100
libswresample 4. 7.100 / 4. 7.100
libpostproc 56. 6.100 / 56. 6.100