[FFmpeg-cvslog] movenc: Force first sample as SYNC

Takashi Mochizuki git
Tue Feb 15 00:59:08 CET 2011


ffmpeg | branch: master | Takashi Mochizuki <mochi at da2.so-net.ne.jp> | Sun Feb 13 09:18:45 2011 +0900| [62bacc4e0cfe16509f3b43675f83d1ac9d19ff5b] | committer: Michael Niedermayer

movenc: Force first sample as SYNC

Signed-off-by: Mans Rullgard <mans at mansr.com>
(cherry picked from commit 44b11207248c6ca6edb7d3469c0fbdca45dbfa70)

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=62bacc4e0cfe16509f3b43675f83d1ac9d19ff5b
---

 libavformat/movenc.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index 0949d29..5e6e3a6 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;




More information about the ffmpeg-cvslog mailing list