|
|
@ -198,6 +198,7 @@ int enc_open(OutputStream *ost, AVFrame *frame) |
|
|
|
AVCodecContext *dec_ctx = NULL; |
|
|
|
AVCodecContext *dec_ctx = NULL; |
|
|
|
const AVCodec *enc = enc_ctx->codec; |
|
|
|
const AVCodec *enc = enc_ctx->codec; |
|
|
|
OutputFile *of = output_files[ost->file_index]; |
|
|
|
OutputFile *of = output_files[ost->file_index]; |
|
|
|
|
|
|
|
FrameData *fd = frame ? frame_data(frame) : NULL; |
|
|
|
int ret; |
|
|
|
int ret; |
|
|
|
|
|
|
|
|
|
|
|
if (e->opened) |
|
|
|
if (e->opened) |
|
|
@ -219,8 +220,8 @@ int enc_open(OutputStream *ost, AVFrame *frame) |
|
|
|
|
|
|
|
|
|
|
|
if (ost->bits_per_raw_sample) |
|
|
|
if (ost->bits_per_raw_sample) |
|
|
|
enc_ctx->bits_per_raw_sample = 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) |
|
|
|
else if (fd) |
|
|
|
enc_ctx->bits_per_raw_sample = FFMIN(dec_ctx->bits_per_raw_sample, |
|
|
|
enc_ctx->bits_per_raw_sample = FFMIN(fd->bits_per_raw_sample, |
|
|
|
av_get_bytes_per_sample(enc_ctx->sample_fmt) << 3); |
|
|
|
av_get_bytes_per_sample(enc_ctx->sample_fmt) << 3); |
|
|
|
|
|
|
|
|
|
|
|
enc_ctx->time_base = ost->enc_timebase.num > 0 ? ost->enc_timebase : |
|
|
|
enc_ctx->time_base = ost->enc_timebase.num > 0 ? ost->enc_timebase : |
|
|
@ -230,10 +231,8 @@ int enc_open(OutputStream *ost, AVFrame *frame) |
|
|
|
case AVMEDIA_TYPE_VIDEO: { |
|
|
|
case AVMEDIA_TYPE_VIDEO: { |
|
|
|
AVRational fr = ost->frame_rate; |
|
|
|
AVRational fr = ost->frame_rate; |
|
|
|
|
|
|
|
|
|
|
|
if (!fr.num && frame) { |
|
|
|
if (!fr.num && fd) |
|
|
|
FrameData *fd = frame_data(frame); |
|
|
|
|
|
|
|
fr = fd->frame_rate_filter; |
|
|
|
fr = fd->frame_rate_filter; |
|
|
|
} |
|
|
|
|
|
|
|
if (!fr.num && !ost->max_frame_rate.num) { |
|
|
|
if (!fr.num && !ost->max_frame_rate.num) { |
|
|
|
fr = (AVRational){25, 1}; |
|
|
|
fr = (AVRational){25, 1}; |
|
|
|
av_log(ost, AV_LOG_WARNING, |
|
|
|
av_log(ost, AV_LOG_WARNING, |
|
|
@ -282,8 +281,8 @@ int enc_open(OutputStream *ost, AVFrame *frame) |
|
|
|
|
|
|
|
|
|
|
|
if (ost->bits_per_raw_sample) |
|
|
|
if (ost->bits_per_raw_sample) |
|
|
|
enc_ctx->bits_per_raw_sample = 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) |
|
|
|
else if (fd) |
|
|
|
enc_ctx->bits_per_raw_sample = FFMIN(dec_ctx->bits_per_raw_sample, |
|
|
|
enc_ctx->bits_per_raw_sample = FFMIN(fd->bits_per_raw_sample, |
|
|
|
av_pix_fmt_desc_get(enc_ctx->pix_fmt)->comp[0].depth); |
|
|
|
av_pix_fmt_desc_get(enc_ctx->pix_fmt)->comp[0].depth); |
|
|
|
|
|
|
|
|
|
|
|
if (frame) { |
|
|
|
if (frame) { |
|
|
|