video from images, but only imagemagick created pixelized - ffmpeg

I am trying to make video from images. First i create images with imagemagick (simple version):
convert -background transparent -size 1280x720 -gravity center
caption:'text' 0.png
then ffmpeg(simple version):
ffmpeg -framerate 0.5 -i 0.png debug.mp4
and this is what happens: http://prntscr.com/qy5i08 do you see the difference? Image and video resolution is the same 1280x720
I used another png image not created with imagemagick and there is no difference. Why is that?

The issue was -background transparent
When using background black than the quality is normal.

Related

ffmpeg: pad filter with transparent background for GIF input/output?

I'm trying to pad the GIF source to a square thumbnail and the extended area should be transparent.
(image source: https://store.steampowered.com/app/2113680/The_Dot/)
To achieve the goal, I used the following command:
ffmpeg -i ./test/source.gif -filter_complex "[0]scale=255:144[s1];[s1]pad=256:256:0:-56:blue[s2];[s2]split[s3][s4];[s3]palettegen=reserve_transparent=on:transparency_color=blue[p];[s4][p]paletteuse[s5]" -map [s5] -loop 0 ./test/output.gif -y
[0]scale=255:144[s1] First I scale down the image.
[s1]pad=256:256:0:-56:blue[s2] Then pad the image with an uncommon background color: blue
[s2]split[s3][s4] And I split to two streams. One for palettegen and another for paletteuse.
[s3]palettegen=reserve_transparent=on:transparency_color=blue[p] Generate the color palette that indicates blue as the transparency_color
[s4][p]paletteuse[s5] Use the new color palette for output. The padded image with blue background color should be treated as a transparent background.
But the output animated GIF still has a visible blue background color no matter if I put the paletteuse at first or in the end.
Related posts:
Making GIFs with ffmpeg: what does "transparency_color" do?
How do I resize an animated GIF and keep transparency?
Transparency is gone while resizing (scaling) gif using ffmpeg
overlay on transparent background:
ffmpeg -i 74bRi.gif -filter_complex "
color=s=256x256:d=100,format=argb,colorchannelmixer=aa=0.0[b];
[0]scale=255:144[f];
[b][f]overlay=(W-w)/2:(H-h)/2:shortest=1,split[s1][s2];
[s1]palettegen[p];
[s2][p]paletteuse
" -loop 0 output.gif
pad using transparent color ffffff00
ffmpeg -i 74bRi.gif -filter_complex "
[0]scale=255:144,pad=256:256:0:-1:ffffff00,split[s1][s2];
[s1]palettegen[p];
[s2][p]paletteuse
" -loop 0 out.gif

ffmpeg gif with color instead transparency [duplicate]

I'm converting a PNG to JPG. The transparent background turns black by default. I need it to be white.
What is the FFmpeg command to set the alpha channel to a color?
I think it has something to do with the alphamerge and alphaextract Filters.
ffmpeg -i image.png -qscale:v 2 image.jpg
This replaces white with transparency when converting to png:
-vf chromakey=white
You can use the geq filter.
ffmpeg -i in.png -vf format=yuva444p,geq='if(lte(alpha(X,Y),16),255,p(X,Y))':'if(lte(alpha(X,Y),16),128,p(X,Y))':'if(lte(alpha(X,Y),16),128,p(X,Y))' out.jpg
If your alpha is a pure black and white image, change 16 to 1.

FFMPEG documentation example for chromakey doesn't work for green background png file

Im new in FFMPEG and I try to make just simple green background chroma keying of png images.
In FFMPEG documentation in 38.16 Chromakey - there is an example script:
ffmpeg -i input.png -vf chromakey=green out.png
for which is said that "Make every green pixel in the input image transparent"
That exactly what i wanted.
I tried with many different png images but the result is always a copy of input image.
Also i replaced the word "green" to 0x00FF00 or 0x008000 and still no successes. Only when replacing green to black and then the result is as expected - transparent.
Im working on Windows with pre-build binaries of FFMpeg.
What am I missing?
Thanks.
When working with RGB pixel formats (like in PNG), use the colorkey filter. Also, specify colour as hex codes, since ffmpeg's colour labels may not match what you expect e.g. Green is 0x008000, and not 0x00FF00.
Use
ffmpeg -i input.png -vf colorkey=0x00FF00 out.png
Yes
ffmpeg -i input.png -vf colorkey=0x008000 out.png
works.
I also found / after so much reading other related information/ that "chromakey" CAN work as well. Here is how
ffmpeg -i input.png -vf "chromakey=0x008000:0.1:0.1" -c copy -c:v png out.png
this work fine as well - the reason is codec -c:v of png.
A little bit more info- when i compared the results from #Gyan method and the second method - the second method produce much more anti aliased result.

How to Convert PNG Transparent Background to JPG White Background?

I'm converting a PNG to JPG. The transparent background turns black by default. I need it to be white.
What is the FFmpeg command to set the alpha channel to a color?
I think it has something to do with the alphamerge and alphaextract Filters.
ffmpeg -i image.png -qscale:v 2 image.jpg
This replaces white with transparency when converting to png:
-vf chromakey=white
You can use the geq filter.
ffmpeg -i in.png -vf format=yuva444p,geq='if(lte(alpha(X,Y),16),255,p(X,Y))':'if(lte(alpha(X,Y),16),128,p(X,Y))':'if(lte(alpha(X,Y),16),128,p(X,Y))' out.jpg
If your alpha is a pure black and white image, change 16 to 1.

Specify background colour when generating movie from images

I generate a video from png images using
ffmpeg -i visualization/%d.png -c:v libx264 -vf "scale=500:trunc(ow/a/2)*2" -pix_fmt yuv420p z.mov
and if images have transparencies, they become black. Can I somehow make them white?
Before running ffmpeg, use ImageMagick to "flatten" each PNG against white.
mogrify -background white -flatten visualization/*.png

Resources