Opened 6 months ago

Last modified 5 weeks ago

#7001 reopened defect

Misleading error message if the filtergraph cannot be allocated (because a filter is missing)

Reported by: Shebuka Owned by:
Priority: minor Component: undetermined
Version: git-master Keywords:
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no


Summary of the bug:

I have some test video files that I use to test my tiny ffmpeg build that has only a few encoders, muxers and filters enabled and uses a dynamically linked libx264.
All videos are converting fine with my previous tiny ffmpeg build (somewhat around 2 years ago, version N-78399-g817bf84 and libx264.148.dylib).
Current ffmpeg master (N-89940-gb1af0e23a3) fails to convert one 4 seconds video recorded with an iPhone 6 Plus in portrait with Cannot allocate memory error. Tried with both current master libx264.155.dylib and with old x264.148.dylib.

How to reproduce:

iMac-Shebuka:Video for test shebuka$ ./ffmpeg -y -i file:IMG_0001.MOV -vcodec libx264 file:enc/IMG_0001.mp4 -report
ffmpeg started on 2018-02-02 at 10:36:12
Report written to "ffmpeg-20180202-103612.log"
ffmpeg version N-89940-gb1af0e23a3 Copyright (c) 2000-2018 the FFmpeg developers
  built with Apple LLVM version 9.0.0 (clang-900.0.39.2)
  configuration: --disable-debug --disable-ffplay --disable-ffprobe --disable-doc --disable-iconv --disable-zlib --disable-bzlib --disable-securetransport --disable-encoders --disable-muxers --disable-filters --disable-protocols --disable-bsfs --enable-gpl --enable-libx264 --enable-encoder='libx264,aac,mjpeg' --enable-muxer='mp4,ipod,image2' --enable-filter='scale,crop,aresample,thumbnail' --enable-protocol=file --enable-bsf=aac_adtstoasc
  libavutil      56.  7.100 / 56.  7.100
  libavcodec     58.  9.100 / 58.  9.100
  libavformat    58.  7.100 / 58.  7.100
  libavdevice    58.  0.101 / 58.  0.101
  libavfilter     7. 11.101 /  7. 11.101
  libswscale      5.  0.101 /  5.  0.101
  libswresample   3.  0.101 /  3.  0.101
  libpostproc    55.  0.100 / 55.  0.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'file:IMG_0001.MOV':
    major_brand     : qt  
    minor_version   : 0
    compatible_brands: qt  
    creation_time   : 2015-04-29T15:14:24.000000Z
    encoder         : 8.1.2
    encoder-ita     : 8.1.2
    date            : 2015-04-29T17:14:23+0200
    date-ita        : 2015-04-29T17:14:23+0200
    model           : iPhone 6 Plus
    model-ita       : iPhone 6 Plus
    make            : Apple
    make-ita        : Apple 2015-04-29T17:14:23+0200 iPhone 6 Plus 8.1.2 Apple
  Duration: 00:00:04.47, start: 0.000000, bitrate: 17184 kb/s
    Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709), 1920x1080, 17110 kb/s, 30.01 fps, 30 tbr, 600 tbn, 1200 tbc (default)
      rotate          : 90
      creation_time   : 2015-04-29T15:14:24.000000Z
      handler_name    : Core Media Data Handler
      encoder         : H.264
    Side data:
      displaymatrix: rotation of -90.00 degrees
    Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, mono, fltp, 62 kb/s (default)
      creation_time   : 2015-04-29T15:14:24.000000Z
      handler_name    : Core Media Data Handler
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
  Stream #0:1 -> #0:1 (aac (native) -> aac (native))
Press [q] to stop, [?] for help
Error reinitializing filters!
Failed to inject frame into filter network: Cannot allocate memory
Error while processing the decoded data for stream #0:0
[aac @ 0x7f93c1010400] Qavg: 3872.064
[aac @ 0x7f93c1010400] 2 frames left in the queue on closing
Conversion failed!

-report from both old and new builds in attached files.

Attachments (2)

ffmpeg master N-89940-gb1af0e23a3.txt (12.3 KB) - added by Shebuka 6 months ago.
ffmpeg master N-89940-gb1af0e23a3 failing
ffmpeg old N-78399-g817bf84.txt (41.9 KB) - added by Shebuka 6 months ago.
ffmpeg old N-78399-g817bf84 working

Download all attachments as: .zip

Change History (7)

Changed 6 months ago by Shebuka

ffmpeg master N-89940-gb1af0e23a3 failing

Changed 6 months ago by Shebuka

ffmpeg old N-78399-g817bf84 working

comment:1 Changed 6 months ago by Shebuka

The video can be downloaded from!WMhzWKhD using key !YVMuSb1B1fXzl_6hm4BwgbalsCjq5UL7D-ncAoexnbI

comment:2 Changed 5 months ago by cehoyos

  • Resolution set to invalid
  • Status changed from new to closed

You can use -noautorotate if you don't want to compile the transpose filter.

comment:3 Changed 5 months ago by Shebuka

Why was the previous version working? Is there a switch to make the -noautorotate a default behavior?

p.s. There is no error in the log about the need of transpose filter... bug?

comment:4 Changed 5 weeks ago by bolds

I got similar problem with my build of ffmpeg for android, still didn't manage to solve it, but a workaround i found (and you can test to detect if is the same problem) is re-mux the video without the rotate metadata...

for that you can do:

ffmpeg -i yourinput.mp4 -c copy -metadata:s:v:0 rotate= temp_output.mp4

then you can do whatever you need with the video and after that

ffmpeg -i handled_video.mp4 -c copy -metadata:s:v:0 rotate=90 output.mp4

This is a terrible workaround I know, but as far as tested ffmpeg fails to decode h264 with rotate metadata and also encode adding metadata at same time (so this is why three steps)

my ffmpeg build has:

comment:5 Changed 5 weeks ago by cehoyos

  • Priority changed from normal to minor
  • Resolution invalid deleted
  • Status changed from closed to reopened
  • Summary changed from Cannot allocate memory on a 4 sec video. "Error reinitializing filters!" to Misleading error message if the filtergraph cannot be allocated (because a filter is missing)

Unrelated: Please understand that only current FFmpeg git head is supported on this bug tracker.

The error message is clearly misleading, a patch to slightly improve this was rejected, a true fix is unfortunately no so easy.

Note: See TracTickets for help on using tickets.