[FFmpeg-user] Ffmpeg in copy-ing mode uses too much RAM

Jakub Vojáček jakub at jacon.cz
Mon Apr 23 22:17:20 EEST 2018


Hello Carl,

sorry about the pastebin, will insert the console outputs directly here
next time. We cannot use tcpdump because there are cases where we want to
copy out just some parts of the mcast instead of the whole multicast.

I tried removing -movflags faststart and it consumed up to 1.3gb memory,
see below.

fmpeg -benchmark -i 'udp://@
239.100.0.23:1234?interface=172.16.128.42&fifo_size=100000000&timeout=100000000'
-copyinkf  -t 600 -map 0:0 -vcodec copy -map 0:1 -vcodec copy -map 0:2
-vcodec copy -map 0:3 -vcodec copy -map 0:4 -acodec copy -map 0:5 -acodec
copy -map 0:6 -acodec copy -map 0:7 -acodec copy output2.mp4

Input #0, mpegts, from 'udp://@
239.100.0.23:1234?interface=172.16.128.42&fifo_size=100000000&timeout=100000000
':
  Duration: N/A, start: 10841.229333, bitrate: N/A
  Program 1
    Metadata:
      service_name    : Service01
      service_provider: FFmpeg
    Stream #0:0[0x100]: Video: h264 (Main) ([27][0][0][0] / 0x001B),
yuv420p(progressive), 640x360 [SAR 1:1 DAR 16:9], 25 fps, 25 tbr, 90k tbn,
50 tbc
    Stream #0:1[0x101]: Video: h264 (Main) ([27][0][0][0] / 0x001B),
yuv420p(progressive), 720x410 [SAR 82:81 DAR 16:9], 25 fps, 25 tbr, 90k
tbn, 50 tbc
    Stream #0:2[0x102]: Video: h264 (Main) ([27][0][0][0] / 0x001B),
yuv420p(progressive), 1280x720 [SAR 1:1 DAR 16:9], 25 fps, 25 tbr, 90k tbn,
50 tbc
    Stream #0:3[0x103]: Video: h264 (Main) ([27][0][0][0] / 0x001B),
yuv420p(progressive), 1920x1080 [SAR 1:1 DAR 16:9], 25 fps, 25 tbr, 90k
tbn, 50 tbc
    Stream #0:4[0x104](cze): Audio: aac (LC) ([15][0][0][0] / 0x000F),
48000 Hz, stereo, fltp, 132 kb/s
    Stream #0:5[0x105](eng): Audio: aac (LC) ([15][0][0][0] / 0x000F),
48000 Hz, stereo, fltp, 119 kb/s
    Stream #0:6[0x106](hun): Audio: aac (LC) ([15][0][0][0] / 0x000F),
48000 Hz, stereo, fltp, 122 kb/s
    Stream #0:7[0x107](ron): Audio: aac (LC) ([15][0][0][0] / 0x000F),
48000 Hz, stereo, fltp, 141 kb/s
File 'output2.mp4' already exists. Overwrite ? [y/N] y
Output #0, mp4, to 'output2.mp4':
  Metadata:
    encoder         : Lavf58.12.100
    Stream #0:0: Video: h264 (Main) (avc1 / 0x31637661),
yuv420p(progressive), 640x360 [SAR 1:1 DAR 16:9], q=2-31, 25 fps, 25 tbr,
90k tbn, 90k tbc
    Stream #0:1: Video: h264 (Main) (avc1 / 0x31637661),
yuv420p(progressive), 720x410 [SAR 82:81 DAR 16:9], q=2-31, 25 fps, 25 tbr,
90k tbn, 90k tbc
    Stream #0:2: Video: h264 (Main) (avc1 / 0x31637661),
yuv420p(progressive), 1280x720 [SAR 1:1 DAR 16:9], q=2-31, 25 fps, 25 tbr,
90k tbn, 90k tbc
    Stream #0:3: Video: h264 (Main) (avc1 / 0x31637661),
yuv420p(progressive), 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 25 fps, 25 tbr,
90k tbn, 90k tbc
    Stream #0:4(cze): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz,
stereo, fltp, 132 kb/s
    Stream #0:5(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz,
stereo, fltp, 119 kb/s
    Stream #0:6(hun): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz,
stereo, fltp, 122 kb/s
    Stream #0:7(ron): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz,
stereo, fltp, 141 kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
  Stream #0:1 -> #0:1 (copy)
  Stream #0:2 -> #0:2 (copy)
  Stream #0:3 -> #0:3 (copy)
  Stream #0:4 -> #0:4 (copy)
  Stream #0:5 -> #0:5 (copy)
  Stream #0:6 -> #0:6 (copy)
  Stream #0:7 -> #0:7 (copy)
Press [q] to stop, [?] for help
frame=14996 fps= 14 q=-1.0 Lq=-1.0 q=-1.0 q=-1.0 size=  637703kB
time=00:09:59.99 bitrate=8706.8kbits/s speed=0.55x
video:598653kB audio:38455kB subtitle:0kB other streams:0kB global
headers:0kB muxing overhead: 0.093389%
bench: utime=1.292s
bench: maxrss=1300948kB

Thank you for any additional help

Jakub

[image: jacon] *Jakub Vojacek*
*Senior developer*
*JACON s.r.o*
*email:* jakub at jacon.cz || *web:* http://www.jacon.cz <http://jacon.cz/>

On Mon, Apr 23, 2018 at 1:35 PM, Carl Eugen Hoyos <ceffmpeg at gmail.com>
wrote:

> 2018-04-23 13:25 GMT+02:00, Jakub Vojáček <jakub at jacon.cz>:
>
> > we have multicast that has multiple video bitrates and audios
> > in it. We are trying to copy out some snapshot of the stream
> > using -copy. It is 10 minutes and according to benchmark
> > parameter, the maximum amount of memory uses 1.6GB
> > which is a lot, considering that it should just read the
> > multicast and save it into output file. Please check this
>
> (Note sure if this is related to your question but FFmpeg is
> not the right tool to save multicast input into a file, it is a
> transcoding and remuxing utility, not a tool to dump
> network streams, tcpdump should be.)
>
> > pastebing  - https://pastebin.com/rVXhKivd.
>
> Please avoid using external resources for console output,
> future readers may be interested in your issue.
>
> Is the issue only reproducible with network input or also
> with file input?
> Is the issue also reproducible without "-movflags faststart"?
>
> Carl Eugen
> _______________________________________________
> ffmpeg-user mailing list
> ffmpeg-user at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-user
>
> To unsubscribe, visit link above, or email
> ffmpeg-user-request at ffmpeg.org with subject "unsubscribe".


More information about the ffmpeg-user mailing list