ffmpeg specific jpeg encoding

1

I'd like to convert a movie into jpeg in a specific way. I was wondering if ffmpeg can help here.

What I need to achieve is every 25 frames from the movie needs to be written in a single .jpeg file - one under another. So that from a single movie I get

part1.jpg
  frame1
  frame2
  frame3
  ...
  frame25

part2.jpg
  frame26
  frame27
  frame28
  ...
  frame50

...

Can this be done without dumping the file into separate .jpegs and then modifying them?

viraptor

Posted 2010-02-06T04:14:51.177

Reputation: 505

Do you mean that you want a jpeg of every 25th frame (i.e., ignoring every other frame), starting at frame 1? Or are you looking for some kind of composition of 25 frames into one image? – sblair – 2010-02-06T04:54:35.667

A composition of every 25 frames into one partXXX.jpeg - frames saved one vertical stripe. – viraptor – 2010-02-06T11:32:05.920

Answers

2

I'm far from an ffmpeg expert, but I don't believe ffmpeg is capable of this level of image processing by itself. I think, in order to achieve your desired goal, you'll need this workflow:

  1. Extract all frames to individual, temporary image files with ffmpeg;
  2. Combine a sequence of 25 temporary image files into a single final image with a JPEG tool (such as montage from the ImageMagick package);
  3. Repeat step 2 until all final images have been created.

This should be fairly easy to script, but it will take up a lot of disk space while it's working.

quack quixote

Posted 2010-02-06T04:14:51.177

Reputation: 37 382

Exactly - I wanted to save on the disk space by not creating every frame separately... – viraptor – 2010-02-06T14:56:30.167

some other tool might be able to do that, but i don't think ffmpeg is capable, sorry. (i could also be wrong.) – quack quixote – 2010-02-06T18:07:45.253

0

With a recent ffmpeg, you can simply use the tile filter like so:

ffmpeg -i input.mp4 -filter:v 'tile=layout=1x25' out%03d.jpg

This will produce files labelled out001.jpg, out002.jpg, and so on; and each image will be exactly as described in the question.

evilsoup

Posted 2010-02-06T04:14:51.177

Reputation: 10 085