Opened 5 years ago

Closed 5 years ago

Last modified 4 years ago

#7907 closed defect (needs_more_info)

[hls @ 0x6a30180] Unable to find mapping variant stream av_interleaved_write_frame(): Cannot allocate memory

Reported by: Mattias Owned by:
Priority: normal Component: undetermined
Version: unspecified Keywords: hls
Cc: lq@onvideo.cn Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

Summary of the bug: CentOS FFMpeg (compiled according to FFMpeg.org instructions) fails with the following message -- [hls @ 0x6a30180] Unable to find mapping variant stream
av_interleaved_write_frame(): Cannot allocate memory
How to reproduce:

% ffmpeg -y -i "udp://224.0.0.0:5000?overrun_nonfatal=1&fifo_size=100000000" -flags +cgop -vsync 1 \
-c:v:0 libx264 -vf:0 "yadif=0:-1:1,format=yuv420p" -b:v:0 2048k -c:a:0 libfdk_aac -s:v:0 1280x720 -shortest -b:a:0 128k -r:v:0 30 -g:v:0 60 -force_key_frames "expr:gte(t,n_forced*2)" -preset:0 faster -crf:0 23 -profile:v:0 high -level:v:0 4.0 \
-c:v:1 libx264 -vf:1 "yadif=0:-1:1,format=yuv420p" -b:v:1 1024k -c:a:1 libfdk_aac -s:v:1 720x480 -shortest -b:a:1 128k -r:v:1 30 -g:v:1 60 -force_key_frames "expr:gte(t,n_forced*2)" -preset:1 faster -crf:1 24 -profile:v:1 baseline -level:v:1 3.1 \
-c:v:2 libx264 -vf:2 "yadif=0:-1:1,format=yuv420p" -b:v:2 512k  -c:a:2 libfdk_aac -s:v:2 640x360 -shortest -b:a:2 128k -r:v:2 30 -g:v:2 60 -force_key_frames "expr:gte(t,n_forced*2)" -preset:2 faster -crf:2 25 -profile:v:2 baseline -level:v:2 3 \
-sn -ac 2 -flags -global_header -hls_time 6 -hls_list_size 10 -start_number 1 -method PUT -threads 2 -thread_type slice \
-hls_flags delete_segments \
-map 0:v -map 0:a -map 0:v -map 0:a -map 0:v -map 0:a \
-var_stream_map "v:0,a:0 v:1,a:1 v:2,a:2" \
-f hls -master_pl_name "master.m3u8" \
"https://pxxx.net/xxx/xxx/xxx-%v-%v.m3u8"

ffmpeg version 4.1.3 (have tested latest daily as well and the same issue appears) although 4.1.3 dumps core while latest does not, and also complains about renaming files. Currently reverting 4.0.2 to see regression.
built on CentOS 7.6

The same command line works flawlessly on Ubuntu LTS 18.04 -
Hardware is a HP server with 64 GB Ram and 24 cores so there's enough RAM and CPU..

Change History (7)

comment:1 by Bela B, 5 years ago

try

-map 0:v -map 0:a -map 0:v -map 0:a -map 0:v -map 0:a

instead

-map 0:v:0 -map 0:a:0 -map 0:v:1 -map 0:a:1 -map 0:v:2 -map 0:a:2

and just a remark regarding "and also complains about renaming files": do you use intentionally %v two times in the output file name? I am afraid it was not handled correctly in previous versions but since some days ago.

comment:2 by Carl Eugen Hoyos, 5 years ago

Component: ffmpegundetermined
Keywords: hls added
Version: 4.1unspecified

Is network input required to reproduce the issue?
Are the filters required to reproduce the issue?

To make this a valid ticket, please test current FFmpeg git head and provide the (simplified) command line you tested together with the complete, uncut console output.

comment:3 by larez, 5 years ago

+ you should rather do yadif only once, like : -c:v libx264 -filter_complex "[0:v]yadif,split=4[br1][br2][br3]" -map [br1] -b:v:0 BR1 -s:v:0 x1:y1 -preset:v:0 ... -map [br2] -b:v:1 BR2 -s:v:2 x2:y2 ...

comment:4 by larez, 5 years ago

Last edited 5 years ago by larez (previous) (diff)

comment:5 by Steven Liu, 5 years ago

Cc: lq@onvideo.cn added
Resolution: needs_more_info
Status: newclosed

It work here, can you try it by the newest version?

localhost:dash StevenLiu$ ./ffmpeg -i ~/Movies/objectC/facebook.mp4 -flags +cgop -vsync 1 -c:v:0 libx264 -vf:0 "yadif=0:-1:1" -b:v:0 2048k -c:a:0 libfdk_aac -s:v:0 1280x720 -shortest -b:a:0 128k -r:v:0 30 -g:v:0 60 -force_key_frames "expr:gte(t,n_forced*2)" -preset:0 faster -crf:0 23 -profile:v:0 high -level:v:0 4.0 -c:v:1 libx264 -vf:1 "yadif=0:-1:1" -b:v:1 1024k -c:a:1 libfdk_aac -s:v:1 720x480 -shortest -b:a:1 128k -r:v:1 30 -g:v:1 60 -force_key_frames "expr:gte(t,n_forced*2)" -preset:1 faster -crf:1 24 -profile:v:1 baseline -level:v:1 3.1 -c:v:2 libx264 -vf:2 "yadif=0:-1:1" -b:v:2 512k  -c:a:2 libfdk_aac -s:v:2 640x360 -shortest -b:a:2 128k -r:v:2 30 -g:v:2 60 -force_key_frames "expr:gte(t,n_forced*2)" -preset:2 faster -crf:2 25 -profile:v:2 baseline -level:v:2 3 -sn -ac 2 -flags -global_header -hls_time 6 -hls_list_size 10 -start_number 1 -method PUT -threads 2 -thread_type slice -hls_flags delete_segments -map 0:v -map 0:a -map 0:v -map 0:a -map 0:v -map 0:a -var_stream_map "v:0,a:0 v:1,a:1 v:2,a:2" -f hls -master_pl_name "master.m3u8" xxx-%v-%v.m3u8
ffmpeg version N-94769-g4ae6031b20 Copyright (c) 2000-2019 the FFmpeg developers
  built with Apple LLVM version 10.0.0 (clang-1000.11.45.5)
  configuration: --enable-libass --enable-opengl --enable-libx264 --enable-libmp3lame --enable-gpl --enable-nonfree --prefix=/usr/local --enable-libtesseract --enable-libspeex --enable-libfreetype --enable-libfontconfig --enable-libfdk-aac --enable-videotoolbox --enable-libxml2 --enable-librsvg --enable-libvmaf --enable-version3 --disable-stripping --disable-optimizations --enable-libvmaf
  libavutil      56. 34.100 / 56. 34.100
  libavcodec     58. 56.101 / 58. 56.101
  libavformat    58. 32.104 / 58. 32.104
  libavdevice    58.  9.100 / 58.  9.100
  libavfilter     7. 58.102 /  7. 58.102
  libswscale      5.  6.100 /  5.  6.100
  libswresample   3.  6.100 /  3.  6.100
  libpostproc    55.  6.100 / 55.  6.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/Users/StevenLiu/Movies/objectC/facebook.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf55.22.102
    description     : This File is Created by Easy RealMedia Tools@!
  Duration: 02:00:27.85, start: 0.000000, bitrate: 893 kb/s
    Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 640x480, 797 kb/s, 25 fps, 25 tbr, 12800 tbn, 50 tbc (default)
    Metadata:
      handler_name    : VideoHandler
    Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 87 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
Only '-vf yadif=0:-1:1' read, ignoring remaining -vf options: Use ',' to separate filters
Only '-af (null)' read, ignoring remaining -af options: Use ',' to separate filters
Only '-vf yadif=0:-1:1' read, ignoring remaining -vf options: Use ',' to separate filters
Only '-af (null)' read, ignoring remaining -af options: Use ',' to separate filters
Only '-vf yadif=0:-1:1' read, ignoring remaining -vf options: Use ',' to separate filters
Only '-af (null)' read, ignoring remaining -af options: Use ',' to separate filters
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
  Stream #0:1 -> #0:1 (aac (native) -> aac (libfdk_aac))
  Stream #0:0 -> #0:2 (h264 (native) -> h264 (libx264))
  Stream #0:1 -> #0:3 (aac (native) -> aac (libfdk_aac))
  Stream #0:0 -> #0:4 (h264 (native) -> h264 (libx264))
  Stream #0:1 -> #0:5 (aac (native) -> aac (libfdk_aac))
Press [q] to stop, [?] for help
[libx264 @ 0x7fb0bd808400] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX AVX2 FMA3 LZCNT BMI2
[libx264 @ 0x7fb0bd808400] profile High, level 4.0
[libx264 @ 0x7fb0bd80ae00] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX AVX2 FMA3 LZCNT BMI2
[libx264 @ 0x7fb0bd80ae00] profile Constrained Baseline, level 3.1
[libx264 @ 0x7fb0bc800600] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX AVX2 FMA3 LZCNT BMI2
[libx264 @ 0x7fb0bc800600] profile Constrained Baseline, level 3.0
Output #0, hls, to 'xxx-%v-%v.m3u8':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    description     : This File is Created by Easy RealMedia Tools@!
    encoder         : Lavf58.32.104
    Stream #0:0(und): Video: h264 (libx264), yuv420p, 1280x720, q=-1--1, 2048 kb/s, 30 fps, 90k tbn, 30 tbc (default)
    Metadata:
      handler_name    : VideoHandler
      encoder         : Lavc58.56.101 libx264
    Side data:
      cpb: bitrate max/min/avg: 0/0/2048000 buffer size: 0 vbv_delay: N/A
    Stream #0:1(und): Audio: aac (libfdk_aac), 44100 Hz, stereo, s16, 128 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
      encoder         : Lavc58.56.101 libfdk_aac
    Stream #0:2(und): Video: h264 (libx264), yuv420p, 720x480, q=-1--1, 1024 kb/s, 30 fps, 90k tbn, 30 tbc (default)
    Metadata:
      handler_name    : VideoHandler
      encoder         : Lavc58.56.101 libx264
    Side data:
      cpb: bitrate max/min/avg: 0/0/1024000 buffer size: 0 vbv_delay: N/A
    Stream #0:3(und): Audio: aac (libfdk_aac), 44100 Hz, stereo, s16, 128 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
      encoder         : Lavc58.56.101 libfdk_aac
    Stream #0:4(und): Video: h264 (libx264), yuv420p, 640x360, q=-1--1, 512 kb/s, 30 fps, 90k tbn, 30 tbc (default)
    Metadata:
      handler_name    : VideoHandler
      encoder         : Lavc58.56.101 libx264
    Side data:
      cpb: bitrate max/min/avg: 0/0/512000 buffer size: 0 vbv_delay: N/A
    Stream #0:5(und): Audio: aac (libfdk_aac), 44100 Hz, stereo, s16, 128 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
      encoder         : Lavc58.56.101 libfdk_aac
[hls @ 0x7fb0bd805000] Opening 'xxx-0-01.ts' for writing0:00:07.29 bitrate=N/A dup=108 drop=0 speed=0.919x
[hls @ 0x7fb0bd805000] Opening 'xxx-0-0.m3u8.tmp' for writing
[hls @ 0x7fb0bd805000] Opening 'xxx-1-11.ts' for writing
[hls @ 0x7fb0bd805000] Opening 'xxx-1-1.m3u8.tmp' for writing
[hls @ 0x7fb0bd805000] Opening 'xxx-2-21.ts' for writing
[hls @ 0x7fb0bd805000] Opening 'xxx-2-2.m3u8.tmp' for writing
[hls @ 0x7fb0bd805000] Opening 'master.m3u8' for writing
[hls @ 0x7fb0bd805000] Opening 'xxx-0-02.ts' for writing0:00:13.46 bitrate=N/A dup=198 drop=0 speed=0.876x
[hls @ 0x7fb0bd805000] Opening 'xxx-0-0.m3u8.tmp' for writing
[hls @ 0x7fb0bd805000] Opening 'xxx-1-12.ts' for writing
[hls @ 0x7fb0bd805000] Opening 'xxx-1-1.m3u8.tmp' for writing
[hls @ 0x7fb0bd805000] Opening 'xxx-2-22.ts' for writing
[hls @ 0x7fb0bd805000] Opening 'xxx-2-2.m3u8.tmp' for writing
[hls @ 0x7fb0bd805000] Opening 'xxx-0-03.ts' for writing0:00:19.31 bitrate=N/A dup=288 drop=0 speed=0.737x
[hls @ 0x7fb0bd805000] Opening 'xxx-0-0.m3u8.tmp' for writing
[hls @ 0x7fb0bd805000] Opening 'xxx-1-13.ts' for writing0:00:19.51 bitrate=N/A dup=291 drop=0 speed=0.727x
[hls @ 0x7fb0bd805000] Opening 'xxx-1-1.m3u8.tmp' for writing
[hls @ 0x7fb0bd805000] Opening 'xxx-2-23.ts' for writing
[hls @ 0x7fb0bd805000] Opening 'xxx-2-2.m3u8.tmp' for writing
[hls @ 0x7fb0bd805000] Opening 'xxx-0-04.ts' for writing0:00:25.27 bitrate=N/A dup=375 drop=0 speed=0.626x
[hls @ 0x7fb0bd805000] Opening 'xxx-0-0.m3u8.tmp' for writing
[hls @ 0x7fb0bd805000] Opening 'xxx-1-14.ts' for writing0:00:25.50 bitrate=N/A dup=381 drop=0 speed=0.623x
[hls @ 0x7fb0bd805000] Opening 'xxx-1-1.m3u8.tmp' for writing
[hls @ 0x7fb0bd805000] Opening 'xxx-2-24.ts' for writing
[hls @ 0x7fb0bd805000] Opening 'xxx-2-2.m3u8.tmp' for writing
[hls @ 0x7fb0bd805000] Opening 'xxx-0-05.ts' for writing0:00:31.46 bitrate=N/A dup=468 drop=0 speed=0.604x
[hls @ 0x7fb0bd805000] Opening 'xxx-0-0.m3u8.tmp' for writing
[hls @ 0x7fb0bd805000] Opening 'xxx-1-15.ts' for writing
[hls @ 0x7fb0bd805000] Opening 'xxx-1-1.m3u8.tmp' for writing
[hls @ 0x7fb0bd805000] Opening 'xxx-2-25.ts' for writing
[hls @ 0x7fb0bd805000] Opening 'xxx-2-2.m3u8.tmp' for writing
[hls @ 0x7fb0bd805000] Opening 'xxx-0-06.ts' for writing0:00:37.47 bitrate=N/A dup=558 drop=0 speed=0.574x
[hls @ 0x7fb0bd805000] Opening 'xxx-0-0.m3u8.tmp' for writing
[hls @ 0x7fb0bd805000] Opening 'xxx-1-16.ts' for writing
[hls @ 0x7fb0bd805000] Opening 'xxx-1-1.m3u8.tmp' for writing
[hls @ 0x7fb0bd805000] Opening 'xxx-2-26.ts' for writing
[hls @ 0x7fb0bd805000] Opening 'xxx-2-2.m3u8.tmp' for writing
[hls @ 0x7fb0bd805000] Opening 'xxx-0-07.ts' for writing0:00:43.43 bitrate=N/A dup=648 drop=0 speed=0.535x
[hls @ 0x7fb0bd805000] Opening 'xxx-0-0.m3u8.tmp' for writing
[hls @ 0x7fb0bd805000] Opening 'xxx-1-17.ts' for writing0:00:43.50 bitrate=N/A dup=651 drop=0 speed=0.531x
[hls @ 0x7fb0bd805000] Opening 'xxx-1-1.m3u8.tmp' for writing
[hls @ 0x7fb0bd805000] Opening 'xxx-2-27.ts' for writing
[hls @ 0x7fb0bd805000] Opening 'xxx-2-2.m3u8.tmp' for writing
[hls @ 0x7fb0bd805000] Opening 'xxx-0-08.ts' for writing0:00:44.38 bitrate=N/A dup=663 drop=0 speed=0.531x
[hls @ 0x7fb0bd805000] Opening 'xxx-0-0.m3u8.tmp' for writing
[hls @ 0x7fb0bd805000] Opening 'xxx-1-18.ts' for writing
[hls @ 0x7fb0bd805000] Opening 'xxx-1-1.m3u8.tmp' for writing
[hls @ 0x7fb0bd805000] Opening 'xxx-2-28.ts' for writing
[hls @ 0x7fb0bd805000] Opening 'xxx-2-2.m3u8.tmp' for writing
frame= 1328 fps= 16 q=29.0 Lq=31.0 q=23.0 size=N/A time=00:00:44.44 bitrate=N/A dup=663 drop=0 speed=0.526x
video:7887kB audio:2086kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
[libx264 @ 0x7fb0bd808400] frame I:28    Avg QP:15.36  size: 32094
[libx264 @ 0x7fb0bd808400] frame P:485   Avg QP:19.33  size:  4549
[libx264 @ 0x7fb0bd808400] frame B:815   Avg QP:21.38  size:   706
[libx264 @ 0x7fb0bd808400] consecutive B-frames: 14.6%  8.9%  5.4% 71.1%
[libx264 @ 0x7fb0bd808400] mb I  I16..4: 52.6% 28.2% 19.1%
[libx264 @ 0x7fb0bd808400] mb P  I16..4:  9.0%  6.9%  0.3%  P16..4: 15.9%  4.1%  0.7%  0.0%  0.0%    skip:63.2%
[libx264 @ 0x7fb0bd808400] mb B  I16..4:  0.4%  0.2%  0.0%  B16..8:  6.7%  0.5%  0.0%  direct: 2.4%  skip:89.8%  L0:38.3% L1:58.2% BI: 3.5%
[libx264 @ 0x7fb0bd808400] 8x8 transform intra:38.4% inter:57.4%
[libx264 @ 0x7fb0bd808400] coded y,uvDC,uvAC intra: 28.0% 36.5% 6.7% inter: 2.1% 4.4% 0.0%
[libx264 @ 0x7fb0bd808400] i16 v,h,dc,p: 54% 26%  9% 11%
[libx264 @ 0x7fb0bd808400] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 21% 28% 26%  4%  4%  4%  5%  4%  4%
[libx264 @ 0x7fb0bd808400] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 27% 28% 11%  5%  6%  5%  7%  5%  5%
[libx264 @ 0x7fb0bd808400] i8c dc,h,v,p: 60% 24% 13%  3%
[libx264 @ 0x7fb0bd808400] Weighted P-Frames: Y:3.3% UV:2.5%
[libx264 @ 0x7fb0bd808400] ref P L0: 75.4% 24.6%
[libx264 @ 0x7fb0bd808400] ref B L0: 82.0% 18.0%
[libx264 @ 0x7fb0bd808400] ref B L1: 94.7%  5.3%
[libx264 @ 0x7fb0bd808400] kb/s:665.02
[libx264 @ 0x7fb0bd80ae00] frame I:28    Avg QP:18.69  size: 16646
[libx264 @ 0x7fb0bd80ae00] frame P:1300  Avg QP:21.33  size:   921
[libx264 @ 0x7fb0bd80ae00] mb I  I16..4: 62.1%  0.0% 37.9%
[libx264 @ 0x7fb0bd80ae00] mb P  I16..4:  4.0%  0.0%  0.3%  P16..4: 11.1%  2.8%  0.3%  0.0%  0.0%    skip:81.5%
[libx264 @ 0x7fb0bd80ae00] coded y,uvDC,uvAC intra: 18.8% 35.7% 7.5% inter: 2.0% 3.9% 0.0%
[libx264 @ 0x7fb0bd80ae00] i16 v,h,dc,p: 46% 29% 12% 13%
[libx264 @ 0x7fb0bd80ae00] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 27% 24% 19%  5%  5%  5%  5%  5%  4%
[libx264 @ 0x7fb0bd80ae00] i8c dc,h,v,p: 62% 23% 12%  2%
[libx264 @ 0x7fb0bd80ae00] ref P L0: 80.5% 19.5%
[libx264 @ 0x7fb0bd80ae00] kb/s:300.62
[libx264 @ 0x7fb0bc800600] frame I:28    Avg QP:12.56  size: 23611
[libx264 @ 0x7fb0bc800600] frame P:1300  Avg QP:16.40  size:  1594
[libx264 @ 0x7fb0bc800600] mb I  I16..4: 43.8%  0.0% 56.2%
[libx264 @ 0x7fb0bc800600] mb P  I16..4:  2.2%  0.0%  1.1%  P16..4: 17.1%  6.1%  2.1%  0.0%  0.0%    skip:71.5%
[libx264 @ 0x7fb0bc800600] final ratefactor: 18.02
[libx264 @ 0x7fb0bc800600] coded y,uvDC,uvAC intra: 40.5% 58.8% 39.5% inter: 6.3% 12.0% 0.7%
[libx264 @ 0x7fb0bc800600] i16 v,h,dc,p: 49% 25% 10% 16%
[libx264 @ 0x7fb0bc800600] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 28% 28% 16%  5%  6%  5%  5%  4%  5%
[libx264 @ 0x7fb0bc800600] i8c dc,h,v,p: 56% 30% 10%  4%
[libx264 @ 0x7fb0bc800600] ref P L0: 84.9%  9.5%  5.6%
[libx264 @ 0x7fb0bc800600] kb/s:493.90
localhost:dash StevenLiu$

comment:6 by Mattias, 5 years ago

It would work on a testbed (workstation) but when I tried the same on production (server) it balked - more processing power and memory on the server than in the testbed. I’m going to try later version, not done yet, and if it doesn’t work with the suggestions I’ll be back. I’m waiting for the production engineer to get me access to the server (it’s on the other side of the planet for me)

comment:7 by Dennis E. Mungai, 4 years ago

Hello there,

As mentioned in ticket #8444 , the issue you're seeing is because of using the double quotes on -var_stream_map, as in your case:
"v:0,a:0 v:1,a:1 v:2,a:2"

You should be using single quotes instead:
'v:0,a:0 v:1,a:1 v:2,a:2'

Note: See TracTickets for help on using tickets.