summaryrefslogtreecommitdiff
path: root/fftools/ffmpeg.c
diff options
context:
space:
mode:
Diffstat (limited to 'fftools/ffmpeg.c')
-rw-r--r--fftools/ffmpeg.c14
1 files changed, 5 insertions, 9 deletions
diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c
index 03aec1af11..47e6a8683e 100644
--- a/fftools/ffmpeg.c
+++ b/fftools/ffmpeg.c
@@ -3335,7 +3335,7 @@ static int init_output_stream_encode(OutputStream *ost, AVFrame *frame)
if (ost->bits_per_raw_sample)
enc_ctx->bits_per_raw_sample = ost->bits_per_raw_sample;
- else if (dec_ctx)
+ else if (dec_ctx && ost->filter->graph->is_meta)
enc_ctx->bits_per_raw_sample = FFMIN(dec_ctx->bits_per_raw_sample,
av_get_bytes_per_sample(enc_ctx->sample_fmt) << 3);
@@ -3361,7 +3361,10 @@ static int init_output_stream_encode(OutputStream *ost, AVFrame *frame)
av_buffersink_get_sample_aspect_ratio(ost->filter->filter);
enc_ctx->pix_fmt = av_buffersink_get_format(ost->filter->filter);
- if (dec_ctx)
+
+ if (ost->bits_per_raw_sample)
+ enc_ctx->bits_per_raw_sample = ost->bits_per_raw_sample;
+ else if (dec_ctx && ost->filter->graph->is_meta)
enc_ctx->bits_per_raw_sample = FFMIN(dec_ctx->bits_per_raw_sample,
av_pix_fmt_desc_get(enc_ctx->pix_fmt)->comp[0].depth);
@@ -3377,13 +3380,6 @@ static int init_output_stream_encode(OutputStream *ost, AVFrame *frame)
ost->st->avg_frame_rate = ost->frame_rate;
- if (!dec_ctx ||
- enc_ctx->width != dec_ctx->width ||
- enc_ctx->height != dec_ctx->height ||
- enc_ctx->pix_fmt != dec_ctx->pix_fmt) {
- enc_ctx->bits_per_raw_sample = ost->bits_per_raw_sample;
- }
-
// Field order: autodetection
if (frame) {
if (enc_ctx->flags & (AV_CODEC_FLAG_INTERLACED_DCT | AV_CODEC_FLAG_INTERLACED_ME) &&