I was trying to achieve get an animated text overlay. I found this thread: ffmpeg moving text drawtext
When I run this code however:
ffmpeg -i VideoInput.mp4 \
-vf "drawtext=enable='between(t,12,15)':fontfile=myfont.otf:text='Test test': \
x='if(lt(t-t2+1\,0)\,x1+(x2-x1)*(t-t1)/(t2-t1-1)\,x)': \
y='if(lt(t-t2+1\,0)\,y1+(y2-y1)*(t-t1)/(t2-t1-1)\,y)':fontsize=65" \
-acodec copy outputVideo.mp4
I get the error:
[Parsed_drawtext_0 @ 000002d862595c00][Eval @ 000000e1d79fe300] Undefined constant or missing '(' in 't2-t1-1),x)'
[Parsed_drawtext_0 @ 000002d862595c00] Failed to configure input pad on Parsed_drawtext_0
A second strange error, which may be the cause for the problem at the top. Is that I can't run the arguments on multiple lines. So with the code below I have to remove the slashes and put it on 1 line. I use PHP so this does not work (white screen, no output)
$arguments = "-i out1.mp4 \
-vf \"drawtext=enable='between(t,12,15)':fontfile=myfont.otf:text='Test test': \
x='if(lt(t-t2+1\,0)\,x1+(x2-x1)*(t-t1)/(t2-t1-1)\,x)': \
y='if(lt(t-t2+1\,0)\,y1+(y2-y1)*(t-t1)/(t2-t1-1)\,y)':fontsize=65\" \
-acodec copy outputVideo.mp4 2>&1";
$output = shell_exec('D:/wamp64/www/createslideshow/ffmpeg-20190319-f8075b2-win64-static/bin/ffmpeg.exe '.$arguments);
This works but gives the undefined constant error:
$arguments = "-i out1.mp4 -vf \"drawtext=enable='between(t,12,15)':fontfile=myfont.otf:text='Test test': x='if(lt(t-t2+1\,0)\,x1+(x2-x1)*(t-t1)/(t2-t1-1)\,x)': y='if(lt(t-t2+1\,0)\,y1+(y2-y1)*(t-t1)/(t2-t1-1)\,y)':fontsize=65\" -acodec copy outputVideo.mp4 2>&1";
$output = shell_exec('D:/wamp64/www/createslideshow/ffmpeg-20190319-f8075b2-win64-static/bin/ffmpeg.exe '.$arguments);