This fixes the case where muxing fails hard in case of stream copying damaged 
input

Signed-off-by: Michael Niedermayer <michae...@gmx.at>
---
 ffmpeg.c |    8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/ffmpeg.c b/ffmpeg.c
index 47a4144..5492cfe 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -670,6 +670,14 @@ static void write_frame(AVFormatContext *s, AVPacket *pkt, 
OutputStream *ost)
                      - FFMIN3(pkt->pts, pkt->dts, ost->last_mux_dts + 1)
                      - FFMAX3(pkt->pts, pkt->dts, ost->last_mux_dts + 1);
         }
+        if (pkt->dts != AV_NOPTS_VALUE &&
+            pkt->pts == AV_NOPTS_VALUE &&
+            !(s->oformat->flags & AVFMT_TS_NONSTRICT)) { //FIXME use a 
AVFMT_TS_NEEDS_PTS
+            av_log(s, AV_LOG_WARNING, "PTS unknown, using DTS: %"PRId64" in 
output stream %d:%d\n",
+                   pkt->dts,
+                   ost->file_index, ost->st->index);
+            pkt->pts = pkt->dts;
+        }
      if(
         (avctx->codec_type == AVMEDIA_TYPE_AUDIO || avctx->codec_type == 
AVMEDIA_TYPE_VIDEO) &&
         pkt->dts != AV_NOPTS_VALUE &&
-- 
1.7.9.5

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel

Reply via email to