transitive-bullshit / ffmpeg-gl-transition

FFmpeg filter for applying GLSL transitions between video streams.
650 stars 126 forks source link

can only use a few GL Transitions #13

Closed xarenwo closed 6 years ago

xarenwo commented 6 years ago

Hi, i successfully managed to use the following transitions:


- crosswarp
- cube
- Butterflywavescrawler
- circlecrop
- circle
- simplezoom
- InvertedPageCurl
- Dreamy
- Mosaic
- DreamyZoom
- doorway
- fadecolor
- rotate_scale_fade
- swap

but if i want to use any others, and i do, the video gets rendered but there is no visual transition, i get back the original video concatenated without effects. Can you point me in any direction ? Thank you

gre commented 6 years ago

which transition don't work for instance? do they require extra parameters?

xarenwo commented 6 years ago

Hi, i'm using your concat.sh example and modified it so i can test faster with all the effects.

 #!/bin/bash
# Example of concatenating 3 mp4s together with 1-second transitions between them.
EFFECT=$1
~/ffmpeg/ffmpeg \
  -i media/0.mp4 \
  -i media/1.mp4 \
  -i media/2.mp4 \
  -filter_complex " \
    [0:v]split[v000][v010]; \
    [1:v]split[v100][v110]; \
    [2:v]split[v200][v210]; \
    [v000]trim=0:3[v001]; \
    [v010]trim=3:4[v011t]; \
    [v011t]setpts=PTS-STARTPTS[v011]; \
    [v100]trim=0:3[v101]; \
    [v110]trim=3:4[v111t]; \
    [v111t]setpts=PTS-STARTPTS[v111]; \
    [v200]trim=0:3[v201]; \
    [v210]trim=3:4[v211t]; \
    [v211t]setpts=PTS-STARTPTS[v211]; \
    [v011][v101]gltransition=duration=1:source=./transitions/$EFFECT.glsl[vt0]; \
    [v111][v201]gltransition=duration=1[vt1]; \
    [v001][vt0][vt1][v211]concat=n=4[outv]" \
  -map "[outv]" \
  -c:v libx264 -profile:v baseline -preset slow -movflags faststart -pix_fmt yuv420p \
  -y $EFFECT.mp4
mv $EFFECT.mp4 /home/xarenwo/

so i use for example bash concat.sh crosswarp

If i use crosswarp effect it works but if i use for example PolkaDotsCurtain i get the video like this : https://cloud.xarentek.com/index.php/s/TFonoeCXt7GzBdT The transition happens but just half, there are no dots. If i use Directional effect it doesn't work at all https://cloud.xarentek.com/index.php/s/dAN8b2E5qkwMXb2

i compiled ffmpeg like this :

./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'

PS: I can give you VNC/Teamviewer access to my virtual machine if you want.

gre commented 6 years ago

(i'm not the author of ffmpeg-gl-transition)

so I feel this behave like if default uniforms was not set ( see https://gl-transitions.com/editor/PolkaDotsCurtain?dots=0&center=0,0 )

by default, uniforms are all set to 0s. so i guess this current plugin implementation is not able to parse what default value to use and you have to set all the uniforms values (if it's possible?). looks like this is written in the TODO https://github.com/transitive-bullshit/ffmpeg-gl-transition#todo

xarenwo commented 6 years ago

That was it, i didn't notice that TODO note before. I now edited the transition file and for some reason if i assign the value to the variable it doesn't work, then i put the value directly into the function and it worked.

// author: bobylito // license: MIT const float SQRT_2 = 1.414213562373; uniform float dots;// = 5.0; uniform vec2 center;// = vec2(0, 0); vec4 transition(vec2 uv) { bool nextImage = distance(fract(uv * (5.0)), vec2(0.5, 0.5)) < ( progress / distance(uv, center)); return nextImage ? getToColor(uv) : getFromColor(uv); } EDIT: I assigned the value to a simple float instead of uniform float and it worked.

Thank you :+1:

transitive-bullshit commented 6 years ago

Thanks @gre!

I suggest replacing al luniforms with the value you want (or the default) in the GLSL source as @xarenwo did until this is fixed. PRs welcome :)

VineshChauhan24 commented 5 years ago

how to build ffmpeg for android with gltransition enabled?