How to use multiple palettegen arguments in FFMPEG - 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

Related

add current video time with ffmpeg

I can add frame number to video with ffmpeg as below:
ffmpeg -y -i input.mp4 -an -vf drawtext=fontsize=36:fontcolor=yellow:text='%{frame_num}':x=20:y=20 -f mp4 output.mp4
How can I modify it to show HH:MM:SS instead of current frame number?
As #kesh pointed out pts:hms instead of frame_num does the job but your specific command line, will lead you astray, as you have omitted a set of encapsulating quotes.
Whilst omitting them, works with frame_num, it will not work with pts:hms
Use:
ffmpeg -y -i input.mp4 -an -vf "drawtext=fontsize=36:fontcolor=yellow:text='%{pts\:hms}':x=20:y=20" -f mp4 output.mp4
Here the entire drawtext filter is wrapped in quotation marks.
Edit:
To achieve pure HH:MM:SS format use gmtime rather than hms i.e.
ffmpeg -y -i input.mp4 -an -vf "drawtext=fontsize=36:fontcolor=yellow:text=' %{pts\:gmtime\:0\:%T}':x=20:y=20" -f mp4 output.mp4

FFmpeg format error when using alphaextract

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

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 output to MacOSX screen?

How do I route ffmpeg output to the screen on MacOSX?
If I type:
ffmpeg -i input.mp4 -i logo.png -filter_complex overlay output.mp4
The output file contains the input file with the logo overlayed on top of it.
If I type:
ffplay -i input.mp4 -i logo.png -filter_complex overlay
Then it throws the error:
Argument 'logo.png' provided as input filename, but 'input.mp4' was already specified.
...but typing:
ffplay -filters
displays a list of filters including:
T.C overlay VV->V Overlay a video source on top of the input.
Clearly, I'm missing something obvious.
How do I route ffmpeg output to the screen, and where can I find a list of which filters and options work in ffmpeg but not in ffplay?
With lots of help from Mortiz and Carl on the ffmpeg-user mailing list, I have an incantation that works in both ffmpeg and ffplay:
ffplay -i input.mp4 -vf movie=logo.png,[in]overlay
and:
ffmpeg -i input.mp4 -vf movie=logo.png,[in]overlay test.mp4

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