<p>I have a number of images in RGB bitmap form (8 bits each for red, green, blue; each pixel is 32 bits). I want to convert these individual images to a video, showing each image for 1-2 seconds, using C++ code in my app.</p>
<p>It is important that the images in the video be pixel-by-pixel identical with the original bitmap pixels. Lossless, in the mathematical sense. I am not concerned with file size, etc.</p>
<p>The resulting video needs to be playable on VLC, and preferably on other common media players.</p>
<p>The two approaches I have considered are the ffmpeg library and Windows Media Foundation using the x264 video encoder. From what I read in user postings, ffmpeg H264 encoding cannot be made absolutely lossless, and Windows Media Foundation doesn't support the x264 encoder. I cannot tell whether x264 is completely lossless, either.</p>
<p>I'm looking for advice as to how I can meet my requirements. I have a strong preference for not using any procedure than involves writing intermediate files.</p>

CC BY-SA 4.0
2024-07-22T08:52:35.033Z
The Quicktime Animation codec can be set to lossless. I think VLC is supposed to support it? Any lossless codec is lightly to be quite burdensome for playback, so it might lag, jitter, have large file sizes etc. It is quite an old codec, there may be a better format to use now.
tomh
CC BY-SA 4.0
2024-07-22T11:01:47.663Z
Might be helpful to say what the overall purpose is? Do you definitely need lossless? Eg, is it for archiving, for scientific analysis?
tomh
CC BY-SA 4.0
2024-07-23T15:44:10.450Z
It's a visualization of scientific data. The final frame rate should be in the range of 0.5-4 frames/sec, so the computational load of playback shouldn't be too great. Also, the image resolution is 640 x 512. The final video will be fewer than 300 frames.
Woody20
CC BY-SA 4.0
2024-07-23T18:59:54.247Z
Assume you've seen this - https://video.stackexchange.com/questions/7903/how-to-losslessly-encode-a-jpg-image-sequence-to-a-video-in-ffmpeg
tomh
CC BY-SA 4.0
2024-07-23T19:48:43.733Z
I hadn't seen that, and it's certainly useful. I actually need two different things: a way to get RGB bitmap as input to an encoder, and an encoder and container that will output a lossless version of the input.
Woody20
<ffmpeg><libx264><lossless>
How to convert 32-bit RGB bitmaps to video losslessly?
Woody20
# How to convert 32-bit RGB bitmaps to video losslessly?

(Asked by: username_0 on 2024-07-21)

I have a number of images in RGB bitmap form (8 bits each for red, green, blue; each pixel is 32 bits). I want to convert these individual images to a video, showing each image for 1-2 seconds, using C++ code in my app.

It is important that the images in the video be pixel-by-pixel identical with the original bitmap pixels. Lossless, in the mathematical sense. I am not concerned with file size, etc.

The resulting video needs to be playable on VLC, and preferably on other common media players.

The two approaches I have considered are the ffmpeg library and Windows Media Foundation using the x264 video encoder. From what I read in user postings, ffmpeg H264 encoding cannot be made absolutely lossless, and Windows Media Foundation doesn't support the x264 encoder. I cannot tell whether x264 is completely lossless, either.

I'm looking for advice as to how I can meet my requirements. I have a strong preference for not using any procedure than involves writing intermediate files.

**Tags:** ffmpeg, libx264, lossless

> **Comments:**
> **username_1**: The Quicktime Animation codec can be set to lossless. I think VLC is supposed to support it? Any lossless codec is lightly to be quite burdensome for playback, so it might lag, jitter, have large file sizes etc. It is quite an old codec, there may be a better format to use now.  
> **username_1**: Might be helpful to say what the overall purpose is? Do you definitely need lossless? Eg, is it for archiving, for scientific analysis?  
> **username_0**: It's a visualization of scientific data. The final frame rate should be in the range of 0.5-4 frames/sec, so the computational load of playback shouldn't be too great. Also, the image resolution is 640 x 512. The final video will be fewer than 300 frames.  
> **username_1**: Assume you've seen this - https://video.stackexchange.com/questions/7903/how-to-losslessly-encode-a-jpg-image-sequence-to-a-video-in-ffmpeg  
> **username_0**: I hadn't seen that, and it's certainly useful. I actually need two different things: a way to get RGB bitmap as input to an encoder, and an encoder and container that will output a lossless version of the input.  

---

## 0 answers

