Adding more than one image in front of video in ffmpeg - ffmpeg

I'm using this command to put image in fromt of video in ffmpeg:
ffmpeg -re -i input -i myimage -filter_complex "overlay=10:10" -f mpegts udp://127.0.0.1:port
I need to put another image in differant position but on the same video, is there any way to do it ?

You would use
ffmpeg -re -i input -i image1 -i image2 \
-filter_complex "[0][1]overlay=10:10[a];[a][2]overlay=W-10:10" \
-f mpegts udp://127.0.0.1:port

Related

How to apply any mask.png on a video with ffmpeg

I am adding a 1.mp4 on a video 2.mp4, and i want to add a mask on overlay video(1.mp4)
I want to apply this mask on 1.mp4
I'm using chrome key right now
ffmpeg -t 5 -r 30 -f lavfi -i color=c=black:s=640x360
-i 1.mp4
-i mask2.png
-i 2.mp4
-filter_complex "
[1:v]scale=500x281[v1];
[2]scale=500x281[mask];
[v1][mask]overlay, chromakey=0x00FF00:0.25:0.08 [v2];
[3:v]scale=640x360[v3];
[0][v3]overlay [out1];
[out1][v2]overlay=0:0"
-y output.mp4
But it also removes color from videos.
I'm not sure but i think it can be done by negate
also i don't need audio command, i already done that part
Thanks

Problem in setting video thumbnail with ffmpeg

I'm trying to add thumbnail to a mkv video with the following command: ffmpeg -y -i video.mkv -i image.jpg -map 1 -map 0 -c copy -disposition:0 attached_pic out.mkv. However this command replaces all frames in the video with that image and no sound. Am I doing something wrong. I'm using latest version of ffmpeg.
What you tried works for MP4 file and not for MKV file. Try this:
ffmpeg -y -i video.mkv -i image.jpg \
-attach image.jpg -metadata:s:t mimetype=image/jpeg \
-c copy out.mkv

ffmpeg matches no streams Stream specifier '' in filtergraph description

ffmpeg -y -i a.mp4 -i b.mp3 -filter_complex '[0]volume=1,atrim=start=0:end=5,adelay=0|0[aud0];[1]volume=1,atrim=start=0:end=5.796,adelay=0|0[aud1];[aud0][aud1]amix=2' mergeAudio.mp3
a.mp4 only video stream!
how to repair the code
enter image description here
In this particular case, use the anullsrc filter to generate a silent stream and use that in amix.
ffmpeg -y -i a.mp4 -i b.mp3 -f lavfi -i anullsrc -filter_complex '[2]volume=1,atrim=start=0:end=5,adelay=0|0[aud0];[1]volume=1,atrim=start=0:end=5.796,adelay=0|0[aud1];[aud0][aud1]amix=2' mergeAudio.mp3

ffmpeg stream loop video forward and in reverse

I want to take an input video and horizontally concatenate it with itself in reverse (play it forwards then backwards) using a filter_complex. So far I have split it over 3 commands, reversing, concatenating, and streaming, but I want to do it in one command. The following streams a video twice but I don't know how to reverse the second video. How does one reverse the second copy of the video without changing the first one?
ffmpeg -re -stream_loop -1 -i self_recording.mkv -filter_complex \
"[0:v]split=2[r1][r2];[0:v][r1][0:v][r2] concat=n=4:v=1[v]" \
-map "[v]" -f v4l2 /dev/video2
Video Prep:
ffmpeg -i "$video" -i "$watermark" \
-filter_complex "[0]split=2[fr][rv];[rv]reverse[rv]; \
[fr][rv]concat=n=2:v=1:a=0,$memestr,$rotatestr[jt]; \
[1][jt]scale2ref[i][m];[m][i]overlay=format=auto,format=yuv420p[v]" \
-map "[v]" -g 30 stream.mp4
Stream:
ffmpeg -stream_loop -1 -re -i "stream.mp4" -c copy -f v4l2 "/dev/video$output"

FFMPEG picture in picture and watermark

I'm trying to take create a picture in picture effect with 2 videos and add a watermark with 1 command. Here's what I have so far, it works great, except the watermark is on the picture in picture video, not the main background video. How do I make the watermark on the main video?
ffmpeg -y -i pip.mp4 -i main.mp4 -i logo.png -filter_complex \
"[0]scale=iw/4:-1[pip]; \
[pip][2]overlay=10:10[watermark]; \
[1][watermark]overlay=main_w-overlay_w-10:main_h-overlay_h-10" output.mp4
Rearrange your labels:
ffmpeg -y -i pip.mp4 -i main.mp4 -i logo.png -filter_complex \
"[0]scale=iw/4:-1[pip]; \
[1][pip]overlay=10:10[watermark]; \
[watermark][2]overlay=main_w-overlay_w-10:main_h-overlay_h-10" output.mp4

Resources