Search code examples
image-processingffmpegvideo-processingframesmux

Extracting frames from a video created by muxing a bunch of images together is changing the integrity of the frames


I am trying to transfer a bunch of images as a video. What I am doing is simply muxing these static images into a video using the following commands.

ffmpeg -framerate 1 -i %02d.jpg -codec copy 1.mkv

After this, I verify the integrity of my static images and the frames in the video using -

ffmpeg -i %02d.jpg -f framehash -

and

ffmpeg -i 1.mkv -map 0:v -f framehash -

I get the same hashes so it means I have archived the images properly. Now next I send this video to my friend who extracts the frames using -

ffmpeg -i 1.mkv mkv%02d.jpg 

Now after extracting the hashes don't remain the same that means the integrity is lost.

How to extract the frames as it is so that integrity is not lost?

Also if you any other way to achieve what I am trying, please advice.

Here are the hashes.


Solution

  • The command

    ffmpeg -i 1.mkv mkv%02d.jpg
    

    doesn't "extract" the JPEGs. It decodes the stored frames and re-encodes them using the MJPEG encoder.

    Use

    ffmpeg -i 1.mkv -c copy mkv%02d.jpg