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.
This commit is contained in:
parent
83f230c244
commit
69a638019f
12
avconv.c
12
avconv.c
@ -537,6 +537,12 @@ static void do_video_out(AVFormatContext *s,
|
|||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
goto error;
|
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) {
|
while (1) {
|
||||||
ret = avcodec_receive_packet(enc, &pkt);
|
ret = avcodec_receive_packet(enc, &pkt);
|
||||||
if (ret == AVERROR(EAGAIN))
|
if (ret == AVERROR(EAGAIN))
|
||||||
@ -554,12 +560,6 @@ static void do_video_out(AVFormatContext *s,
|
|||||||
}
|
}
|
||||||
|
|
||||||
ost->sync_opts++;
|
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;
|
return;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user