2

I need to use ffmpeg with very large images (32768x16384). When I try to read such an image I get the error:

Picture size 32768x16384 is invalid

It it does not matter what operation I want to do on the image (like scaling, v360 cutout etc.) it already fails at the read-in stage. I tried JPG and PNG as input formats.

Full log with demonstration operation (scale 32k to 16k)

E:\XXX\Pipeline>"E:\XXX\Pipeline\bin\ffmpeg.exe" -y -i E:\XXX\Pipeline\calibration_sphere32k.jpg -vf scale=16384:-2 "calibration_sphere32k_scaled.jpg"
ffmpeg version N-94664-g0821bc4eee Copyright (c) 2000-2019 the FFmpeg developers
  built with gcc 9.1.1 (GCC) 20190807
  configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libdav1d --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libmfx --enable-amf --enable-ffnvcodec --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth --enable-libopenmpt
  libavutil      56. 33.100 / 56. 33.100
  libavcodec     58. 55.101 / 58. 55.101
  libavformat    58. 31.104 / 58. 31.104
  libavdevice    58.  9.100 / 58.  9.100
  libavfilter     7. 58.101 /  7. 58.101
  libswscale      5.  6.100 /  5.  6.100
  libswresample   3.  6.100 /  3.  6.100
  libpostproc    55.  6.100 / 55.  6.100
[mjpeg @ 000001eefc88ab80] [IMGUTILS @ 000000acfa1fef30] Picture size 32768x16384 is invalid
[image2 @ 000001eefc878740] decoding for stream 0 failed
[image2 @ 000001eefc878740] Could not find codec parameters for stream 0 (Video: mjpeg (Baseline), none(bt470bg/unknown/unknown)): unspecified size
Consider increasing the value for the 'analyzeduration' and 'probesize' options
Input #0, image2, from 'E:\XXX\Pipeline\calibration_sphere32k.jpg':
  Duration: 00:00:00.04, start: 0.000000, bitrate: 20939328 kb/s
    Stream #0:0: Video: mjpeg (Baseline), none(bt470bg/unknown/unknown), 25 tbr, 25 tbn, 25 tbc
Stream mapping:
  Stream #0:0 -> #0:0 (mjpeg (native) -> mjpeg (native))
Press [q] to stop, [?] for help
[mjpeg @ 000001eefc88d3c0] [IMGUTILS @ 000000acfa1ff050] Picture size 32768x16384 is invalid
Error while decoding stream #0:0: Invalid data found when processing input
Cannot determine format of input stream 0:0 after EOF
Error marking filters as finished
Conversion failed!

EDIT Found out, that the maximum horizontal resolution is: 22976. This is a very odd number.

1 Answer 1

3

The general limiting rule is ((Width * 8) + 1024)*(Height + 128) < INT_MAX. The rationale being, that all pixels of an image plane should be accessible using a signed integer index.

On a machine with 32-bit integers, INT MAX is 2147483647.

So, ((32768 * 8) + 1024)*(16384 + 128) = 4345430016 which is > 2147483647.

Now, it's possible there is a bug with the image size check, in that the factor 8 applied to the width is prematurely applied in most cases and can be skipped. You can raise a ticket at trac.ffmpeg.org if you want to explore that possibility. Else, you'll need to use another tool (maybe Imagemagick).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.