[FFmpeg-user] Create slideshow with ffmpeg from still images

thljcl jiachielee at live.com
Tue Jul 30 21:29:58 CEST 2013

Well, let me explain why there is a big difference of average bit rate
between “Relativity” and “Wallpapers”. I said previously that “Wallpapers”
is considerably longer, thus having much larger file size. But you may have
argued that there is a big difference in average bit rate as well. The
average bit rate of “Relativity” is around 70 kbps; but the average bit rate
of “wallpapers” is around 765 kbps. It’s more than ten times larger!
The story to be told here is actually about how lossless compression for
image/video works. I actually wrote much about it at my web site at
http://bit.ly/17RMRLW and http://bit.ly/18LfN9F. Granted, my web site is not
exactly top ten web site in any rank. I’m pretty lazy to update it regularly
as well.
That said, I would still tell the theory here, if you are interested. If
not, just ignore this post.
The general idea is that “lossless compression” relies on the ability to
find redundancy of data. For example, how much will the file size for an
image of 1280 × 720 pixels? Is it possible to tell the file size by knowing
the resolution? The answer is yes, for uncompressed image file, if we know
the other factor that affects the file size, which is bit depth. The bit
depth reported by Media Player Classic Home Cinema should be more accurately
called ‘bit per channel’. A 24-bit image has three channels; the bit per
channel is 8 bit. For an uncompressed image file, the file size can be
Resolution × bit depth × 1/8
In the case for a 24-bit image file of 1280 × 720 pixels,
1280×720×24×1/8 Bytes = 2,764,800 Bytes ≈ 2.64 MiB
Well, you don’t have to take my words for granted. Just open Microsoft Paint
and create a BMP file. The BMP file has contain other information, such as
header and so on; the actual file size is actually slightly bigger.
As such a one-minute uncompressed video of 1280 × 720 pixels and 24 FPS
would have the file size of 3,981,312,000 Bytes or approximately 3.71 GiB.
By default, when you create a new image file using Microsoft Paint, it only
has one color, which is white. Bit depth specify the number of possible
colors that a pixel can represent. In an image file, a pixel represent a
single color. 24 bit would mean 16,777,216 possible colors. But since a
pixel can only represent a color, an image file of 1280 × 720 pixels can at
most has 921,600 colors. Human eyes can only discriminate up to 10 million
colors; thus 24 bit is more than enough in most cases. If you save that
“empty” image file to PNG file, the file size is reduced to only 4.16 KiB.
PNG is a lossless file format. That is possible because of the redundancy;
meaning that all other pixels sharing the same colors. If your image file
has 921,600 colors, no matter which lossless file format you choose, you
should get the file size of very close, if not the same.
Of course, as I explained previously, when it comes to lossless encoding of
videos, there is also inter-frame compression, meaning that if redundancy of
data across the frames is spotted, the encoder can reduce the file size as
well. That would explain the great difference of average bit rate between
“Wallpapers” and “Relativity”. “Wallpapers” are made from photographs; they
do have more colors compared with “Relativity”, which contains more texts
(single-color) and single-color background.
In fact, you can create a slideshow video directly from PowerPoint. The
downside is that you cannot specify the length of each slide, the
compression level, frame rate, or basically every encoding setting.
PowerPoint allows us to save the slides to PNG files, which I used to create
the slideshow using ffmpeg.
Also, I don’t keep PNG files. I can always extract them from lossless H.264
video file when I need them for editing. The reason is to save storage

View this message in context: http://ffmpeg-users.933282.n4.nabble.com/Create-slideshow-with-ffmpeg-from-still-images-tp4660277p4660333.html
Sent from the FFmpeg-users mailing list archive at Nabble.com.

More information about the ffmpeg-user mailing list