[FFmpeg-devel] [PATCH 1/2] dashenc: properly determine bandwidth
s-ol
sol.bekic at rise.tech
Thu Feb 9 18:05:46 EET 2017
based on ligverds patch from
https://ffmpeg.org/pipermail/ffmpeg-devel/2016-September/199183.html
---
libavformat/dashenc.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c
index 534fa75..18c39c5 100644
--- a/libavformat/dashenc.c
+++ b/libavformat/dashenc.c
@@ -498,17 +498,15 @@ static int write_manifest(AVFormatContext *s, int final)
OutputStream *os = &c->streams[0];
int start_index = FFMAX(os->nb_segments - c->window_size, 0);
int64_t start_time = av_rescale_q(os->segments[start_index]->time, s->streams[0]->time_base, AV_TIME_BASE_Q);
- avio_printf(out, "\t<Period start=\"");
+ avio_printf(out, "\t<Period%s start=\"",final?"":" id=\"0\"");
write_time(out, start_time);
avio_printf(out, "\">\n");
} else {
- avio_printf(out, "\t<Period start=\"PT0.0S\">\n");
+ avio_printf(out, "\t<Period%s start=\"PT0.0S\">\n",final?"":" id=\"0\"");
}
if (c->has_video) {
avio_printf(out, "\t\t<AdaptationSet contentType=\"video\" segmentAlignment=\"true\" bitstreamSwitching=\"true\"");
- if (c->max_frame_rate.num && !c->ambiguous_frame_rate)
- avio_printf(out, " %s=\"%d/%d\"", (av_cmp_q(c->min_frame_rate, c->max_frame_rate) < 0) ? "maxFrameRate" : "frameRate", c->max_frame_rate.num, c->max_frame_rate.den);
avio_printf(out, ">\n");
for (i = 0; i < s->nb_streams; i++) {
@@ -594,11 +592,13 @@ static int dash_init(AVFormatContext *s)
AVDictionary *opts = NULL;
char filename[1024];
- os->bit_rate = s->streams[i]->codecpar->bit_rate;
+ os->bit_rate = s->streams[i]->codecpar->bit_rate ? s->streams[i]->codecpar->bit_rate : s->bit_rate;
if (os->bit_rate) {
snprintf(os->bandwidth_str, sizeof(os->bandwidth_str),
" bandwidth=\"%d\"", os->bit_rate);
} else {
+ snprintf(os->bandwidth_str, sizeof(os->bandwidth_str),
+ " bandwidth=\"%d\"", 0);
int level = s->strict_std_compliance >= FF_COMPLIANCE_STRICT ?
AV_LOG_ERROR : AV_LOG_WARNING;
av_log(s, level, "No bit rate set for stream %d\n", i);
--
2.9.3 (Apple Git-75)
More information about the ffmpeg-devel
mailing list