3

When I try to take Screenshots from an AVI file I get the above message with an empty jpg/png file. But Screenshots from MP4 files works with any problems.

My OS is Debian.

MP4 Command:

ffmpeg  -itsoffset -4  -i test.mp4 -vcodec mjpeg -vframes 1 -an -f rawvideo -s 320x240 test.jpg

AVI Command:

ffmpeg  -itsoffset -4  -i test.avi -vcodec mjpeg -vframes 1 -an -f rawvideo -s 320x240 test.jpg
1
  • Interesting. I would expect both to fail. What are the codex and pix_fmt used by your test videos?
    – OrangeDog
    Aug 9, 2020 at 10:55

1 Answer 1

1

I think you want -f image2 instead of -f rawvideo. This tells ffmpeg to write an image, rather than an uncompressed video stream. An uncompressed video stream obviously cannot be saved in a still image file.

Also, since you're saving to JPEG, you should use -vcodec copy to avoid applying lossy JPEG compression unnecessarily.

1
  • You can't just take an encoded video frame and save it as a JPEG. A change of codec is required.
    – OrangeDog
    Aug 9, 2020 at 10:54

You must log in to answer this question.