Skip to main content
5 of 13
deleted 7 characters in body
Dingus
  • 11.3k
  • 2
  • 31
  • 65

FFmpeg, ≈ 28108.18

Input is a \$65535\times1\$ PBM image consisting of alternating white and black pixels, which is 10,005 bytes. This image is encoded as an H.264 video using excessive quality settings, yielding a 281,222,348 byte mp4. The following Ruby wrapper was used to generate both files:

#!/usr/bin/env ruby
File.write('raw.pbm', 'P4 65535 1 ' + 'U'*9994)
`ffmpeg -i raw.pbm -crf 0 -filter:v fps=10000000 -preset ultrafast -tune film compressed.mp4`
puts r = File.size('raw.pbm')
puts c = File.size('compressed.mp4')
puts c.fdiv(r)

The options passed to FFmpeg are:

  • -crf 0 (constant rate factor 0). From the docs: 'The range of the CRF scale is 0–51, where 0 is lossless . . . a subjectively sane range is 17–28 . . . The range is exponential'.

  • -filter:v fps=10000000 I kept adding zeros to the frame rate until there was no change in output size.

  • -preset ultrafast 'A slower preset will provide better compression', so I chose the fastest one. (The next fastest option, superfast, reduces the file size more than fivefold.)

  • -tune film 'use for high quality movie content; lowers deblocking'. Adding this option increased the file size by 2 bytes.

Dingus
  • 11.3k
  • 2
  • 31
  • 65