An OpenGLTransition fx lib integrated to ffmpeg. The project Base on FFmpeg Version 7.1. Just apply code patch to ffmpeg 7.1 branch unsing git tools. Then build ffmpeg to roll out your ffmpeg excuetable program.
Download repository diff patch to apply for ffmpeg soruce.
1.Preconditions, install tools:
pacman -S make
pacman -S diffutils
pacman -S yasm
pacman -S mingw-w64-x86_64-gcc
pacman -S mingw-w64-i686-gcc
2.Install dependence libs:
pacman -Syu # update pacman package list database
pacman -Su # update installed package
pacman -S mingw-w64-x86_64-libass --noconfirm # install libass
pacman -S mingw-w64-x86_64-lame --noconfirm
pacman -S mingw-w64-x86_64-fdk-aac --noconfirm
pacman -S mingw-w64-x86_64-libtheora --noconfirm
pacman -S mingw-w64-x86_64-libvpx --noconfirm
pacman -S mingw-w64-x86_64-x265 --noconfirm
pacman -S mingw-w64-x86_64-x264 --noconfirm
pacman -S mingw-w64-x86_64-opus --noconfirm
pacman -S mingw-w64-x86_64-vorbis --noconfirm
pacman -S mingw-w64-x86_64-mesa --noconfirm
pacman -S mingw-w64-x86_64-freeglut --noconfirm
extra libs:
- GLEW(G)
- EGL or GLFW
3.Then on ffmpeg path, run cofigure command
./configure --prefix=/usr/local --enable-gpl --enable-nonfree --enable-libass --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-libopus --enable-libxvid --enable-opengl --enable-filter=gltransition --extra-libs='-lglew32s.lib -llibglfw3.a' --enable-cross-compile --arch=x86_64 --target-os=mingw64 --cross-prefix=mingw-w64-i686-
4.make the program
make
sudo make install
1.install depences:
OpenGL depences and build-essential libs
sudo apt-get install build-essential
sudo apt-get install libgl1-mesa-dev
sudo apt-get install libglu1-mesa-dev
Other libs used on configrue command.
sudo apt install libglu1-mesa-dev freeglut3-dev mesa-common-dev #GLU
sudo apt install libxvidcore-dev
sudo apt install libvpx-dev
sudo apt install libass-dev
sudo apt install libmp3lame-dev
sudo apt install libx265-dev
sudo apt install libx264-dev
sudo add-apt-repository ppa:jonathonf/ffmpeg-4
sudo apt update
sudo apt install libfdk-aac-dev
sudo apt install libopus-dev
sudo apt install libvorbis-dev
- run configure command
./configure --prefix=/usr/local --enable-gpl --enable-nonfree --enable-libass --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-libopus --enable-libxvid --enable-opengl --enable-filter=gltransition --extra-libs='-lGLEW -lglfw' --enable-cross-compile --enable-sdl2
- Or use extra libs: GLEW , EGL. (--extra-libs='-lGLEW -lEGL')
./configure --prefix=/usr/local --enable-gpl --enable-nonfree --enable-libass --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-libopus --enable-libxvid --enable-opengl --enable-filter=gltransition --extra-libs='-lGLEW -lEGL' --enable-cross-compile --enable-sdl2
- make the program
make
sudo make install
Assume that you have tow input file named: v1.mp4 v2.mp4 ,then output file is out.mp4
ffmpeg -i v1.mp4 -i v2.mp4 -filter_complex "gltransition=duration=3:offset=1:source=GlitchMemories.glsl" -y out.mp4
Available args are : duration , offset , source
- duration : means transition times.
- offest : means how start transition effect delay offset times.
- source : means use the GLSL(openGL shader language)shader effect file.
Download and use other GLSL effects,you can find here gl-transition.
#Example of concatenating multi input videos or images together with 1-second transitions between them.
# 需要将每个片段的连接处截取转场的长度做合成转场片段长度:
# 如:A,B两个个视频,转场为3秒的话,则A 取出后3秒片段,和B的前3秒片段,做合成转场片段,再与A的剩余前半部分视频连接上转场片段,与B的剩余转场片段连接起来
# 如下案例,图片增加了缩放移动效果,并生成11秒的视频流
# 1、复制每个片段成两个流
# 2、为每个片段分割截取转场所需的片段和待连接片段
# 3、为每个片段合成转场
# 4、连接截取的head与转场
ffmpeg -i ./1.jpg -i ./2.jpg -i ./3.jpg -i ./4.jpg -i ./5.jpg -i ./6.jpg -filter_complex " \
[0:v]scale=4368*2448,setsar=1,zoompan=z='1.2':x='(iw-iw/zoom)/2':y='(ih-ih/zoom)/2+0.54*on':s=1456x816:d=330:fps=30,trim=duration=11[v0]; \
[1:v]scale=4368*2448,setsar=1,zoompan=z='1.2':x='(iw-iw/zoom)/2':y='(ih-ih/zoom)/2-0.54*on':s=1456x816:d=330:fps=30,trim=duration=11[v1]; \
[2:v]scale=4368*2448,setsar=1,zoompan=z='1.2':x='(iw-iw/zoom)/2':y='(ih-ih/zoom)/2+0.54*on':s=1456x816:d=330:fps=30,trim=duration=11[v2]; \
[3:v]scale=4368*2448,setsar=1,zoompan=z='1.2':x='(iw-iw/zoom)/2':y='(ih-ih/zoom)/2-0.54*on':s=1456x816:d=330:fps=30,trim=duration=11[v3]; \
[4:v]scale=4368*2448,setsar=1,zoompan=z='1.2':x='(iw-iw/zoom)/2':y='(ih-ih/zoom)/2+0.54*on':s=1456x816:d=330:fps=30,trim=duration=11[v4]; \
[5:v]scale=4368*2448,setsar=1,zoompan=z='1.2':x='(iw-iw/zoom)/2':y='(ih-ih/zoom)/2-0.54*on':s=1456x816:d=330:fps=30,trim=duration=11[v5]; \
[v0]split[v0cp1][v0cp2]; \
[v1]split[v1cp1][v1cp2]; \
[v2]split[v2cp1][v2cp2]; \
[v3]split[v3cp1][v3cp2]; \
[v4]split[v4cp1][v4cp2]; \
[v5]split[v5cp1][v5cp2]; \
[v0cp1]trim=0:10[v0trim_head]; \
[v0cp2]trim=10:11[v0trim_tail]; \
[v0trim_tail]setpts=PTS-STARTPTS[v0trans_tail]; \
[v1cp1]trim=0:10[v1trim_head]; \
[v1cp2]trim=10:11[v1trim_tail]; \
[v1trim_tail]setpts=PTS-STARTPTS[v1trans_tail]; \
[v2cp1]trim=0:10[v2trim_head]; \
[v2cp2]trim=10:11[v2trim_tail]; \
[v2trim_tail]setpts=PTS-STARTPTS[v2trans_tail]; \
[v3cp1]trim=0:10[v3trim_head]; \
[v3cp2]trim=10:11[v3trim_tail]; \
[v3trim_tail]setpts=PTS-STARTPTS[v3trans_tail]; \
[v4cp1]trim=0:10[v4trim_head]; \
[v4cp2]trim=10:11[v4trim_tail]; \
[v4trim_tail]setpts=PTS-STARTPTS[v4trans_tail]; \
[v5cp1]trim=0:10[v5trim_head]; \
[v5cp2]trim=10:11[v5trim_tail]; \
[v5trim_tail]setpts=PTS-STARTPTS[v5trans_tail]; \
[v0trans_tail][v1trim_head]gltransition=duration=1:source=crosswarp.glsl[v0trans_fragment]; \
[v1trans_tail][v2trim_head]gltransition=duration=1:source=crosswarp.glsl[v1trans_fragment]; \
[v2trans_tail][v3trim_head]gltransition=duration=1:source=crosswarp.glsl[v2trans_fragment]; \
[v3trans_tail][v4trim_head]gltransition=duration=1:source=crosswarp.glsl[v3trans_fragment]; \
[v4trans_tail][v5trim_head]gltransition=duration=1:source=crosswarp.glsl[v4trans_fragment]; \
[v0trim_head][v0trans_fragment][v1trans_fragment][v2trans_fragment][v3trans_fragment][v4trans_fragment][v5trans_fragment][v5trans_tail]concat=n=8,format=yuv420p[outv]" \
-t 60 -map "[outv]" -c:v libx264 -preset ultrafast -threads 0 -y ./output_gltransition.mp4
- Thanks to transitive-bullshit/ffmpeg-gl-transition on github repository.
- ffmpeg
- GLEW
- glfw