FFmpeg format error when using alphaextract - ffmpeg

I'm trying to mask an image using a png circle
When I use alphaextract, I get this error:
The following filters could not choose their formats: Parsed_alphaextract_X
Here's my command:
ffmpeg -i "https://i.imgur.com/aZkbbWn.jpeg" -i "https://i.imgur.com/jVNCqIj.png" -filter_complex "[0]scale=200:200[ava];[1]scale=200:200,alphaextract[alfa];[ava][alfa]alphamerge" circle_ava.png
I tried adding format=yuv420p, to input [1] but it didn't help
I also tried adding -pix_fmt yuv420p as the first parameter, but no luck
Any help is appreciated

I fixed it with format=rgba
ffmpeg -i "https://i.imgur.com/aZkbbWn.jpeg" -i "https://i.imgur.com/jVNCqIj.png" -filter_complex "[0]scale=200:200[ava];[1]scale=200:200,format=rgba,alphaextract[alfa];[ava][alfa]alphamerge" circle_ava.png

Related

FFMPEG Overlay Not Found For Putting Watermark in Video

I am trying to put a logo in an rtmp stream using ffmpeg. My version of ffmpeg is ffmpeg version 4.3.1 Currently in my complex filter I have:
ffmpeg -re -i 'video.mp4' -filter_complex "tpad=start_duration=10:stop_duration=15:start_mode=add:color=black:stop_mode=add" -f flv rtmp://example.com/a/stream
And it works! But when I add :overlay=0:0 at the end:
ffmpeg -re -i 'video.mp4' -i image.jpeg -filter_complex "tpad=start_duration=10:stop_duration=15:start_mode=add:color=black:stop_mode=add:overlay=0:0" -f flv rtmp://example.com/a/stream
I get the errors:
[Parsed_tpad_0 # 0x555bc5d99f40] Option 'overlay' not found
[AVFilterGraph # 0x555bc5e7a980] Error initializing filter 'tpad' with args 'start_duration=10:stop_duration=15:start_mode=add:color=black:stop_mode=add:overlay=0:0'
Error initializing complex filters.
Option not found
What might I be doing wrong?
ffmpeg -re -i 'video.mp4' -i image.jpeg -filter_complex "tpad=start_duration=10:stop_duration=15:start_mode=add:color=black:stop_mode=add[bg];[bg][1]overlay" -f flv rtmp://example.com/a/stream
The overlay filter requires 2 inputs but you are only giving it 1.
Filters in the same linear chain are separated by commas (,) and distinct linear chains of filters are separated by semicolons (;). See FFmpeg Filtering Introduction.

FFMPEG Add 2 watermarks to an Image using single command

How to add 2 watermarks to one image using ffmpeg. This is the command I am using for adding single watermark
ffmpeg -i actual-image.jpg -i watermark.png -filter_complex "overlay=5:5" output.jpg
But i am not able to add 2 arguments for this. Thanks for help in advance
Apply 2 overlays. The 2nd overlay will use the result of the first overlay as its base input.
ffmpeg -i actual-image.jpg -i watermark1.png -i watermark2.png -filter_complex "[0][1]overlay=5:5[vid1];[vid1][2]overlay=300:300" output.jpg

How to use multiple palettegen arguments in FFMPEG

I am creating a palette with FFMPEG using the following:
ffmpeg -i movie.mov -vf palettegen=max_colors=5 palette.gif
I want to use additional features such as reserve_transparent as mentioned in the FFMPEG palettegen docs, but having trouble getting it to work:
ffmpeg -i movie.mov -vf palettegen=max_colors=5,reserve_transparent=1 palette.gif
What am I doing wrong?
Options for a filter are separated by a colon, so
ffmpeg -i movie.mov -vf palettegen=max_colors=5:reserve_transparent=1 palette.gif

how to output gif with same size as input video

I am following How do I convert a video to GIF using ffmpeg, with reasonable quality?
It gives example:
ffmpeg -i input.flv -i palette.png -filter_complex "fps=10,scale=320:-1:flags=lanczos[x];[x][1:v]paletteuse" output.gif
However I want the gif output to be the same size as video and not 320 as specified here so I removed scale=320:-1 so I have
ffmpeg -i input.flv -i palette.png -filter_complex "fps=10,flags=lanczos[x];[x][1:v]paletteuse" output.gif
When I run that I get:
No such filter: 'flags' Error initializing complex filters.
If I remove:
-filter_complex "fps=10,flags=lanczos[x];[x][1:v]paletteuse"
Then it works but quality of the video is bad. So it seems that I must use a scale for those palette flags to work, how can I get ffmpeg to output gif same size as input video?
Omit the scale filter
By default the output uses the same width and height as the input. The :flags=lanczos was part of the scale filter. So your command will look like:
ffmpeg -i in.flv -i palette.png -filter_complex "fps=10[x];[x][1:v]paletteuse" out.gif
I have figured it out:
ffmpeg -i video.mkv -y -i palette.png -filter_complex "fps=10,scale=iw:ih:flags=lanczos[x];[x][1:v]paletteuse" output_mkv.gif
scale=iw:ih does the trick, same size as input video

how to use -filter and vf command on ffmpeg?

I'm using this code for crop video:
crop=2/3*in_w:2/3*in_h
And using change colors:
-vf mp=eq2=3.0:0.0:1.0:0.0:3.0:3.0:1.0
How do i using combine this command?
I tried this code but colors are not working
ffmpeg -i in.mp4 -vf mp=eq2=3.0:0.0:1.0:0.0:3.0:3.0:1.0 -filter:v "crop=2/3*in_w:2/3*in_h" out.mp4
Thanks for help.
Merge your 2 filters like below:
ffmpeg -i in.mp4 -vf "mp=eq2=3.0:0.0:1.0:0.0:3.0:3.0:1.0, crop=2/3*in_w:2/3*in_h" out.mp4

Resources