From: Peter Große <[email protected]> Bandwidth information is required in the manifest, but not always provided by the demuxer. So enable hinting the stream bandwidth via a metadata field, supports same values as codec bitrate setting.
Example: -metadata:s:v:0 bitrate=3500k Signed-off-by: Peter Große <[email protected]> --- libavformat/dashenc.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c index 93c292f..1cd9563 100644 --- a/libavformat/dashenc.c +++ b/libavformat/dashenc.c @@ -25,6 +25,7 @@ #endif #include "libavutil/avstring.h" +#include "libavutil/eval.h" #include "libavutil/intreadwrite.h" #include "libavutil/mathematics.h" #include "libavutil/opt.h" @@ -586,6 +587,17 @@ static int dash_write_header(AVFormatContext *s) char filename[1024]; os->bit_rate = s->streams[i]->codecpar->bit_rate; + if (!os->bit_rate) { + // check possible bitrates provided via metadata + AVDictionaryEntry *bitrate; + bitrate = av_dict_get(s->streams[i]->metadata, "bitrate", NULL, 0); + if (bitrate) { + char *tail; + os->bit_rate = av_strtod(bitrate->value, &tail); + if (*tail) + os->bit_rate = 0; + } + } if (os->bit_rate) { snprintf(os->bandwidth_str, sizeof(os->bandwidth_str), " bandwidth=\"%d\"", os->bit_rate); -- 2.10.2 _______________________________________________ libav-devel mailing list [email protected] https://lists.libav.org/mailman/listinfo/libav-devel
