I want to create one thumbnail consisting of the first frame of a video for arbitrary video files. I do it like this:
ffmpeg -i video.mkv -vf scale=w=300:h=300:force_original_aspect_ratio=decrease -frames:v 1 thumbnail.png
For performance considerations I was experimenting with only loading the first megabytes of a video instead of whole video files for this task.
In my experiments this works fine with some formats like mkv
and mts
and only sometimes with mp4
(I get errors - and no thumbnail, when the moov atom
is not at the beginning of a file)
With what video file formats is it possible to generate thumbnails only from the first megabytes of a file, and with what formats is it not possible? Does it only depend on the container type or also on the codec? Can there be a reliable answer?