<p>I intend to add a logo and loop a set of pictures on top of a RTMP stream, my current command is as follows:</p>
<p>ffmpeg -i rtmp://127.0.0.1:1935/live/xxx -i logo.png -f image2 -loop 1 -i prod.jpg -filter_complex [0:v][1:v]overlay=x=30:y=10[vt];[vt][2:v]overlay=x='if(lte(-w+(t)*100,200),-w+(t)*100+100,230)':y=10 -framerate 25 -r 30 -ar 44100 -c:a copy -b:a 20000k -movflags +faststart -preset medium -crf 1 -tune zerolatency -maxrate 20000k -vcodec libx264 -fflags nobuffer -g 60 -max_muxing_queue_size 1024 -f flv pipe:1</p>
<p>however I notice when it loops to a new prod.jpg file, the logo would disappear.</p>
<p>Thus I need some clues on command to loop the product pictures but maintaining the logo.</p>

CC BY-SA 4.0
2021-06-03T07:52:57.877Z
I assume you are updating the prod.jpg file. If yes, do all the images have the same parameters i.e. dimensions, format ..etc?
Gyan
CC BY-SA 4.0
2021-06-03T08:06:55.717Z
yes, I'm updating the prod.jpg file...they do hv same format and dimension
Jason Lin
CC BY-SA 4.0
2021-06-03T09:15:44.817Z
Replace `-loop 1` with `-stream_loop -1 -reinit_filter 0`
Gyan
CC BY-SA 4.0
2021-06-03T13:13:19.633Z
no luck, the logo still disappeared after updated the product image file...;(
Jason Lin
CC BY-SA 4.0
2021-06-03T13:20:40.420Z
actually it complains about invalid parameter -1 (I guess it points to -1 after -stream_loop); when I removed change '-1' to '1', it says 'Could not open file : 1'.
Jason Lin
CC BY-SA 4.0
2021-06-03T15:18:51.637Z
Show your full modified command.
Gyan
CC BY-SA 4.0
2021-06-08T04:17:01.450Z
/var/lib/snapd/snap/bin/ffmpeg -threads 1 -i rtmp://127.0.0.1:1935/live/$key -i /home/apache/$key/logo.png -f image2  -stream_loop -1 -reinit_filter 0 -i /home/apache/$key/prod.jpg -filter_complex  "[0][1]overlay=x=30:y=10[v1];[v1][2]overlay=x=main_w-overlay_w-5:y=10[v2]" -map "[v2]" -map 0:a -framerate 25 -ar 44100  -c:a copy -b:a 20000k -movflags +faststart -preset medium -crf 1 -tune zerolatency  -maxrate 20000k -vcodec libx264 -fflags nobuffer  -g 60 -max_muxing_queue_size 1024  -f flv pipe:1
Jason Lin
CC BY-SA 4.0
2021-06-08T07:10:22.873Z
Which ffmpeg version?
Gyan
CC BY-SA 4.0
2021-06-08T07:34:39.763Z
ffmpeg version n4.3.1
Jason Lin
CC BY-SA 4.0
2021-06-10T02:08:20.607Z
I cant seem to find -reinit_filter option in ffmpeg documentation.
Jason Lin
CC BY-SA 4.0
2021-06-10T04:37:02.883Z
Wasn't documented when it was added a decade ago. Did so, now.
Gyan
CC BY-SA 4.0
2021-06-10T07:18:23.850Z
-stream_loop -1 is actually an acceptable parameter according to document, wonder why it still complains about it...any syntax error in my command?
Jason Lin
CC BY-SA 4.0
2021-06-11T05:15:11.270Z
i tested with -stream_loop -1 again, and it works now; but the first image still disappeared after i changed the product picture.
Jason Lin
CC BY-SA 4.0
2021-06-11T06:07:09.077Z
Apply it to both images.
Gyan
CC BY-SA 4.0
2021-06-13T04:22:14.717Z
yup, did that, and it works now....;)...thanks!
Jason Lin
<ffmpeg>
Adding a static overlay logo into ffmpeg video stream and switch another which maintaining the logo
Jason Lin
# Adding a static overlay logo into ffmpeg video stream and switch another which maintaining the logo

(Asked by: username_0 on 2021-06-03)

I intend to add a logo and loop a set of pictures on top of a RTMP stream, my current command is as follows:

ffmpeg -i rtmp://127.0.0.1:1935/live/xxx -i logo.png -f image2 -loop 1 -i prod.jpg -filter\_complex [0:v][1:v]overlay=x=30:y=10[vt];[vt][2:v]overlay=x='if(lte(-w+(t)\*100,200),-w+(t)\*100+100,230)':y=10 -framerate 25 -r 30 -ar 44100 -c:a copy -b:a 20000k -movflags +faststart -preset medium -crf 1 -tune zerolatency -maxrate 20000k -vcodec libx264 -fflags nobuffer -g 60 -max\_muxing\_queue\_size 1024 -f flv pipe:1

however I notice when it loops to a new prod.jpg file, the logo would disappear.

Thus I need some clues on command to loop the product pictures but maintaining the logo.

**Tags:** ffmpeg

> **Comments:**
> **username_1**: I assume you are updating the prod.jpg file. If yes, do all the images have the same parameters i.e. dimensions, format ..etc?  
> **username_0**: yes, I'm updating the prod.jpg file...they do hv same format and dimension  
> **username_1**: Replace `-loop 1` with `-stream_loop -1 -reinit_filter 0`  
> **username_0**: no luck, the logo still disappeared after updated the product image file...;(  
> **username_0**: actually it complains about invalid parameter -1 (I guess it points to -1 after -stream_loop); when I removed change '-1' to '1', it says 'Could not open file : 1'.  
> **username_1**: Show your full modified command.  
> **username_0**: /var/lib/snapd/snap/bin/ffmpeg -threads 1 -i rtmp://127.0.0.1:1935/live/$key -i /home/apache/$key/logo.png -f image2  -stream_loop -1 -reinit_filter 0 -i /home/apache/$key/prod.jpg -filter_complex  "[0][1]overlay=x=30:y=10[v1];[v1][2]overlay=x=main_w-overlay_w-5:y=10[v2]" -map "[v2]" -map 0:a -framerate 25 -ar 44100  -c:a copy -b:a 20000k -movflags +faststart -preset medium -crf 1 -tune zerolatency  -maxrate 20000k -vcodec libx264 -fflags nobuffer  -g 60 -max_muxing_queue_size 1024  -f flv pipe:1  
> **username_1**: Which ffmpeg version?  
> **username_0**: ffmpeg version n4.3.1  
> **username_0**: I cant seem to find -reinit_filter option in ffmpeg documentation.  
> **username_1**: Wasn't documented when it was added a decade ago. Did so, now.  
> **username_0**: -stream_loop -1 is actually an acceptable parameter according to document, wonder why it still complains about it...any syntax error in my command?  
> **username_0**: i tested with -stream_loop -1 again, and it works now; but the first image still disappeared after i changed the product picture.  
> **username_1**: Apply it to both images.  
> **username_0**: yup, did that, and it works now....;)...thanks!  

---

## 0 answers

