1

ffmpeg can convert sequences of images to movies and is capable of producing lossless output. Is it possible to directly produce a movie from a multi-page tiff file? If I try one of my multipage tiffs ffmpeg only processes the first frame.

Marius
  • 121
  • 5
  • 1
    FFmpeg doesn't support reading TIFF pages. You can use Imagemagick to split the TIFF pages to an image sequence first. – Gyan Jan 18 '17 at 07:12
  • That would be very slow for large TIFF stacks and double the memory required for the stack.Ideally I would like something that can also handle BigTIFF files (extension of TIFF over 4GB limit). – Marius Jan 04 '18 at 14:40

1 Answers1

3

Workaround

FFmpeg does not support multipage tiff yet, even in 2021! In the actual FFmpeg feature ticket, I found a workaround: use convert (from ImageMagick) to pipe individual images to FFmpeg.
Ref: https://trac.ffmpeg.org/ticket/8644

In my case, the file format is gray16le (16bits grayscale LE, from a thermal IR camera):

convert sample.tif gray:- | ffmpeg -f rawvideo -s 1280x1024 -pix_fmt gray16le -r 30 -i - -vcodec ffv1 sample-ffv1.mkv

The ffv1 is a lossless format, but it is still compressed. In my case it was about 30% of the original size.

I used the -r 30 to set the output framerate.

Note

Some may wonder why we need lossless 16bit format: I needed to simulate a 16bit grayscale V4L source using V4L-loopback:

ffmpeg -stream_loop -1 -re -i sample-ffv1.mkv -map 0:v -f v4l2 /dev/video0