FFmpeg Taking Huge RAM memory

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

FFmpeg Taking Huge RAM memory

Matthew Reus
Hello ,
 I m running Ubuntu 18.04 server with nvidia compiled with ffmpeg

*ffmpeg version N-96891-g60b1f85 Copyright (c) 2000-2020 the FFmpeg
developers*
*  built with gcc 7 (Ubuntu 7.4.0-1ubuntu1~18.04.1)*
  *configuration: --prefix=/root/ffmpeg_build --pkg-config-flags=--static
--extra-cflags=-I/root/ffmpeg_build/include
--extra-ldflags=-L/root/ffmpeg_build/lib --extra-libs='-lpthread -lm'
--bindir=/root/bin --enable-cuda --enable-cuvid --enable-libnpp
--extra-cflags=-I../nv_sdk --extra-ldflags=-L../nv_sdk --enable-cuda-nvcc
--extra-cflags=-I/usr/local/cuda/include/
--extra-ldflags=-L/usr/local/cuda/lib64/ --enable-gpl --enable-libaom
--enable-libass --enable-libfdk-aac --enable-vaapi --enable-libfreetype
--enable-libmp3lame --enable-libopus --enable-libvorbis --enable-libvpx
--enable-libx264 --enable-libx265 --enable-nonfree*
  libavutil      56. 42.100 / 56. 42.100
  libavcodec     58. 73.102 / 58. 73.102
  libavformat    58. 39.101 / 58. 39.101
  libavdevice    58.  9.103 / 58.  9.103
  libavfilter     7. 77.100 /  7. 77.100
  libswscale      5.  6.100 /  5.  6.100
  libswresample   3.  6.100 /  3.  6.100
  libpostproc    55.  6.100 / 55.  6.100
Hyper fast Audio and Video encoder
usage: ffmpeg [options] [[infile options] -i infile]... {[outfile options]
outfile}...


I m running 29 ffmpeg process where i have two Quadro P5000  gpus are
running . I have 64 gb of ram memory . on transcoding i have fully
dedicated on gpu acceleration .But the ffmpeg process is taking huge ram
memory .

Here i have listed my scipt and logs . COuld you help me to solve these
issue .

*ffmpeg -hwaccel_device 0 -hwaccel nvdec -hwaccel_output_format cuda  -i
'udp://@172.16.16.25:9802?overrun_nonfatal=1&fifo_size=1000000\&overrun_nonfatal
<http://172.16.16.25:9802?overrun_nonfatal=1&fifo_size=1000000\&overrun_nonfatal>'
 -vf "format=yuv420p|cuda,yadif_cuda=0:-1:0,scale_npp=1280:720"  -b:v 2.5M
-bf 1 -aspect 16:9 -profile:v main -preset:v medium -c:v h264_nvenc -c:a
aac -b:a 128k -ar 48000 -strict -2 -f flv
 'rtmp://admin:admin@172.16.16.206/livetv/AnjanTv.stream
<http://admin:admin@172.16.16.206/livetv/AnjanTv.stream>'  -vf
"format=yuv420p|cuda,yadif_cuda=0:-1:0,scale_npp=-720:576"  -b:v 600k -bf 1
-aspect 16:9 -profile:v main -preset:v medium -c:v h264_nvenc -c:a aac -b:a
128k -ar 48000 -strict -2 -f flv
 'rtmp://admin:admin@172.16.16.206/ott/ottAnjanTv.stream
<http://admin:admin@172.16.16.206/ott/ottAnjanTv.stream>'*

ffmpeg version N-96891-g60b1f85 Copyright (c) 2000-2020 the FFmpeg
developers
  built with gcc 7 (Ubuntu 7.4.0-1ubuntu1~18.04.1)
  configuration: --prefix=/root/ffmpeg_build --pkg-config-flags=--static
--extra-cflags=-I/root/ffmpeg_build/include
--extra-ldflags=-L/root/ffmpeg_build/lib --extra-libs='-lpthread -lm'
--bindir=/root/bin --enable-cuda --enable-cuvid --enable-libnpp
--extra-cflags=-I../nv_sdk --extra-ldflags=-L../nv_sdk --enable-cuda-nvcc
--extra-cflags=-I/usr/local/cuda/include/
--extra-ldflags=-L/usr/local/cuda/lib64/ --enable-gpl --enable-libaom
--enable-libass --enable-libfdk-aac --enable-vaapi --enable-libfreetype
--enable-libmp3lame --enable-libopus --enable-libvorbis --enable-libvpx
--enable-libx264 --enable-libx265 --enable-nonfree
  libavutil      56. 42.100 / 56. 42.100
  libavcodec     58. 73.102 / 58. 73.102
  libavformat    58. 39.101 / 58. 39.101
  libavdevice    58.  9.103 / 58.  9.103
  libavfilter     7. 77.100 /  7. 77.100
  libswscale      5.  6.100 /  5.  6.100
  libswresample   3.  6.100 /  3.  6.100
  libpostproc    55.  6.100 / 55.  6.100

[h264 @ 0x5604c32c0740] SPS unavailable in decode_picture_timing
[h264 @ 0x5604c32c0740] non-existing PPS 0 referenced
[h264 @ 0x5604c32c0740] SPS unavailable in decode_picture_timing
[h264 @ 0x5604c32c0740] non-existing PPS 0 referenced
[h264 @ 0x5604c32c0740] decode_slice_header error
[h264 @ 0x5604c32c0740] no frame!
[h264 @ 0x5604c32c0740] mmco: unref short failure
[h264 @ 0x5604c32c0740] number of reference frames (0+4) exceeds max (3;
probably corrupt input), discarding one

[mpegts @ 0x5604c3299f00] Packet corrupt (stream = 0, dts = 2202070640).
[mpegts @ 0x5604c3299f00] PES packet size mismatch
[mpegts @ 0x5604c3299f00] Packet corrupt (stream = 1, dts = 2202020583).
[mpegts @ 0x5604c3299f00] PES packet size mismatch
[mpegts @ 0x5604c3299f00] Packet corrupt (stream = 3, dts = 2202132903).
[mpegts @ 0x5604c3299f00] Packet corrupt (stream = 0, dts = 2202200240).
Input #0, mpegts, from 'udp://@
172.16.16.25:9802?overrun_nonfatal=1&fifo_size=1000000\&overrun_nonfatal':
  Duration: N/A, start: 24465.599367, bitrate: N/A

  Program 13
    Stream #0:0[0x515]: Video: h264 (Main) ([27][0][0][0] / 0x001B),
yuv420p(tv, bt470bg, top first), 720x576 [SAR 12:11 DAR 15:11], 25 fps, 25
tbr, 90k tbn, 50 tbc
    Stream #0:1[0x516](eng): Audio: mp2 ([4][0][0][0] / 0x0004), 48000 Hz,
stereo, s16p, 128 kb/s
    Stream #0:2[0x517](eng): Audio: mp2 ([4][0][0][0] / 0x0004), 48000 Hz,
stereo, s16p, 64 kb/s
    Stream #0:3[0x518](eng): Audio: mp2 ([4][0][0][0] / 0x0004), 48000 Hz,
stereo, s16p, 64 kb/s
[rtmp @ 0x5604c32c0000] Ignoring unsupported var reason
[rtmp @ 0x5604c366d8c0] Ignoring unsupported var reason
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (native) -> h264 (h264_nvenc))
  Stream #0:1 -> #0:1 (mp2 (native) -> aac (native))
  Stream #0:0 -> #1:0 (h264 (native) -> h264 (h264_nvenc))
  Stream #0:1 -> #1:1 (mp2 (native) -> aac (native))
Press [q] to stop, [?] for help
[h264 @ 0x5604c3ac3740] co located POCs unavailable
[h264 @ 0x5604c3b1bcc0] mmco: unref short failure
[h264 @ 0x5604c3b1bcc0] number of reference frames (0+4) exceeds max (3;
probably corrupt input), discarding one
Output #0, flv, to 'rtmp://admin:admin@172.16.16.206/livetv/AnjanTv.stream':
  Metadata:
    encoder         : Lavf58.39.101
    Stream #0:0: Video: h264 (h264_nvenc) (Main) ([7][0][0][0] / 0x0007),
cuda, 1280x720 [SAR 1:1 DAR 16:9], q=-1--1, 2500 kb/s, 25 fps, 1k tbn, 25
tbc
    Metadata:
      encoder         : Lavc58.73.102 h264_nvenc
    Side data:
      cpb: bitrate max/min/avg: 0/0/2500000 buffer size: 5000000 vbv_delay:
N/A
    Stream #0:1(eng): Audio: aac (LC) ([10][0][0][0] / 0x000A), 48000 Hz,
stereo, fltp, 128 kb/s
    Metadata:
      encoder         : Lavc58.73.102 aac
Output #1, flv, to 'rtmp://admin:admin@172.16.16.206/ott/ottAnjanTv.stream':
  Metadata:
    encoder         : Lavf58.39.101
    Stream #1:0: Video: h264 (h264_nvenc) (Main) ([7][0][0][0] / 0x0007),
cuda, 720x576 [SAR 64:45 DAR 16:9], q=-1--1, 600 kb/s, 25 fps, 1k tbn, 25
tbc
    Metadata:
      encoder         : Lavc58.73.102 h264_nvenc
    Side data:
      cpb: bitrate max/min/avg: 0/0/600000 buffer size: 1200000 vbv_delay:
N/A
    Stream #1:1(eng): Audio: aac (LC) ([10][0][0][0] / 0x000A), 48000 Hz,
stereo, fltp, 128 kb/s
    Metadata:
      encoder         : Lavc58.73.102 aac
[mp2 @ 0x56122619da80] Header missing
Error while decoding stream #0:1: Invalid data found when processing input
[mp2 @ 0x56122619da80] Header missing
Error while decoding stream #0:1: Invalid data found when processing input
[mpegts @ 0x561226170f00] Packet corrupt (stream = 0, dts =
2213288240).te=2290.5kbits/s speed=2.44x
[mpegts @ 0x561226170f00] PES packet size mismatch
[mpegts @ 0x561226170f00] Packet corrupt (stream = 1, dts = 2213230983).
[mp2 @ 0x56122619da80] Header missing
Error while decoding stream #0:1: Invalid data found when processing input
[mpegts @ 0x561226170f00] Packet corrupt (stream = 0, dts =
2213932640).te=2596.1kbits/s speed=1.48x
[h264 @ 0x5612269ed4c0] mmco: unref short failure time=00:00:16.80
bitrate=2599.0kbits/s speed=1.46x
[h264 @ 0x5612269ed4c0] number of reference frames (0+4) exceeds max (3;
probably corrupt input), discarding one
[mpegts @ 0x561226170f00] Packet corrupt (stream = 0, dts =
2214166640).te=2654.0kbits/s speed=1.39x
[mpegts @ 0x561226170f00] PES packet size mismatch
[mpegts @ 0x561226170f00] Packet corrupt (stream = 1, dts = 2214099303).
[mp2 @ 0x56122619da80] Header missing
Error while decoding stream #0:1: Invalid data found when processing input
[mpegts @ 0x561226170f00] Packet corrupt (stream = 0, dts = 2214199040).
[flv @ 0x5612261c6280] Failed to update header with correct
duration.trate=2625.2kbits/s speed=1.29x
[flv @ 0x5612261c6280] Failed to update header with correct filesize.
[flv @ 0x561226191480] Failed to update header with correct duration.
[flv @ 0x561226191480] Failed to update header with correct filesize.
frame=  553 fps= 30 q=25.0 Lq=31.0 size=    7661kB time=00:00:23.80
bitrate=2636.7kbits/s speed=1.29x
_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: FFmpeg Taking Huge RAM memory

Carl Eugen Hoyos-2
Am Mo., 22. Juni 2020 um 16:23 Uhr schrieb Matthew Reus
<[hidden email]>:

> *ffmpeg -hwaccel_device 0 -hwaccel nvdec -hwaccel_output_format cuda  -i
> 'udp://@172.16.16.25:9802?overrun_nonfatal=1&fifo_size=1000000\&overrun_nonfatal
> <http://172.16.16.25:9802?overrun_nonfatal=1&fifo_size=1000000\&overrun_nonfatal>'
>  -vf "format=yuv420p|cuda,yadif_cuda=0:-1:0,scale_npp=1280:720"  -b:v 2.5M
> -bf 1 -aspect 16:9 -profile:v main -preset:v medium -c:v h264_nvenc -c:a
> aac -b:a 128k -ar 48000 -strict -2 -f flv
>  'rtmp://admin:admin@172.16.16.206/livetv/AnjanTv.stream
> <http://admin:admin@172.16.16.206/livetv/AnjanTv.stream>'  -vf
> "format=yuv420p|cuda,yadif_cuda=0:-1:0,scale_npp=-720:576"  -b:v 600k -bf 1
> -aspect 16:9 -profile:v main -preset:v medium -c:v h264_nvenc -c:a aac -b:a
> 128k -ar 48000 -strict -2 -f flv
>  'rtmp://admin:admin@172.16.16.206/ott/ottAnjanTv.stream
> <http://admin:admin@172.16.16.206/ott/ottAnjanTv.stream>'*

I try to avoid network issues (I realized at some point that they are
*always* unreproducible and impossible to debug) but aren't you
explicitly asking FFmpeg to allocate huge amounts of memory?

Or to ask differently:
Is the issue reproducible with software decoding?
Is the issue reproducible with software encoding?
Is the issue reproducible with file output?
Is the issue reproducible with file input?

If this does not help, there is a tool called massif which tells
you where exactly memory allocations happen.

Carl Eugen
_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".