You've already forked FFmpeg
mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-07-16 22:42:38 +02:00
avconv: allow -b to be used with streamcopy
In this mode it tells the muxer about the bitrate of the input stream.
This commit is contained in:
3
avconv.c
3
avconv.c
@ -1852,6 +1852,9 @@ static int init_output_stream_streamcopy(OutputStream *ost)
|
|||||||
|
|
||||||
ost->st->time_base = ist->st->time_base;
|
ost->st->time_base = ist->st->time_base;
|
||||||
|
|
||||||
|
if (ost->bitrate_override)
|
||||||
|
par_dst->bit_rate = ost->bitrate_override;
|
||||||
|
|
||||||
if (ist->st->nb_side_data) {
|
if (ist->st->nb_side_data) {
|
||||||
ost->st->side_data = av_realloc_array(NULL, ist->st->nb_side_data,
|
ost->st->side_data = av_realloc_array(NULL, ist->st->nb_side_data,
|
||||||
sizeof(*ist->st->side_data));
|
sizeof(*ist->st->side_data));
|
||||||
|
5
avconv.h
5
avconv.h
@ -162,6 +162,8 @@ typedef struct OptionsContext {
|
|||||||
int nb_sample_fmts;
|
int nb_sample_fmts;
|
||||||
SpecifierOpt *qscale;
|
SpecifierOpt *qscale;
|
||||||
int nb_qscale;
|
int nb_qscale;
|
||||||
|
SpecifierOpt *bitrates;
|
||||||
|
int nb_bitrates;
|
||||||
SpecifierOpt *forced_key_frames;
|
SpecifierOpt *forced_key_frames;
|
||||||
int nb_forced_key_frames;
|
int nb_forced_key_frames;
|
||||||
SpecifierOpt *force_fps;
|
SpecifierOpt *force_fps;
|
||||||
@ -382,6 +384,9 @@ typedef struct OutputStream {
|
|||||||
int forced_kf_index;
|
int forced_kf_index;
|
||||||
char *forced_keyframes;
|
char *forced_keyframes;
|
||||||
|
|
||||||
|
// the bitrate to send to the muxer for streamcopy
|
||||||
|
int bitrate_override;
|
||||||
|
|
||||||
char *logfile_prefix;
|
char *logfile_prefix;
|
||||||
FILE *logfile;
|
FILE *logfile;
|
||||||
|
|
||||||
|
11
avconv_opt.c
11
avconv_opt.c
@ -952,6 +952,7 @@ static OutputStream *new_output_stream(OptionsContext *o, AVFormatContext *oc, e
|
|||||||
const char *bsfs = NULL;
|
const char *bsfs = NULL;
|
||||||
char *next, *codec_tag = NULL;
|
char *next, *codec_tag = NULL;
|
||||||
double qscale = -1;
|
double qscale = -1;
|
||||||
|
int bitrate = 0;
|
||||||
|
|
||||||
if (!st) {
|
if (!st) {
|
||||||
av_log(NULL, AV_LOG_FATAL, "Could not alloc stream.\n");
|
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;
|
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;
|
ost->max_muxing_queue_size = 128;
|
||||||
MATCH_PER_STREAM_OPT(max_muxing_queue_size, i, ost->max_muxing_queue_size, oc, st);
|
MATCH_PER_STREAM_OPT(max_muxing_queue_size, i, ost->max_muxing_queue_size, oc, st);
|
||||||
ost->max_muxing_queue_size *= sizeof(AVPacket);
|
ost->max_muxing_queue_size *= sizeof(AVPacket);
|
||||||
@ -2570,6 +2579,8 @@ const OptionDef options[] = {
|
|||||||
{ "qscale", HAS_ARG | OPT_EXPERT | OPT_DOUBLE |
|
{ "qscale", HAS_ARG | OPT_EXPERT | OPT_DOUBLE |
|
||||||
OPT_SPEC | OPT_OUTPUT, { .off = OFFSET(qscale) },
|
OPT_SPEC | OPT_OUTPUT, { .off = OFFSET(qscale) },
|
||||||
"use fixed quality scale (VBR)", "q" },
|
"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) },
|
{ "filter", HAS_ARG | OPT_STRING | OPT_SPEC | OPT_OUTPUT, { .off = OFFSET(filters) },
|
||||||
"set stream filterchain", "filter_list" },
|
"set stream filterchain", "filter_list" },
|
||||||
{ "filter_script", HAS_ARG | OPT_STRING | OPT_SPEC | OPT_OUTPUT, { .off = OFFSET(filter_scripts) },
|
{ "filter_script", HAS_ARG | OPT_STRING | OPT_SPEC | OPT_OUTPUT, { .off = OFFSET(filter_scripts) },
|
||||||
|
@ -354,6 +354,13 @@ Stop writing to the stream after @var{framecount} frames.
|
|||||||
Use fixed quality scale (VBR). The meaning of @var{q} is
|
Use fixed quality scale (VBR). The meaning of @var{q} is
|
||||||
codec-dependent.
|
codec-dependent.
|
||||||
|
|
||||||
|
@item -b[:@var{stream_specifier}] @var{bitrate} (@emph{output,per-stream})
|
||||||
|
Set the stream bitrate in bits per second. When transcoding, this tells the
|
||||||
|
encoder to use the specified bitrate for the encoded stream.
|
||||||
|
|
||||||
|
For streamcopy, this provides a hint to the muxer about the bitrate of the input
|
||||||
|
stream.
|
||||||
|
|
||||||
@item -filter[:@var{stream_specifier}] @var{filter_graph} (@emph{output,per-stream})
|
@item -filter[:@var{stream_specifier}] @var{filter_graph} (@emph{output,per-stream})
|
||||||
@var{filter_graph} is a description of the filter graph to apply to
|
@var{filter_graph} is a description of the filter graph to apply to
|
||||||
the stream. Use @code{-filters} to show all the available filters
|
the stream. Use @code{-filters} to show all the available filters
|
||||||
|
Reference in New Issue
Block a user