Re: [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

2017-04-18 Thread Michael Niedermayer
On Fri, Sep 09, 2016 at 11:15:32AM +0300, Ligverd Haer wrote:
>  
> > missing commit mesage / not a proper git patch
> ...
> > 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
> > 
> > floats make the binary output code platform dependant, theres no
> > need to use floats here
> 
> Thanks for the positive comments Michael.
> 
> 0001-libavformat-dashenc.c-fix-validation-manifest.mpd.patch
> 1. If the MPD is dynamic the Period element shall have an id.
> 2. Attribute ‘bandwidth’ must appear on element ‘Representation’
> 3. Attribute 
> [profiles,width,height,sar,frameRate,audioSamplingRate,mimeType,segmentProfiles,codecs,maximumSAPPeriod,startWithSAP,maxPlayoutRate,codingDependency,scanType]
>Common attributes for AdaptationSet and Representation shall either be in 
> one of the elements but not in both.
> the tests were conducted on http://www-itec.uni-klu.ac.at/dash/?page_id=605
> 
> 0002-libavformat-dashenc.c-calculation-bandwidth-for-mani.patch
> When stream encoding is not counted bandwidth which makes it impossible to 
> properly switch to the desired stream.
> Use float I removed. Now the calculation accuracy decreased to kilobits.
> Is it possible to supply test division by 0 ?
> 
> 0003-libavformat-dashenc.c-change-moveflags-works-better.patch
> Replaced flags movflags. These flags input rtsp stream looked better.

Sorry for the late reply, i was hoping someone who knows dash well
would look at this and then i forgot

patch1 still applies cleanly
patches2 and 3 dont

patch1 removes the storage of the framerate this leaves several
unused variables.
Most likely the framerate should be stored differently instead of
not storing it anymore but
certainly no unused variables should remain

thx

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Those who would give up essential Liberty, to purchase a little
temporary Safety, deserve neither Liberty nor Safety -- Benjamin Franklin


signature.asc
Description: Digital signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [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

2016-09-09 Thread Ligverd Haer
 
> missing commit mesage / not a proper git patch
...
> 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
> 
> floats make the binary output code platform dependant, theres no
> need to use floats here

Thanks for the positive comments Michael.

0001-libavformat-dashenc.c-fix-validation-manifest.mpd.patch
1. If the MPD is dynamic the Period element shall have an id.
2. Attribute ‘bandwidth’ must appear on element ‘Representation’
3. Attribute 
[profiles,width,height,sar,frameRate,audioSamplingRate,mimeType,segmentProfiles,codecs,maximumSAPPeriod,startWithSAP,maxPlayoutRate,codingDependency,scanType]
   Common attributes for AdaptationSet and Representation shall either be in 
one of the elements but not in both.
the tests were conducted on http://www-itec.uni-klu.ac.at/dash/?page_id=605

0002-libavformat-dashenc.c-calculation-bandwidth-for-mani.patch
When stream encoding is not counted bandwidth which makes it impossible to 
properly switch to the desired stream.
Use float I removed. Now the calculation accuracy decreased to kilobits.
Is it possible to supply test division by 0 ?

0003-libavformat-dashenc.c-change-moveflags-works-better.patch
Replaced flags movflags. These flags input rtsp stream looked better.
>From 9ae9406222bdf21ae8ba28d7e21cb4ab709dfde0 Mon Sep 17 00:00:00 2001
From: ligverd 
Date: Fri, 9 Sep 2016 10:35:18 +0300
Subject: [PATCH 1/3] libavformat/dashenc.c fix validation manifest.mpd

---
 libavformat/dashenc.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c
index 519f9c4..779ea59 100644
--- a/libavformat/dashenc.c
+++ b/libavformat/dashenc.c
@@ -498,17 +498,15 @@ static int write_manifest(AVFormatContext *s, int final)
 OutputStream *os = >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\n");
 } else {
-avio_printf(out, "\t\n");
+avio_printf(out, "\t\n",final?"":" id=\"0\"");
 }
 
 if (c->has_video) {
 avio_printf(out, "\t\tmax_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++) {
@@ -603,6 +601,8 @@ static int dash_write_header(AVFormatContext *s)
 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.6.3

>From 5aaf033232dd473357a64475d663eba762422d10 Mon Sep 17 00:00:00 2001
From: ligverd 
Date: Fri, 9 Sep 2016 10:48:08 +0300
Subject: [PATCH 2/3] libavformat/dashenc.c calculation bandwidth for manifest

---
 libavformat/dashenc.c | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c
index 779ea59..d61aa90 100644
--- a/libavformat/dashenc.c
+++ b/libavformat/dashenc.c
@@ -596,7 +596,7 @@ 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);
@@ -858,6 +858,9 @@ static int dash_flush(AVFormatContext *s, int final, int stream)
 if (ret < 0)
 break;
 }
+os->bit_rate = ( (range_length * 8 * 10) / (os->max_pts - os->start_pts) ) / 1;
+snprintf(os->bandwidth_str, sizeof(os->bandwidth_str)," bandwidth=\"%i\"", os->bit_rate);
+
 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);
 }
-- 
2.6.3

>From 8dc233c503d954f344933b81d4ae1d6cef584675 Mon Sep 17 00:00:00 2001
From: ligverd 
Date: Fri, 9 Sep 2016 10:49:28 +0300
Subject: [PATCH 3/3] libavformat/dashenc.c change moveflags, works better

---
 

Re: [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

2016-09-08 Thread Michael Niedermayer
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 = >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 +avio_printf(out, "\t  write_time(out, start_time);
>  avio_printf(out, "\">\n");
>  } else {
> -avio_printf(out, "\t\n");
> +avio_printf(out, "\t\n",final?"":" 
> id=\"0\"");
>  }
>  
>  if (c->has_video) {
>  avio_printf(out, "\t\t 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(, "movflags", "frag_custom+dash+delay_moov", 0);
> +av_dict_set(, "movflags", 
> "dash+frag_keyframe+empty_moov+separate_moof+delay_moov", 0);
>  if ((ret = avformat_write_header(ctx, )) < 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) / 1) );
> +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@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


signature.asc
Description: Digital signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [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

2016-09-08 Thread Ligverd Haer
> 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

diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c
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 = >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\n");
 } else {
-avio_printf(out, "\t\n");
+avio_printf(out, "\t\n",final?"":" id=\"0\"");
 }
 
 if (c->has_video) {
 avio_printf(out, "\t\tmax_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(, "movflags", "frag_custom+dash+delay_moov", 0);
+av_dict_set(, "movflags", "dash+frag_keyframe+empty_moov+separate_moof+delay_moov", 0);
 if ((ret = avformat_write_header(ctx, )) < 0) {
  goto fail;
 }
@@ -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) / 1) );
+snprintf(os->bandwidth_str, sizeof(os->bandwidth_str)," bandwidth=\"%i\"", os->bit_rate);
+
 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@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [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

2016-09-08 Thread Carl Eugen Hoyos
2016-09-08 15:34 GMT+02:00 Ligverd Haer :
> В письме от четверг, 8 сентября 2016 г. 14:35:27 MSK пользователь Michael 
> Niedermayer написал:
>
>> patches should be sent to the mailing list, patches on trac tend to
>> be missed and forgotten
>
> Don't want to clog the ffmpeg-devel mailing list.

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
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [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

2016-09-08 Thread Ligverd Haer
В письме от четверг, 8 сентября 2016 г. 14:35:27 MSK пользователь Michael 
Niedermayer написал:
 
> patches should be sent to the mailing list, patches on trac tend to
> be missed and forgotten

Don't want to clog the ffmpeg-devel mailing list.
I made a pull request on github, I was sent to ffmpeg-devel mailing list, I 
sent a patch to the ffmpeg-devel mailing list, mene redirected to 
trac.ffmpeg.org

I agree the patch is not critical, and may be not worthy of attention.
In any case I tried. :(
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [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

2016-09-08 Thread Michael Niedermayer
On Thu, Sep 08, 2016 at 09:58:02AM +0300, Ligverd Haer wrote:
> > > Common attributes for AdaptationSet and Representation shall either be in
> > > one of the elements but not in both.
> > > 
> > > in particular, the attribute frameRate is duplicated in the node
> > > Representation
> > 
> > There is a bug report outstanding for this:
> > https://trac.ffmpeg.org/ticket/5087
> 
> Thank you Reuben, i posted in https://trac.ffmpeg.org/ticket/5087

patches should be sent to the mailing list, patches on trac tend to
be missed and forgotten

[...]
-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

No human being will ever know the Truth, for even if they happen to say it
by chance, they would not even known they had done so. -- Xenophanes


signature.asc
Description: Digital signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [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

2016-09-08 Thread Ligverd Haer
> > Common attributes for AdaptationSet and Representation shall either be in
> > one of the elements but not in both.
> > 
> > in particular, the attribute frameRate is duplicated in the node
> > Representation
> 
> There is a bug report outstanding for this:
> https://trac.ffmpeg.org/ticket/5087

Thank you Reuben, i posted in https://trac.ffmpeg.org/ticket/5087


___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [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

2016-09-07 Thread Reuben Martin
On Tuesday, September 6, 2016 1:56:57 PM CDT Ligverd Haer wrote:
> В письме от вторник, 6 сентября 2016 г. 12:26:49 MSK пользователь Carl Eugen
> 
> Attributes
> 
> profiles
> width
> height
> sar
> frameRate
> audioSamplingRate
> mimeType
> segmentProfiles
> codecs
> maximumSAPPeriod
> startWithSAP
> maxPlayoutRate
> codingDependency
> scanType
> 
> Common attributes for AdaptationSet and Representation shall either be in
> one of the elements but not in both.
> 
> in particular, the attribute frameRate is duplicated in the node
> Representation

There is a bug report outstanding for this:
https://trac.ffmpeg.org/ticket/5087

-Reuben

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [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

2016-09-06 Thread Carl Eugen Hoyos
2016-09-06 13:05 GMT+02:00 Ligverd Haer :
> В письме от вторник, 6 сентября 2016 г. 13:02:42 MSK пользователь Carl Eugen 
> Hoyos написал:
>> If this is the case, remove the offending line, do not
>> change the adjacent lines to make your intention easier
>> to understand.
>
> Well, if that's clearer

If you think it is not clearer, please ignore my suggestion!

Carl Eugen
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [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

2016-09-06 Thread Ligverd Haer
В письме от вторник, 6 сентября 2016 г. 13:02:42 MSK пользователь Carl Eugen 
Hoyos написал:
> If this is the case, remove the offending line, do not
> change the adjacent lines to make your intention easier
> to understand.

Well, if that's clearer

 if (c->has_video) {
avio_printf(out, "\t\tmax_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");

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [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

2016-09-06 Thread Carl Eugen Hoyos
2016-09-06 12:56 GMT+02:00 Ligverd Haer :
> in particular, the attribute frameRate is duplicated in the node
> Representation

If this is the case, remove the offending line, do not
change the adjacent lines to make your intention easier
to understand.

Please do not top-post here, Carl Eugen
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [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

2016-09-06 Thread Ligverd Haer
В письме от вторник, 6 сентября 2016 г. 12:26:49 MSK пользователь Carl Eugen

Attributes

profiles
width
height
sar
frameRate
audioSamplingRate
mimeType
segmentProfiles
codecs
maximumSAPPeriod
startWithSAP
maxPlayoutRate
codingDependency
scanType

Common attributes for AdaptationSet and Representation shall either be in one 
of the elements but not in both.

in particular, the attribute frameRate is duplicated in the node 
Representation

> > -avio_printf(out, "\t\t > 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");
> > +avio_printf(out, "\t\t > segmentAlignment=\"true\" bitstreamSwitching=\"true\">\n");
> 
> This hunk is not ok because it is needlessly difficult to understand
> what you are changing:
> Leave the first ("AdaptionSet") and last ("\n") line unchanged -
> unless I misread the patch.

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [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

2016-09-06 Thread Carl Eugen Hoyos
2016-09-05 12:47 GMT+02:00 Ligverd Haer :
> Create valide manifest.
> Calculate current bandwidth for eath chunk.
> Now works correctly with dash.sj

> -avio_printf(out, "\t\t 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");
> +avio_printf(out, "\t\t segmentAlignment=\"true\" bitstreamSwitching=\"true\">\n");

This hunk is not ok because it is needlessly difficult to understand
what you are changing:
Leave the first ("AdaptionSet") and last ("\n") line unchanged -
unless I misread the patch.

Carl Eugen
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[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

2016-09-05 Thread Ligverd Haer
Create valide manifest.
Calculate current bandwidth for eath chunk.
Now works correctly with dash.sj
diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c
index 519f9c4..06b4e60 100644
--- a/libavformat/dashenc.c
+++ b/libavformat/dashenc.c
@@ -498,18 +498,15 @@ static int write_manifest(AVFormatContext *s, int final)
 OutputStream *os = >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\n");
 } else {
-avio_printf(out, "\t\n");
+avio_printf(out, "\t\n",final?"":" id=\"0\"");
 }
 
 if (c->has_video) {
-avio_printf(out, "\t\tmax_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");
+avio_printf(out, "\t\t\n");
 
 for (i = 0; i < s->nb_streams; i++) {
 AVStream *st = s->streams[i];
@@ -598,11 +595,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);
@@ -858,6 +859,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) / 1) );
+snprintf(os->bandwidth_str, sizeof(os->bandwidth_str)," bandwidth=\"%i\"", os->bit_rate);
+
 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@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel