KS HARSHA
KS HARSHA

Reputation: 67

extract raw output files(without extension) from video ffmpeg

ffmpeg -i timer.mp4 -r 1 output_%01d.png

this extract frames in png format every sec,I want raw format(rather than images i need to extract without extension). need to extract frames without extension from video.

do you know command to extract frames without extension(ie ffmpeg -i timer.mp4 -r 1 output_%01d ,but this gives error)

Upvotes: 0

Views: 2338

Answers (1)

Mark Setchell
Mark Setchell

Reputation: 207355

The extension of a file doesn't really determine the format of its contents - that is just a Windows-ism.

You say you want "raw" output but that could mean "raw RGB", or "raw YUV" or "raw MJPG frames", so I assume you want RGB888 data. You can get 1 frame per second for 5s like this:

ffmpeg -i INPUT -t 5 -r 1 -pix_fmt rgb24 q-%d.raw

Personally though, I would go for PPM which is exactly the same but with an additional 3 lines at the top telling you whether binary or ASCII, the width and height and whether 8 or 16-bit:

ffmpeg -i INPUT -t 5 -r 1 q-%d.ppm

You can process these files exactly the same as raw, but you can also view them as images with feh, Photoshop, GIMP etc, which I think is a good benefit. Here are the first 3 lines from a 1280x720 video:

P6
1280 720
255

The remainder of the file is just RGB888 in binary.

Upvotes: 1

Related Questions