<p><code>zoompan</code> is a weirdly designed filter. It operates on individual frames, whereas most filters operate on a sequence of pictures, whether they are fed from a video file or an image sequence. <code>pzoom</code> should be used for a looped image, and frame sequence generation should be stopped by making d=1.</p>

<p>Change to </p>

<pre><code>zoompan=z='min(pzoom+0.0015,1.5)':d=1:x='iw/2-(iw/zoom/2)':y='ih/2 (ih/zoom/2)':s=640x480
</code></pre>

<p>This will fix the zoompan.</p>

CC BY-SA 3.0
2018-02-09T15:49:55.617Z
Thanks! It works! Really Thanks! I just have these messages:
`[swscaler @ 0x7f3d60016880] deprecated pixel format used, make sure you did set range correctly`, I'm using `-pix_fmt yuvj422p`, is not correct?
GFCoder977
CC BY-SA 3.0
2018-02-09T15:58:15.417Z
For final output, `yuv420p` is standard.
Gyan
CC BY-SA 3.0
2018-02-09T17:36:45.963Z
Thanks, it works. To finish my job, I need to add an mp3 to the process. Should I open a new Ask Question, or you can suggest me how to add this new input to the command above? I tryed adding `[final1][final2][2:0]concat=n=2:v=1:a=1[finalVideo][finalAudio]` but it does not work ( mp3 is the third input )
GFCoder977
CC BY-SA 3.0
2018-02-09T18:14:10.230Z
You don't need to add the audio to the concat. Remove the `-map [final]`
Gyan
CC BY-SA 3.0
2018-02-09T14:29:35.227Z
2018-02-09T14:29:35.227Z
Gyan
<p>I'm trying to create a video from a set of images, adding texts to each image that slide from one side to the center ( one left to right, another right to left ), with fading between each videos ( not between text but between video ).</p>

<p>Actually I have this code that generare a simple video, with text sliding and fade:</p>

<pre><code>ffmpeg -y \
    -loop 1 -t 10 -i img001.jpg  \
    -loop 1 -t 10 -i img002.jpg  \
-filter_complex \
"\
[0:v]\
drawtext=fontfile='IndieFlower.ttf':enable='between(t,0,5)':\
text='Caption 1 Scena 1':\
fontsize=60:fontcolor=white:\
x=t*300*lte(t*300\,(w-text_w)/2)+(w-text_w)/2*gt(t*300\,(w-text_w)/2):y=h-line_h-10:\
shadowx=3:shadowy=3:shadowcolor=black:\
boxborderw=10:box=1:boxcolor=red@0.8,\
drawtext=fontfile='IndieFlower.ttf':enable='between(t,5,10)':\
text='Caption 2 Scena 1':\
fontsize=60:fontcolor=white:\
x=(w-(t-5)*500)*gt(w-(t-5)*500\,(w-text_w)/2)+(w-text_w)/2*lte(w-(t-5)*500\,(w-text_w)/2):y=h-line_h-10:\
shadowx=3:shadowy=3:shadowcolor=black:\
boxborderw=10:box=1:boxcolor=red@0.8\
[final1];\
[1:v]\
fade=t=in:st=0:d=1,\
drawtext=fontfile='IndieFlower.ttf':enable='between(t,0,5)':\
text='Caption 1 Scena 2':\
fontsize=60:fontcolor=red:\
x=t*300*lte(t*300\,(w-text_w)/2)+(w-text_w)/2*gt(t*300\,(w-text_w)/2):y=h-line_h-10:\
shadowx=3:shadowy=3:shadowcolor=white:\
boxborderw=10:box=1:boxcolor=black@0.8,\
drawtext=fontfile='IndieFlower.ttf':enable='between(t,5,10)':\
text='Caption 2 Scena 2':\
fontsize=60:fontcolor=red:\
x=(w-(t-5)*500)*gt(w-(t-5)*500\,(w-text_w)/2)+(w-text_w)/2*lte(w-(t-5)*500\,(w-text_w)/2):y=h-line_h-10:\
shadowx=3:shadowy=3:shadowcolor=white:\
boxborderw=10:box=1:boxcolor=black@0.8\
[final2];\
[final1][final2]concat[final]
" \
-pix_fmt yuvj422p -t 20 -map '[final]' o.mp4
</code></pre>

<p>It works well, but now, I'd like to add a <code>zoompan</code> effect to both of the images; so I change the code as follow:</p>

<pre><code>[0:v]\
format=yuvj422p,
scale=iw*10:ih*10,\
zoompan=z='min(zoom+0.0015,1.5)':d=500:x='iw/2-(iw/zoom/2)':y='ih/2 (ih/zoom/2)':s=640x480,\
drawtext=fontfile='IndieFlower.ttf':enable='between(t,0,5)':\

...

[1:v]\
format=yuvj422p,
scale=iw*10:ih*10, \
zoompan=z='min(zoom+0.0015,1.5)':d=500:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)':s=640x480,\
fade=t=in:st=0:d=1,\
...
</code></pre>

<p>but this does not work; in the final video there is only the first "video", with the zoompan, the second video does not appear at all!</p>

<p>What I'm doing wrong? I'd like to create a simple zoompan between two video.</p>

<ffmpeg>
ffmpeg - Problem with zoompan
GFCoder977
# ffmpeg - Problem with zoompan

(Asked by: username_0 on 2018-02-09)

I'm trying to create a video from a set of images, adding texts to each image that slide from one side to the center ( one left to right, another right to left ), with fading between each videos ( not between text but between video ).
Actually I have this code that generare a simple video, with text sliding and fade:
ffmpeg -y \
    -loop 1 -t 10 -i img001.jpg  \
    -loop 1 -t 10 -i img002.jpg  \
-filter_complex \
"\
[0:v]\
drawtext=fontfile='IndieFlower.ttf':enable='between(t,0,5)':\
text='Caption 1 Scena 1':\
fontsize=60:fontcolor=white:\
x=t*300*lte(t*300\,(w-text_w)/2)+(w-text_w)/2*gt(t*300\,(w-text_w)/2):y=h-line_h-10:\
shadowx=3:shadowy=3:shadowcolor=black:\
boxborderw=10:box=1:boxcolor=red@0.8,\
drawtext=fontfile='IndieFlower.ttf':enable='between(t,5,10)':\
text='Caption 2 Scena 1':\
fontsize=60:fontcolor=white:\
x=(w-(t-5)*500)*gt(w-(t-5)*500\,(w-text_w)/2)+(w-text_w)/2*lte(w-(t-5)*500\,(w-text_w)/2):y=h-line_h-10:\
shadowx=3:shadowy=3:shadowcolor=black:\
boxborderw=10:box=1:boxcolor=red@0.8\
[final1];\
[1:v]\
fade=t=in:st=0:d=1,\
drawtext=fontfile='IndieFlower.ttf':enable='between(t,0,5)':\
text='Caption 1 Scena 2':\
fontsize=60:fontcolor=red:\
x=t*300*lte(t*300\,(w-text_w)/2)+(w-text_w)/2*gt(t*300\,(w-text_w)/2):y=h-line_h-10:\
shadowx=3:shadowy=3:shadowcolor=white:\
boxborderw=10:box=1:boxcolor=black@0.8,\
drawtext=fontfile='IndieFlower.ttf':enable='between(t,5,10)':\
text='Caption 2 Scena 2':\
fontsize=60:fontcolor=red:\
x=(w-(t-5)*500)*gt(w-(t-5)*500\,(w-text_w)/2)+(w-text_w)/2*lte(w-(t-5)*500\,(w-text_w)/2):y=h-line_h-10:\
shadowx=3:shadowy=3:shadowcolor=white:\
boxborderw=10:box=1:boxcolor=black@0.8\
[final2];\
[final1][final2]concat[final]
" \
-pix_fmt yuvj422p -t 20 -map '[final]' o.mp4

It works well, but now, I'd like to add a zoompan effect to both of the images; so I change the code as follow:
[0:v]\
format=yuvj422p,
scale=iw*10:ih*10,\
zoompan=z='min(zoom+0.0015,1.5)':d=500:x='iw/2-(iw/zoom/2)':y='ih/2 (ih/zoom/2)':s=640x480,\
drawtext=fontfile='IndieFlower.ttf':enable='between(t,0,5)':\

...

[1:v]\
format=yuvj422p,
scale=iw*10:ih*10, \
zoompan=z='min(zoom+0.0015,1.5)':d=500:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)':s=640x480,\
fade=t=in:st=0:d=1,\
...

but this does not work; in the final video there is only the first "video", with the zoompan, the second video does not appear at all!
What I'm doing wrong? I'd like to create a simple zoompan between two video.

**Tags:** ffmpeg


---

## 1 answers

### Answer by username_1 on 2018-02-09. Score: 3

zoompan is a weirdly designed filter. It operates on individual frames, whereas most filters operate on a sequence of pictures, whether they are fed from a video file or an image sequence. pzoom should be used for a looped image, and frame sequence generation should be stopped by making d=1.
Change to 
zoompan=z='min(pzoom+0.0015,1.5)':d=1:x='iw/2-(iw/zoom/2)':y='ih/2 (ih/zoom/2)':s=640x480

This will fix the zoompan.

> **Comments:**
> **username_0**: Thanks! It works! Really Thanks! I just have these messages: `[swscaler @ 0x7f3d60016880] deprecated pixel format used, make sure you did set range correctly`, I'm using `-pix_fmt yuvj422p`, is not correct?  
> **username_1**: For final output, `yuv420p` is standard.  
> **username_0**: Thanks, it works. To finish my job, I need to add an mp3 to the process. Should I open a new Ask Question, or you can suggest me how to add this new input to the command above? I tryed adding `[final1][final2][2:0]concat=n=2:v=1:a=1[finalVideo][finalAudio]` but it does not work ( mp3 is the third input )  
> **username_1**: You don't need to add the audio to the concat. Remove the `-map [final]`  

---

