[FFmpeg-trac] #10953(ffmpeg:new): FFmpeg can't encode a raw 30720x30720 RGB24 input stream

FFmpeg trac at avcodec.org
Sun Apr 7 06:07:51 EEST 2024


#10953: FFmpeg can't encode a raw 30720x30720 RGB24 input stream
-------------------------------------+-------------------------------------
             Reporter:  Rafael Saud  |                     Type:  defect
               Status:  new          |                 Priority:  normal
            Component:  ffmpeg       |                  Version:  git-
             Keywords:  images       |  master
  rawvideo                           |               Blocked By:
             Blocking:               |  Reproduced by developer:  0
Analyzed by developer:  0            |
-------------------------------------+-------------------------------------
 I'm trying to encode a stream of multiple 30720x30720 images on a POWER8
 machine but FFmpeg refuses to do anything.
 FFmpeg was `git clone`'d, `./configure`'d, and built just now.

 How to reproduce:
 {{{
 $ ./example | ~/ffmpeg/ffmpeg -y -f rawvideo -pix_fmt rgb24 -s 30720x30720
 -r 30 -i - -c:v libx264 -preset veryslow -s 7680x7680 output.h264
 ffmpeg version N-114700-g0dbf45120a Copyright (c) 2000-2024 the FFmpeg
 developers
   built with gcc 13 (Gentoo 13.2.1_p20230826 p7)
   configuration: --enable-nonfree --enable-gpl --enable-version3 --enable-
 power8 --enable-altivec --enable-libx265 --enable-libx264 --enable-libwebp
 --enable-libvpx --enable-libopus --enable-librsvg --enable-libjxl
 --enable-libfdk-aac --disable-stripping
   libavutil      59. 13.100 / 59. 13.100
   libavcodec     61.  5.101 / 61.  5.101
   libavformat    61.  3.100 / 61.  3.100
   libavdevice    61.  2.100 / 61.  2.100
   libavfilter    10.  2.101 / 10.  2.101
   libswscale      8.  2.100 /  8.  2.100
   libswresample   5.  2.100 /  5.  2.100
   libpostproc    58.  2.100 / 58.  2.100
 Splitting the commandline.
 Reading option '-v' ... matched as option 'v' (set logging level) with
 argument '9'.
 Reading option '-loglevel' ... matched as option 'loglevel' (set logging
 level) with argument '99'.
 Reading option '-y' ... matched as option 'y' (overwrite output files)
 with argument '1'.
 Reading option '-f' ... matched as option 'f' (force container format
 (auto-detected otherwise)) with argument 'rawvideo'.
 Reading option '-pix_fmt' ... matched as option 'pix_fmt' (set pixel
 format) with argument 'rgb24'.
 Reading option '-s' ... matched as option 's' (set frame size (WxH or
 abbreviation)) with argument '30720x30720'.
 Reading option '-r' ... matched as option 'r' (override input
 framerate/convert to given output framerate (Hz value, fraction or
 abbreviation)) with argument '30'.
 Reading option '-i' ... matched as input url with argument '-'.
 Reading option '-c:v' ... matched as option 'c' (select encoder/decoder
 ('copy' to copy stream without reencoding)) with argument 'libx264'.
 Reading option '-preset' ... matched as AVOption 'preset' with argument
 'veryslow'.
 Reading option '-s' ... matched as option 's' (set frame size (WxH or
 abbreviation)) with argument '7680x7680'.
 Reading option 'output.h264' ... matched as output url.
 Finished splitting the commandline.
 Parsing a group of options: global .
 Applying option v (set logging level) with argument 9.
 Applying option y (overwrite output files) with argument 1.
 Successfully parsed a group of options.
 Parsing a group of options: input url -.
 Applying option f (force container format (auto-detected otherwise)) with
 argument rawvideo.
 Applying option pix_fmt (set pixel format) with argument rgb24.
 Applying option s (set frame size (WxH or abbreviation)) with argument
 30720x30720.
 Applying option r (override input framerate/convert to given output
 framerate (Hz value, fraction or abbreviation)) with argument 30.
 Successfully parsed a group of options.
 Opening an input file: -.
 [rawvideo @ 0x100173cf8f0] Opening 'fd:' for reading
 [fd @ 0x100173d0300] Setting default whitelist 'crypto,data'
 [rawvideo @ 0x100173cf8f0] [IMGUTILS @ 0x7fffefb6bb60] Picture size
 30720x30720 is invalid
 [AVIOContext @ 0x100173e04e0] Statistics: 65536 bytes read, 0 seeks
 [in#0 @ 0x100173b5cb0] Error opening input: Invalid argument
 Error opening input file -.
 Error opening input files: Invalid argument
 $
 }}}
 Before I manually removed the if statement on `libavutil/imgutils.c` (yes
 I'm aware this is a horrible practice) and encoded 30720x30720 PNGs but
 this trick doesn't work with raw video streams (it just silences the error
 message).

 This simple C binary could be used for reproducing the bug:
 {{{#!c
 // gcc example.c -O3 -o example

 #include <stdint.h>
 #include <stdlib.h>
 #include <stdio.h>

 int main() {
     size_t X = 30720, Y = 30720;
     uint8_t* FrameBuffer = malloc(X * Y * 3);

     for (size_t f = 0; f < 30; f++) {
         for (size_t i = 0, p = 0; i < X * Y; i++, p = i * 3) {
             FrameBuffer[p + 0] = (i * f + 256) & 0xFF;
             FrameBuffer[p + 1] = (i * f + 512) & 0xFF;
             FrameBuffer[p + 2] = (i * f + 768) & 0xFF;
         }
         fwrite(FrameBuffer, 1, X * Y * 3, stdout);
     }

     free(FrameBuffer);
 }
 }}}

 Here's the output of `uname` if it helps
 `Linux power8-gentoo 6.1.60-gentoo-dist #1 SMP Wed Oct 25 19:38:28 -00
 2023 ppc64le POWER8 (architected), altivec supported CHRP IBM,8284-22A
 GNU/Linux`
-- 
Ticket URL: <https://trac.ffmpeg.org/ticket/10953>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker


More information about the FFmpeg-trac mailing list