pFormatCtx->start_time = -1;
/**
+ * If you could not find codec parameters for stream info,
+ * consider increasing the value for the 'analyzeduration' and 'probesize' options.
+ */
+ /**
*@important if data is corrupted, occur segment fault by av_find_stream_info().
* - fixed 2009-06-25.
*/
+ /**
+ * fixed 2021-11-09
+ * if the content is 8k, the mem-usage in avformat_find_stream_info() is too large, 300MB or more.
+ * so we adjust 'probesize' to reduce memory usage in avformat_find_stream_info().
+ * Please refer to below for detail.
+ * https://ffmpeg.org/ffmpeg-formats.html#Format-Options
+ */
if (formatContext->formatType == MM_FILE_FORMAT_M2TS)
pFormatCtx->max_analyze_duration = 100000; // MPEGTS file timeout set
+ else
+ pFormatCtx->probesize = 900000;
if (formatContext->cdis != 1) {
if (avformat_find_stream_info(pFormatCtx, NULL) < 0) {