Body: <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>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2021-06-03T07:52:57.877Z
Comments.Text: I assume you are updating the prod.jpg file. If yes, do all the images have the same parameters i.e. dimensions, format ..etc?
Comments.UserDisplayName: Gyan
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2021-06-03T08:06:55.717Z
Comments.Text: yes, I'm updating the prod.jpg file...they do hv same format and dimension
Comments.UserDisplayName: Jason Lin
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2021-06-03T09:15:44.817Z
Comments.Text: Replace `-loop 1` with `-stream_loop -1 -reinit_filter 0`
Comments.UserDisplayName: Gyan
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2021-06-03T13:13:19.633Z
Comments.Text: no luck, the logo still disappeared after updated the product image file...;(
Comments.UserDisplayName: Jason Lin
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2021-06-03T13:20:40.420Z
Comments.Text: 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'.
Comments.UserDisplayName: Jason Lin
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2021-06-03T15:18:51.637Z
Comments.Text: Show your full modified command.
Comments.UserDisplayName: Gyan
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2021-06-08T04:17:01.450Z
Comments.Text: /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
Comments.UserDisplayName: Jason Lin
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2021-06-08T07:10:22.873Z
Comments.Text: Which ffmpeg version?
Comments.UserDisplayName: Gyan
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2021-06-08T07:34:39.763Z
Comments.Text: ffmpeg version n4.3.1
Comments.UserDisplayName: Jason Lin
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2021-06-10T02:08:20.607Z
Comments.Text: I cant seem to find -reinit_filter option in ffmpeg documentation.
Comments.UserDisplayName: Jason Lin
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2021-06-10T04:37:02.883Z
Comments.Text: Wasn't documented when it was added a decade ago. Did so, now.
Comments.UserDisplayName: Gyan
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2021-06-10T07:18:23.850Z
Comments.Text: -stream_loop -1 is actually an acceptable parameter according to document, wonder why it still complains about it...any syntax error in my command?
Comments.UserDisplayName: Jason Lin
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2021-06-11T05:15:11.270Z
Comments.Text: i tested with -stream_loop -1 again, and it works now; but the first image still disappeared after i changed the product picture.
Comments.UserDisplayName: Jason Lin
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2021-06-11T06:07:09.077Z
Comments.Text: Apply it to both images.
Comments.UserDisplayName: Gyan
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2021-06-13T04:22:14.717Z
Comments.Text: yup, did that, and it works now....;)...thanks!
Comments.UserDisplayName: Jason Lin
Tags: <ffmpeg>
Title: Adding a static overlay logo into ffmpeg video stream and switch another which maintaining the logo
UserDisplayName: Jason Lin
ThreadText: # 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
  
  