[FFmpeg-devel] [PATCH] ffmpeg_filter: initialize sub2video.end_pts together with last_pts

Jan Ekström jeebjp at gmail.com
Thu Feb 21 13:16:00 EET 2019

This fixes buffering of samples which causes sudden ballooning of
memory usage in case of no subtitle samples coming in for a while if
the filter chain had been re-initialized.

You can also see messages a la:
"Error while add the frame to buffer source(Invalid argument)."
disappearing after filter chain re-initializations.

Passes fate-sub2video.

Example (memory usage before patch around 700+ MiB, after around 150MiB) :
/usr/bin/time -v ffmpeg -v verbose \
  -i "https://megumin.fushizen.eu/samples/2019-01-18-audio_reconfig_causes_buffer_growth.ts"
  -map "[video_out]" \
    -c:v mpeg4 \
    -b:v 750k \
  -map "[filtered_audio]" \
    -c:a aac \
    -b:a 192k \

Best regards,
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-ffmpeg_filter-initialize-sub2video.end_pts-together-.patch
Type: text/x-patch
Size: 1138 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20190221/b9e7abb8/attachment.bin>

More information about the ffmpeg-devel mailing list