aboutsummaryrefslogtreecommitdiffstats
path: root/avconv_opt.c
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2017-01-30 21:35:42 +0100
committerAnton Khirnov <anton@khirnov.net>2017-02-01 10:42:59 +0100
commitb420a27e74750b60d2e064236afb10be06a38ace (patch)
tree77d7f6777d249ca8011f6eb030c5d43e893a02ad /avconv_opt.c
parentab2539bd374fe7ddbc6e2f058b62645cd5076192 (diff)
downloadffmpeg-b420a27e74750b60d2e064236afb10be06a38ace.tar.gz
avconv: allow -b to be used with streamcopy
In this mode it tells the muxer about the bitrate of the input stream.
Diffstat (limited to 'avconv_opt.c')
-rw-r--r--avconv_opt.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/avconv_opt.c b/avconv_opt.c
index 8b43f0f4e2..e078a0b89d 100644
--- a/avconv_opt.c
+++ b/avconv_opt.c
@@ -952,6 +952,7 @@ static OutputStream *new_output_stream(OptionsContext *o, AVFormatContext *oc, e
const char *bsfs = NULL;
char *next, *codec_tag = NULL;
double qscale = -1;
+ int bitrate = 0;
if (!st) {
av_log(NULL, AV_LOG_FATAL, "Could not alloc stream.\n");
@@ -1091,6 +1092,14 @@ static OutputStream *new_output_stream(OptionsContext *o, AVFormatContext *oc, e
ost->enc_ctx->global_quality = FF_QP2LAMBDA * qscale;
}
+ MATCH_PER_STREAM_OPT(bitrates, i, bitrate, oc, st);
+ if (bitrate > 0) {
+ if (ost->stream_copy)
+ ost->bitrate_override = bitrate;
+ else
+ ost->enc_ctx->bit_rate = bitrate;
+ }
+
ost->max_muxing_queue_size = 128;
MATCH_PER_STREAM_OPT(max_muxing_queue_size, i, ost->max_muxing_queue_size, oc, st);
ost->max_muxing_queue_size *= sizeof(AVPacket);
@@ -2570,6 +2579,8 @@ const OptionDef options[] = {
{ "qscale", HAS_ARG | OPT_EXPERT | OPT_DOUBLE |
OPT_SPEC | OPT_OUTPUT, { .off = OFFSET(qscale) },
"use fixed quality scale (VBR)", "q" },
+ { "b", HAS_ARG | OPT_INT | OPT_SPEC | OPT_OUTPUT, { .off = OFFSET(bitrates) },
+ "set stream bitrate in bits/second", "bitrate" },
{ "filter", HAS_ARG | OPT_STRING | OPT_SPEC | OPT_OUTPUT, { .off = OFFSET(filters) },
"set stream filterchain", "filter_list" },
{ "filter_script", HAS_ARG | OPT_STRING | OPT_SPEC | OPT_OUTPUT, { .off = OFFSET(filter_scripts) },