[FFmpeg-cvslog] Support dropping audio dts/pts via -async -1.

Reimar Döffinger git at videolan.org
Thu Mar 22 20:46:39 CET 2012


ffmpeg | branch: master | Reimar Döffinger <Reimar.Doeffinger at gmx.de> | Thu Mar 22 20:17:42 2012 +0100| [ffa28da180113b53bcb32ed38e913ad27c0cde24] | committer: Reimar Döffinger

Support dropping audio dts/pts via -async -1.

Allows working around issue #605.
Note: as a side effect this fixes that -vsync drop
as far as I could tell would not drop pts/dts values
when duplicating frames or when flushing encoder delay.

Signed-off-by: Reimar Döffinger <Reimar.Doeffinger at gmx.de>

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

 ffmpeg.c |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/ffmpeg.c b/ffmpeg.c
index 2a64182..0f6bc30 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -999,6 +999,10 @@ static void write_frame(AVFormatContext *s, AVPacket *pkt, OutputStream *ost)
     AVCodecContext          *avctx = ost->st->codec;
     int ret;
 
+    if ((avctx->codec_type == AVMEDIA_TYPE_VIDEO && video_sync_method == VSYNC_DROP) ||
+        (avctx->codec_type == AVMEDIA_TYPE_AUDIO && audio_sync_method < 0))
+        pkt->pts = pkt->dts = AV_NOPTS_VALUE;
+
     /*
      * Audio encoders may split the packets --  #frames in != #packets out.
      * But there is no reordering, so we can limit the number of output packets
@@ -1227,7 +1231,7 @@ need_realloc:
 
     av_assert0(ost->audio_resample || dec->sample_fmt==enc->sample_fmt);
 
-    if (audio_sync_method) {
+    if (audio_sync_method > 0) {
         double delta = get_sync_ipts(ost, ist->pts) * enc->sample_rate - ost->sync_opts -
                        av_fifo_size(ost->fifo) / (enc->channels * osize);
         int idelta = delta * dec->sample_rate / enc->sample_rate;
@@ -1652,9 +1656,6 @@ static void do_video_out(AVFormatContext *s, OutputStream *ost,
                            av_ts2str(pkt.dts), av_ts2timestr(pkt.dts, &ost->st->time_base));
                 }
 
-                if (format_video_sync == VSYNC_DROP)
-                    pkt.pts = pkt.dts = AV_NOPTS_VALUE;
-
                 write_frame(s, &pkt, ost);
                 frame_size = pkt.size;
                 video_size += pkt.size;



More information about the ffmpeg-cvslog mailing list