Combine multiple images to form a strip of images ffmpeg
Solution 1
Use the tile filter
Using the scale and tile video filters with input files 001.png
to 005.png
:
ffmpeg -i %03d.png -filter_complex "scale=120:-1,tile=5x1" output.png
If you have file names that are in a non-numbered sequential order you can use the glob pattern type (not supported by Windows):
ffmpeg -pattern_type glob -i "*.png" -filter_complex tile=5x1 output.png
Margin / border
You can also add a margin (outer border space) and padding (space between frames):
ffmpeg -i %03d.png -filter_complex "scale=120:-1,tile=5x1:margin=10:padding=4" output.png
Default color is black. Add the color
option if you want to change the border/margin color:
ffmpeg -i %03d.png -filter_complex "scale=120:-1,tile=5x1:margin=10:padding=4:color=white" output.png
A vertical orientation is possible. tile=1x5
for this example:
More info
See the tile filter documentation.
Solution 2
If you've got do it with ffmpeg
then I don't know. If you want to get the job done and are willing to use another program suitable for the task then convert
is part of ImageMagick.
convert sepimage-0.png sepimage-1.png sepimage-2.png -channel RGB \
-combine imagecopy.png
Related videos on Youtube
Comments
-
Manu almost 2 years
I wish to combine multiple images into a single strip of images, using FFMPEG.
I have been trying to search this thing on google, but unable to find anything useful. All links take me to places where multiple images are combined to give a video output.
Assuming that all the files are of the same width and height, how can I join them to get a single strip of images. Can anybody help me?
-
Manu almost 11 yearsNumber of images would be variable. It can range from 10 to several 100s. And I want a horizontal strip.
-
-
whitewings over 9 yearsThe images need to be the same size, otherwise the output just creates duplicates of the images.
-
user2988257 over 5 yearsI'm using your command but the result I'm getting is (only first image is shown, all other are black): i.ibb.co/zPgPJ0V/Untitled.png
-
Elisa Cha Cha over 5 years@user2988257 I can't duplicate that behavior. Provide a link to a pastebin that shows your full command and the complete console output.
-
Abhay Koradiya about 3 years@llogan If I have single image then How can I create tile from that?
-
Elisa Cha Cha about 3 years@AbhayKoradiya
ffmpeg -i input.jpg -i input.jpg -i input.jpg -filter_complex "[0][1][2]hstack=inputs=3" -vframes 1 output.jpg
See Vertically or horizontally stack (mosaic) several videos using ffmpeg? -
Kong almost 3 yearshow can i set the color of the padding to be white?
-
Elisa Cha Cha almost 3 years@Kong According to the tile filter documentation use the
color
option:ffmpeg -i %03d.png -filter_complex "scale=120:-1,tile=5x1:margin=10:padding=4:color=white" output.png
-
Tony M about 2 yearsI wanted to simply tile images together without reducing image quality and found this post. I modified it for my task using: ffmpeg -i %03d.png -filter_complex "tile=5x1" tiled.png What a great function: just by changing tile to untile you reverse the effect, and using 1x5 gives you vertical stitching.
-
Ciro Santilli Путлер Капут 六四事 about 2 yearsYes, this is definitely a job for ImageMagick, not ffmpeg! stackoverflow.com/questions/20737061/…