From 62bacc4e0cfe16509f3b43675f83d1ac9d19ff5b Mon Sep 17 00:00:00 2001 From: Takashi Mochizuki Date: Sun, 13 Feb 2011 09:18:45 +0900 Subject: [PATCH] movenc: Force first sample as SYNC Signed-off-by: Mans Rullgard (cherry picked from commit 44b11207248c6ca6edb7d3469c0fbdca45dbfa70) --- libavformat/movenc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libavformat/movenc.c b/libavformat/movenc.c index 0949d29457..5e6e3a6521 100644 --- a/libavformat/movenc.c +++ b/libavformat/movenc.c @@ -1981,7 +1981,8 @@ int ff_mov_write_packet(AVFormatContext *s, AVPacket *pkt) trk->cluster[trk->entry].cts = pkt->pts - pkt->dts; trk->cluster[trk->entry].flags = 0; if (pkt->flags & AV_PKT_FLAG_KEY) { - if (mov->mode == MODE_MOV && enc->codec_id == CODEC_ID_MPEG2VIDEO) { + if (mov->mode == MODE_MOV && enc->codec_id == CODEC_ID_MPEG2VIDEO && + trk->entry > 0) { // force sync sample for the first key frame mov_parse_mpeg2_frame(pkt, &trk->cluster[trk->entry].flags); if (trk->cluster[trk->entry].flags & MOV_PARTIAL_SYNC_SAMPLE) trk->flags |= MOV_TRACK_STPS;