I have code
ffmpeg -loop 1 -t 24 -i "image.jpg" -filter_complex "color=000000:s=640x360[bg];[bg][0]overlay=shortest=1:y='min(0,-(t)*26)'" -qscale 1 -y out.mpg
How to change this code so that instead of a black base color there was a background in the form of an image?
I will be grateful for the help!
Add another image input and use it as the background in the overlay:
ffmpeg -y -i background.jpg -loop 1 -t 24 -i "image.jpg" -filter_complex "[0][1]overlay=y='min(0,-(t)*26)'" -qscale 1 out.mpg
Related
When overlaying a text or image(test.jpg) to a background image(bg.png),output video background color is getting darker.
here input image has an alpha value .
ffmpeg -loop 1 -i bg.png -i test.jpg -y -filter_complex "[0:v][1:v] overlay=25:25,-pix_fmt yuv420p" -shortest -t 10 tesy.mp4
Output excepted : https://i.stack.imgur.com/e5C3x.png
Output I got is
https://i.stack.imgur.com/reujS.png
If you see background color has huge differnce in the output I got
Below is the background image(bg.png) to which i am overlaying some image(test.jpg)
Use this image and overlay a test image, and let me know the difference in background color .
Add the premultiply filter for these particular PNG files:
ffmpeg -y -loop 1 -i bg.png -i test.jpg -filter_complex "[0]premultiply=inplace=1[bg];[bg][1:v]overlay=25:25:format=auto,format=yuv420p" -t 10 output.mp4
Or create the PNG with no alpha.
Or use the color filter to make the background:
ffmpeg -y -f lavfi -i color=c=purple:s=1280x720 -i test.jpg -filter_complex "[0][1]overlay=25:25:format=auto,format=yuv420p" -t 10 output.mp4
I am trying to make 15 second video where the background layer is a video made up of 2 images, the first line creates a 15 second video from 2 images.
I chose a small framerate so it renders an mp4 quickly. I then overlay a webm video (which has transparency) over the images. The final video seems to keep the framerate of 2, but i would rather keep the 24 framerate of the webm video.
Is this possible? & is it also possible to turn the below into 1 statement.
ffmpeg -loop 1 -framerate 2 -t 11 -i image1.png -loop 1 -framerate 2 -t 4 -i image2.png -filter_complex "[0][1]concat=n=2" backgroundvideo.mp4;
ffmpeg -i backgroundvideo.mp4 -c:v libvpx-vp9 -i overlayvideo.webm -filter_complex overlay newvid.mp4
You can use the filter fps to adjust your background's framerate
ffmpeg \
-loop 1 -framerate 2 -t 11 -i image1.png \
-loop 1 -framerate 2 -t 4 -i image2.png \
-c:v libvpx-vp9 -i overlayvideo.webm \
-filter_complex '[0][1]concat,fps=24[bg];[2][bg]overlay' \
backgroundvideo.mp4
Hi I'm using zoompan to resize an image overlay on a video using ffmpeg, but my image got cut off by the boundary after setting its size, like the following:
ffmpeg -y -i 6.mp4 -loop 1 -i watermark.png -filter_complex "[1:v]zoompan=z=2:d=50:x=0:y=0:s='280x105'[1v];[0:v][1v]overlay=x=0:y=0" -t 8 test.mp4
If I remove the size, it becomes really big covering all screen, like following:
ffmpeg -y -i 6.mp4 -loop 1 -i watermark.png -filter_complex "[1:v]zoompan=z=2:d=50:x=0:y=0[1v];[0:v][1v]overlay=x=0:y=0" -t 8 test.mp4
How do we zoom an overlay image while scaling its size?
I'm trying to first adjust the contrast of a frame extracted from an mp4, then overlay the histogram of the resultant frame on top. My command here does all of this, but also adjusts the contrast of the histogram itself. Is there a single ffmpeg command that can do what I wish?
ffmpeg -ss 3.5 -i in.mp4 -an -y -vf \
"split=2[a][b],[b]eq=0.5:0:1:1:1:1:1,histogram=levels_mode=logarithmic:\
components=1:level_height=100, [a]overlay,eq=0.5:0:1:1:1:1:1" \
-vframes 1 -q:v 2 out.jpg
Use
ffmpeg -ss 3.5 -i in.mp4 -an -y -filter_complex \
"eq=0.5:0:1:1:1:1:1,split=2[a][b];[b]histogram=levels_mode=logarithmic:\
components=1:level_height=100[b];[a][b]overlay" -vframes 1 -q:v 2 out.jpg
The command is ffmpeg -loop 1 -t 5 -i "demo_1.jpg" -filter_complex "nullsrc=size=640x360[background];[background][0:v]overlay=shortest=1:x='min(-(t)*20,0)'" -qscale 1 -y out.mp4
I am animating the image from right to left. In the above command, I need to add text, How to integrate the drawtext feature of ffmpeg to that.
The video animation is https://youtu.be/teXUiPKX83o.
Need to add text to that video.
Use
ffmpeg -loop 1 -t 5 -i "demo_1.jpg" -filter_complex
"nullsrc=size=640x360[background];
[background][0:v]overlay=shortest=1:x='min(-(t)*20,0)',
drawtext=fontfile='/path/to/font':fontsize=30:fontcolor=yellow:x=50:y=50:text='Text'"
-qscale 1 -y out.mp4
See drawtext docs for more info.