Skip to main content
6 of 13
added 36 characters in body
Dingus
  • 11.3k
  • 2
  • 31
  • 65

FFmpeg, 28122.2348

Input is a \$65535\times1\$ PBM image consisting of alternating white and black pixels, which is exactly 10,000 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
raw = 'raw.pbm'
compressed = 'compressed.mp4'
File.write(raw, 'P4 65535 1 ' + 'U'*9989)
`ffmpeg -i #{raw} -crf 0 -filter:v fps=10000000 -preset ultrafast -tune film #{compressed}`
puts r = File.size(raw)
puts c = File.size(compressed)
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