The packet type should be checked before the start value is assigned. For example, if the first packet to arrive is an audio packet, the value of start-pts is in the timebase units of the audio stream. This will cause the stream to be split on every I-frame of the video stream since the pts value of the audio stream is typically much smaller than the pts value of the video stream. --- libavformat/hlsenc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c index 902896ef81..85167761b9 100644 --- a/libavformat/hlsenc.c +++ b/libavformat/hlsenc.c @@ -2201,7 +2201,7 @@ static int hls_write_packet(AVFormatContext *s, AVPacket *pkt) end_pts = init_list_dur + after_init_list_dur ; } - if (vs->start_pts == AV_NOPTS_VALUE) { + if (st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO && vs->start_pts == AV_NOPTS_VALUE) { vs->start_pts = pkt->pts; vs->end_frame = st->nb_frames; } -- _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel