FFmpeg consumer constant failure - cannot allocate memory

Hi,

I use CasparCG server v2.4.0-rc1 and start ffmpeg consumer started via:

<consumers>
    <ffmpeg>
        <path>udp://127.0.0.1:9094?pkt_size=1316&bitrate=8000000&reuse=1&overrun_nonfatal=1&max_interleave_delta=1000000&fifo_size=xxxxxxx&buffer_size=yyyyyyyyy</path>
        <args>-codec:v h264_nvenc -preset:v p7 -profile:v high -tune:v ll -level:v 4.2 -g:v 50 -rc:v cbr -b_ref_mode:v middle -temporal-aq:v 1 -rc-lookahead:v 20 -i_qfactor:v 0.75 -b_qfactor:v 1.1 -bufsize:v 0.7M -max_delay 0.7M -pcr_period 30 -minrate:v 7M -maxrate:v 7M -b:v 7M -bf:v 2 -qmin:v 0 -ac:a 2 -channel_layout:a stereo -codec:a aac -ar:a 48000 -b:a 256K -bufsize:a 128K -minrate:a 256K -maxrate:a 256K -format mpegts -muxrate 8M -mpegts_flags +system_b -fflags +genpts+nofillin -flush_packets 0 -mpegts_pmt_start_pid 0x1500 -mpegts_start_pid 0x150 -mpegts_service_type advanced_codec_digital_hdtv</args>
    </ffmpeg>
</consumers>

with CasparCG client v2.3.0-rc1 executing a 48 hours playlist. Everything started as expected and on the 12th minute the ffmpeg cosumer terminates with Cannot allocate memory issue described here. It appeared that this error has already been reported as issue on ffmpeg trac system here.

I increased 10 times the default fifo_size and buffer_size values, as a result the ffmpeg consumer failed in around 120 minutes.

I increased 20 times the default fifo_size and buffer_size values, as a result the ffmpeg consumer failed in around 240 minutes.

As a conclusion it appeared that ffmpeg consumer termination depends on fifo_size and buffer_size values.

Before fixing, if possible, this issue one possible solution is to stop the existing consumer and start a new one on each entry in the playlist.

Do you have other suggestions?

1 Like

Yes, I would try that. Just play the next clip on another layer and clear the old one. Afterwards you can reuse the first.

1 Like

Thank you for the direction!
My plan was to use:

1) ADD 1-700 STREAM ........
2) PLAY 1-10 MY_CLIP
3) REMOVE 1-700
4) ADD 1-700 STREAM ........
5) PLAY 1-10 MY_NEXT_CLIP

With regards to playing next clip on another layer, how it will look like from AMCP standpoint? Should I create a second consumer while the first is running to take the second clip?

Is it possible your proposal to be integrated in any of the available platforms like Sofie, Nebula or SuperConductor ?

Thank you!

1 Like

Aha, sorry, I did not realize, that you want to stream. So my comment does not make any sense…

1 Like