summaryrefslogtreecommitdiffstats
path: root/common/encode_lavc.c
diff options
context:
space:
mode:
Diffstat (limited to 'common/encode_lavc.c')
-rw-r--r--common/encode_lavc.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/common/encode_lavc.c b/common/encode_lavc.c
index 6f8378ac7f..5d34af609b 100644
--- a/common/encode_lavc.c
+++ b/common/encode_lavc.c
@@ -820,6 +820,7 @@ static void encoder_2pass_prepare(struct encoder_context *p)
stream_type_name(p->type));
if (p->encoder->flags & AV_CODEC_FLAG_PASS2) {
+ MP_INFO(p, "Reading 2-pass log: %s\n", filename);
struct stream *s = stream_open(filename, p->global);
if (s) {
struct bstr content = stream_read_complete(s, p, 1000000000);
@@ -838,6 +839,7 @@ static void encoder_2pass_prepare(struct encoder_context *p)
}
if (p->encoder->flags & AV_CODEC_FLAG_PASS1) {
+ MP_INFO(p, "Writing to 2-pass log: %s\n", filename);
p->twopass_bytebuffer = open_output_stream(filename, p->global);
if (!p->twopass_bytebuffer) {
MP_WARN(p, "could not open '%s', "
@@ -927,9 +929,9 @@ bool encoder_encode(struct encoder_context *p, AVFrame *frame)
av_init_packet(&packet);
status = avcodec_receive_packet(p->encoder, &packet);
- if (status == AVERROR(EAGAIN) || status == AVERROR_EOF)
+ if (status == AVERROR(EAGAIN))
break;
- if (status < 0)
+ if (status < 0 && status != AVERROR_EOF)
goto fail;
if (p->twopass_bytebuffer && p->encoder->stats_out) {
@@ -937,6 +939,9 @@ bool encoder_encode(struct encoder_context *p, AVFrame *frame)
strlen(p->encoder->stats_out));
}
+ if (status == AVERROR_EOF)
+ break;
+
encode_lavc_add_packet(p->mux_stream, &packet);
av_packet_unref(&packet);
}