[FFmpeg-devel] dash encoder. Correct generated manifest for MPEG-DASH MPD Validator and calculate current bandwidth for eath chunk. Now works correctly with dash.sj
Michael Niedermayer
michael at niedermayer.cc
Fri Sep 9 02:55:14 EEST 2016
On Thu, Sep 08, 2016 at 04:49:12PM +0300, Ligverd Haer wrote:
> > Please send your updated patch as attachment to a
> > reply in this mailing list thread,
> >
> > Please tell us if documentation pointed you to github or trac to
> > post patches, we try hard to have patch submission (only) on
> > this mailing list.
> >
> > Carl Eugen
>
> dashenc.c | 18 ++++++++++++------
> 1 file changed, 12 insertions(+), 6 deletions(-)
> 83ed4ba290c20a1467b1da80c326e0025de564fe dash_valid_dynamic.patch
> diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c
missing commit mesage / not a proper git patch
> index 519f9c4..ea96f71 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++) {
> @@ -598,11 +596,15 @@ static int dash_write_header(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);
> @@ -654,7 +656,7 @@ static int dash_write_header(AVFormatContext *s)
> goto fail;
> os->init_start_pos = 0;
>
> - av_dict_set(&opts, "movflags", "frag_custom+dash+delay_moov", 0);
> + av_dict_set(&opts, "movflags", "dash+frag_keyframe+empty_moov+separate_moof+delay_moov", 0);
> if ((ret = avformat_write_header(ctx, &opts)) < 0) {
> goto fail;
> }
this looks unrelated, unrelated changes need to be in separate patches
please explain in the commit messages of the patch(es) what each
patch does, why it does it and if you have at hand any reference to
specs feel free to include them
> @@ -858,6 +860,10 @@ static int dash_flush(AVFormatContext *s, int final, int stream)
> if (ret < 0)
> break;
> }
> +
> + os->bit_rate = (int)( (float)range_length*8 / ((float)(os->max_pts - os->start_pts) / 10000) );
> + snprintf(os->bandwidth_str, sizeof(os->bandwidth_str)," bandwidth=\"%i\"", os->bit_rate);
floats make the binary output code platform dependant, theres no
need to use floats here
> +
> add_segment(os, filename, os->start_pts, os->max_pts - os->start_pts, start_pos, range_length, index_length);
> av_log(s, AV_LOG_VERBOSE, "Representation %d media segment %d written to: %s\n", i, os->segment_index, full_path);
> }
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
The misfortune of the wise is better than the prosperity of the fool.
-- Epicurus
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20160909/be2edc8f/attachment.sig>
More information about the ffmpeg-devel
mailing list