[FFmpeg-cvslog] avconv: fix -frames for video
Anton Khirnov
git at videolan.org
Sun May 8 23:51:44 CEST 2016
ffmpeg | branch: master | Anton Khirnov <anton at khirnov.net> | Sun Mar 27 14:25:31 2016 +0200| [69a638019fc0db4c2b75b36ef45d0acb6d2e9628] | committer: Anton Khirnov
avconv: fix -frames for video
For video, frame_number tracks the number of frames sent to the encoder.
So it should be incremented when we submit a frame, not when we get a
packet back.
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=69a638019fc0db4c2b75b36ef45d0acb6d2e9628
---
avconv.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/avconv.c b/avconv.c
index 07c81fa..2e199e3 100644
--- a/avconv.c
+++ b/avconv.c
@@ -537,6 +537,12 @@ static void do_video_out(AVFormatContext *s,
if (ret < 0)
goto error;
+ /*
+ * For video, there may be reordering, so we can't throw away frames on
+ * encoder flush, we need to limit them here, before they go into encoder.
+ */
+ ost->frame_number++;
+
while (1) {
ret = avcodec_receive_packet(enc, &pkt);
if (ret == AVERROR(EAGAIN))
@@ -554,12 +560,6 @@ static void do_video_out(AVFormatContext *s,
}
ost->sync_opts++;
- /*
- * For video, number of frames in == number of packets out.
- * But there may be reordering, so we can't throw away frames on encoder
- * flush, we need to limit them here, before they go into encoder.
- */
- ost->frame_number++;
}
return;
More information about the ffmpeg-cvslog
mailing list