Re: [FFmpeg-devel] [PATCH] dashenc: more accurate time values in playlist.mpd

2020-03-05 Thread Alfred E. Heggestad



On 05/03/2020 15:37, Carl Eugen Hoyos wrote:

Am Do., 5. März 2020 um 11:08 Uhr schrieb Alfred E. Heggestad
:


-int64_t update_period = c->last_duration / AV_TIME_BASE;
+double update_period = (double)c->last_duration / AV_TIME_BASE;


Can't you instead do int64 update_period = last_duration * 1000 / AV_TIME_BASE
to avoid using doubles that will potentially break automatic testing?



in this case the update_period will be in [milliseconds] units.
how should I print that ?


or we can use write_time() to print it, in AV_TIME_BASE units:


int64_t update_period = c->last_duration;

avio_printf(out, "\tminimumUpdatePeriod=\"");
write_time(out, update_period);
avio_printf(out, "\"\n");





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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH] dashenc: more accurate time values in playlist.mpd

2020-03-05 Thread Alfred E. Heggestad

On 05/03/2020 11:40, Moritz Barsnick wrote:

On Thu, Mar 05, 2020 at 11:01:19 +0100, Alfred E. Heggestad wrote:

-avio_printf(out,
"\tsuggestedPresentationDelay=\"PT%"PRId64"S\"\n", c->last_duration /
AV_TIME_BASE);
+avio_printf(out,
"\tsuggestedPresentationDelay=\"PT%.3fS\"\n", (double)c->last_duration /
AV_TIME_BASE);


Your patch is corrupted by newlines, which makes it impossible to apply
it easily (or even automatically). Please resend it as an attachment,
or using "git send-email".



thanks,

here is the patch attached.



/alfred

From c569a1d970d27e814f54dbacf5dac7a337efb0d6 Mon Sep 17 00:00:00 2001
From: "Alfred E. Heggestad" 
Date: Thu, 5 Mar 2020 10:52:29 +0100
Subject: [PATCH] dashenc: more accurate time values in playlist.mpd

use 3 decimals for the following items:

- minBufferTime
- minimumUpdatePeriod
- timeShiftBufferDepth
- suggestedPresentationDelay

This improves buffering with shaka player

Signed-off-by: Alfred E. Heggestad 
---
 libavformat/dashenc.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c
index 94d463972a..37fbbbc1d2 100644
--- a/libavformat/dashenc.c
+++ b/libavformat/dashenc.c
@@ -774,7 +774,7 @@ static void write_time(AVIOContext *out, int64_t time)
 avio_printf(out, "%dH", hours);
 if (hours || minutes)
 avio_printf(out, "%dM", minutes);
-avio_printf(out, "%d.%dS", seconds, fractions / (AV_TIME_BASE / 10));
+avio_printf(out, "%d.%03dS", seconds, (fractions * 1000) / AV_TIME_BASE);
 }
 
 static void format_date(char *buf, int size, int64_t time_us)
@@ -1171,13 +1171,13 @@ static int write_manifest(AVFormatContext *s, int final)
 write_time(out, c->total_duration);
 avio_printf(out, "\"\n");
 } else {
-int64_t update_period = c->last_duration / AV_TIME_BASE;
+double update_period = (double)c->last_duration / AV_TIME_BASE;
 char now_str[100];
 if (c->use_template && !c->use_timeline)
 update_period = 500;
-avio_printf(out, "\tminimumUpdatePeriod=\"PT%"PRId64"S\"\n", 
update_period);
+avio_printf(out, "\tminimumUpdatePeriod=\"PT%.3fS\"\n", update_period);
 if (!c->ldash)
-avio_printf(out, 
"\tsuggestedPresentationDelay=\"PT%"PRId64"S\"\n", c->last_duration / 
AV_TIME_BASE);
+avio_printf(out, "\tsuggestedPresentationDelay=\"PT%.3fS\"\n", 
(double)c->last_duration / AV_TIME_BASE);
 if (c->availability_start_time[0])
 avio_printf(out, "\tavailabilityStartTime=\"%s\"\n", 
c->availability_start_time);
 format_date(now_str, sizeof(now_str), av_gettime());
-- 
2.20.1 (Apple Git-117)

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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-devel] [PATCH] dashenc: more accurate time values in playlist.mpd

2020-03-05 Thread Alfred E. Heggestad

use 3 decimals for the following items:

- minBufferTime
- minimumUpdatePeriod
- timeShiftBufferDepth
- suggestedPresentationDelay

This improves buffering with shaka player

Signed-off-by: Alfred E. Heggestad 
---
 libavformat/dashenc.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c
index 94d463972a..37fbbbc1d2 100644
--- a/libavformat/dashenc.c
+++ b/libavformat/dashenc.c
@@ -774,7 +774,7 @@ static void write_time(AVIOContext *out, int64_t time)
 avio_printf(out, "%dH", hours);
 if (hours || minutes)
 avio_printf(out, "%dM", minutes);
-avio_printf(out, "%d.%dS", seconds, fractions / (AV_TIME_BASE / 10));
+avio_printf(out, "%d.%03dS", seconds, (fractions * 1000) / 
AV_TIME_BASE);

 }

 static void format_date(char *buf, int size, int64_t time_us)
@@ -1171,13 +1171,13 @@ static int write_manifest(AVFormatContext *s, 
int final)

 write_time(out, c->total_duration);
 avio_printf(out, "\"\n");
 } else {
-int64_t update_period = c->last_duration / AV_TIME_BASE;
+double update_period = (double)c->last_duration / AV_TIME_BASE;
 char now_str[100];
 if (c->use_template && !c->use_timeline)
 update_period = 500;
-avio_printf(out, "\tminimumUpdatePeriod=\"PT%"PRId64"S\"\n", 
update_period);
+avio_printf(out, "\tminimumUpdatePeriod=\"PT%.3fS\"\n", 
update_period);

 if (!c->ldash)
-avio_printf(out, 
"\tsuggestedPresentationDelay=\"PT%"PRId64"S\"\n", c->last_duration / 
AV_TIME_BASE);
+avio_printf(out, 
"\tsuggestedPresentationDelay=\"PT%.3fS\"\n", (double)c->last_duration / 
AV_TIME_BASE);

 if (c->availability_start_time[0])
 avio_printf(out, "\tavailabilityStartTime=\"%s\"\n", 
c->availability_start_time);

 format_date(now_str, sizeof(now_str), av_gettime());
--
2.20.1 (Apple Git-117)

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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH] dashenc: check pts to prevent division by zero error

2020-01-31 Thread Alfred E. Heggestad



On 31/01/2020 14:17, James Almer wrote:

On 1/31/2020 10:08 AM, Jeyapal, Karthick wrote:


On 1/30/20 3:28 PM, Alfred E. Heggestad wrote:

this usecase will cause a division by zero trap:

1. dashenc has received one frame
2. os->max_pts and os->start_pts have same value
3. delta between max_pts and start_pts is 0
4. av_rescale_q(0, x, y) returns 0
5. this value is used as denominator in division
6. Bang! -> segfault

this fix checks that max_pts > start_pts.
the fix has been tested and works.

please review and suggest better fixes.

Signed-off-by: Alfred E. Heggestad 
---
   libavformat/dashenc.c | 2 +-
   1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c
index f555f208a7..3b651b9514 100644
--- a/libavformat/dashenc.c
+++ b/libavformat/dashenc.c
@@ -1883,7 +1883,7 @@ static int dash_flush(AVFormatContext *s, int
final, int stream)
  
st->time_base,
  
AV_TIME_BASE_Q));


-if (!os->muxer_overhead)
+if (!os->muxer_overhead && os->max_pts > os->start_pts)
   os->muxer_overhead = ((int64_t) (range_length -
os->total_pkt_size) *
 8 * AV_TIME_BASE) /
av_rescale_q(os->max_pts - os->start_pts,

LGTM.

This actually exposes a corner case bug in overhead calculation logic.
Guess we will need to come up with a better logic for it.
Until then, this fix will atleast make sure things don’t crash.

Thanks,
Karthick


Applied.


Great!

Thanks Jeyapal and James.



/alfred

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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-devel] [PATCH] dashenc: check pts to prevent division by zero error

2020-01-30 Thread Alfred E. Heggestad

this usecase will cause a division by zero trap:

1. dashenc has received one frame
2. os->max_pts and os->start_pts have same value
3. delta between max_pts and start_pts is 0
4. av_rescale_q(0, x, y) returns 0
5. this value is used as denominator in division
6. Bang! -> segfault

this fix checks that max_pts > start_pts.
the fix has been tested and works.

please review and suggest better fixes.

Signed-off-by: Alfred E. Heggestad 
---
 libavformat/dashenc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c
index f555f208a7..3b651b9514 100644
--- a/libavformat/dashenc.c
+++ b/libavformat/dashenc.c
@@ -1883,7 +1883,7 @@ static int dash_flush(AVFormatContext *s, int 
final, int stream)


st->time_base,

AV_TIME_BASE_Q));

-if (!os->muxer_overhead)
+if (!os->muxer_overhead && os->max_pts > os->start_pts)
 os->muxer_overhead = ((int64_t) (range_length - 
os->total_pkt_size) *

   8 * AV_TIME_BASE) /
  av_rescale_q(os->max_pts - os->start_pts,
--
2.20.1 (Apple Git-117)

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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-devel] [PATCH] sdl2: map AV_PIX_FMT_NONE to SDL_PIXELFORMAT_UNKNOWN

2019-10-30 Thread Alfred E. Heggestad

---
From 6331f77ca00acdaaee0db6b0d2d04fff9f1c70c9 Mon Sep 17 00:00:00 2001
From: "Alfred E. Heggestad" 
Date: Wed, 30 Oct 2019 12:30:49 +0100
Subject: [PATCH] sdl2: map AV_PIX_FMT_NONE to SDL_PIXELFORMAT_UNKNOWN

This does not change the programs behaviour.
The purpose of this patch is to make the code more
robust against future changes, in case someone
starts using the AV_PIX_FMT_NONE entry.

Signed-off-by: Alfred E. Heggestad 
---
 libavdevice/sdl2.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavdevice/sdl2.c b/libavdevice/sdl2.c
index d6fc74a66c..4eafde10de 100644
--- a/libavdevice/sdl2.c
+++ b/libavdevice/sdl2.c
@@ -91,7 +91,7 @@ static const struct sdl_texture_format_entry {
 { AV_PIX_FMT_YUV420P, SDL_PIXELFORMAT_IYUV },
 { AV_PIX_FMT_YUYV422, SDL_PIXELFORMAT_YUY2 },
 { AV_PIX_FMT_UYVY422, SDL_PIXELFORMAT_UYVY },
-{ AV_PIX_FMT_NONE,0},
+{ AV_PIX_FMT_NONE,SDL_PIXELFORMAT_UNKNOWN },
 };
 
 static void compute_texture_rect(AVFormatContext *s)
-- 
2.20.1 (Apple Git-117)

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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH] doc: fix typo in muxers documentation

2019-10-30 Thread Alfred E. Heggestad

On 30/10/2019 10:55, Paul B Mahol wrote:

Can not be applied, patch is corrupted.



sorry about that, patch is attached.



/alfred
From 417b3a38d25fbc3aca1f8e7d0d65de7efea55777 Mon Sep 17 00:00:00 2001
From: "Alfred E. Heggestad" 
Date: Wed, 30 Oct 2019 10:48:44 +0100
Subject: [PATCH] doc: fix typo in muxers documentation

---
 doc/muxers.texi | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/doc/muxers.texi b/doc/muxers.texi
index 4c88b5daec..09ded7d48a 100644
--- a/doc/muxers.texi
+++ b/doc/muxers.texi
@@ -2084,7 +2084,7 @@ but supports several other algorithms.
 The output of the muxer consists of one line per stream of the form:
 @var{streamindex},@var{streamtype},@var{algo}=@var{hash}, where
 @var{streamindex} is the index of the mapped stream, @var{streamtype} is a
-single characer indicating the type of stream, @var{algo} is a short string
+single character indicating the type of stream, @var{algo} is a short string
 representing the hash function used, and @var{hash} is a hexadecimal number
 representing the computed hash.
 
-- 
2.20.1 (Apple Git-117)

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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-devel] [PATCH] doc: fix typo in muxers documentation

2019-10-30 Thread Alfred E. Heggestad

Signed-off-by: Alfred E. Heggestad 
---
 doc/muxers.texi | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/doc/muxers.texi b/doc/muxers.texi
index 4c88b5daec..09ded7d48a 100644
--- a/doc/muxers.texi
+++ b/doc/muxers.texi
@@ -2084,7 +2084,7 @@ but supports several other algorithms.
 The output of the muxer consists of one line per stream of the form:
 @var{streamindex},@var{streamtype},@var{algo}=@var{hash}, where
 @var{streamindex} is the index of the mapped stream, @var{streamtype} is a
-single characer indicating the type of stream, @var{algo} is a short string
+single character indicating the type of stream, @var{algo} is a short 
string
 representing the hash function used, and @var{hash} is a hexadecimal 
number

 representing the computed hash.

--
2.20.1 (Apple Git-117)

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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH] examples: set GOP size to 10 seconds

2019-10-29 Thread Alfred E. Heggestad

On 29/10/2019 10:34, Steven Liu wrote:




在 2019年10月29日,17:25,Alfred E. Heggestad  写道:

using a gop_size of 10 in the example code is very misleading.
in practice this means around 2 keyframes per second.

a normal video encoder should not send keyframes so frequent,
a better interval is 10 seconds.


10 seconds is too long. i think 10 frames maybe ok for a sample.
but usually set to 2s one GOP here, for publish stream to rtmp server.
This is just a sample, so i think 10 second is too long.


Hi Steven,

I think we should make it clear in the code that the GOP size
depends on the framerate. Keep in mind that many people just copy
the example code to use in their applications, and does not
necessarily try to understand all the small details.


I am sure we can agree on a nice value for the keyframe interval,
but my point is that the value should be in seconds and not frames.

For example 5 seconds:


  c->gop_size = 5 * FPS;




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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-devel] [PATCH] examples: set GOP size to 10 seconds

2019-10-29 Thread Alfred E. Heggestad

using a gop_size of 10 in the example code is very misleading.
in practice this means around 2 keyframes per second.

a normal video encoder should not send keyframes so frequent,
a better interval is 10 seconds.

Signed-off-by: Alfred E. Heggestad 
---
 doc/examples/encode_video.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/doc/examples/encode_video.c b/doc/examples/encode_video.c
index d9ab409908..8c5ee9818e 100644
--- a/doc/examples/encode_video.c
+++ b/doc/examples/encode_video.c
@@ -110,13 +110,13 @@ int main(int argc, char **argv)
 c->time_base = (AVRational){1, 25};
 c->framerate = (AVRational){25, 1};

-/* emit one intra frame every ten frames
+/* emit one intra frame every ten seconds
  * check frame pict_type before passing frame
  * to encoder, if frame->pict_type is AV_PICTURE_TYPE_I
  * then gop_size is ignored and the output of encoder
  * will always be I frame irrespective to gop_size
  */
-c->gop_size = 10;
+c->gop_size = 10 * 25;
 c->max_b_frames = 1;
 c->pix_fmt = AV_PIX_FMT_YUV420P;

--
2.20.1 (Apple Git-117)

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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH] movenc: fix warning if CONFIG_AC3_PARSER not defined

2019-07-04 Thread Alfred E. Heggestad

On 03/07/2019 21:28, Michael Niedermayer wrote:

On Tue, Jul 02, 2019 at 02:19:37PM +0200, Alfred E. Heggestad wrote:

this patch fixes a compiler warning if CONFIG_AC3_PARSER is
not defined. The label 'end' is removed and all the code
use the label 'err' instead.


What compiler warning (this should be in the commit message)

"goto err" in the case where its not an error would require a comment



hi,

here is the compiler warning:


CC  libavformat/movenc.o
libavformat/movenc.c:5536:1: warning: unused label 'end' [-Wunused-label]
end:
^~~~
1 warning generated.



compiler is clang 10.0.1 on OSX 10.14




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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-devel] movenc track_duration

2019-07-03 Thread Alfred E. Heggestad

Hi,

here is my attempt to fix this bug:

  https://trac.ffmpeg.org/ticket/7966




I am wondering if track_duration should include
the last duration or not.


I tried to include duration in the calculation
of track_duration here:


diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index 46d314ff17..6cd209266d 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -5612,7 +5612,7 @@ static int mov_write_single_packet(AVFormatContext 
*s, AVPacket *pkt)

 // sample in this track. This avoids relying on AVPacket
 // duration, but only helps for this particular track, not
 // for the other ones that are flushed at the same time.
-trk->track_duration = pkt->dts - trk->start_dts;
+trk->track_duration = pkt->dts - trk->start_dts + 
pkt->duration;

 if (pkt->pts != AV_NOPTS_VALUE)
 trk->end_pts = pkt->pts;
 else


... but this adds a warning in the testprogram:
(same warning as the ticket)


./libavformat/tests/movenc
[mp4 @ 0x7f8ae0801200] track 1: codec frame size is not set
write_data len 36, time nopts, type header atom ftyp
write_data len 2397, time nopts, type header atom -
[mp4 @ 0x7f8ae0801200] Application provided duration: -512 / timestamp: 
15360 is out of range for mov/mp4 format

[mp4 @ 0x7f8ae0801200] pts has no value
write_data len 908, time 103, type sync atom moof
write_data len 110, time nopts, type trailer atom -
45218facb761a83f686e2363d4f971f4 3451 non-empty-moov
[mp4 @ 0x7f8ae0801200] track 1: codec frame size is not set
write_data len 36, time nopts, type header atom ftyp
write_data len 2729, time nopts, type header atom -
[mp4 @ 0x7f8ae0801200] Application provided duration: -512 / timestamp: 
14848 is out of range for mov/mp4 format

[mp4 @ 0x7f8ae0801200] pts has no value
write_data len 1028, time 100, type sync atom moof
write_data len 110, time nopts, type trailer atom -
cf7b45d08c99438d0d55dd2ec28f0fe5 3903 non-empty-moov-elst
[mp4 @ 0x7f8ae0801200] track 1: codec frame size is not set
write_data len 36, time nopts, type header atom ftyp
write_data len 2637, time nopts, type header atom -
[mp4 @ 0x7f8ae0801200] Application provided duration: -512 / timestamp: 
15360 is out of range for mov/mp4 format

[mp4 @ 0x7f8ae0801200] pts has no value
write_data len 1028, time 103, type sync atom moof
write_data len 110, time nopts, type trailer atom -
fea7eec4e4d6f0f72a38fe6ea49fac9a 3811 non-empty-moov-no-elst


so the bug can be easily provoked with this change.


in my humble opinion the check is too strict.




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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-devel] [PATCH] movenc: fix warning if CONFIG_AC3_PARSER not defined

2019-07-02 Thread Alfred E. Heggestad

this patch fixes a compiler warning if CONFIG_AC3_PARSER is
not defined. The label 'end' is removed and all the code
use the label 'err' instead.
---
 libavformat/movenc.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index 46d314ff17..f1a226313e 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -5379,7 +5379,7 @@ int ff_mov_write_packet(AVFormatContext *s, 
AVPacket *pkt)

 if (size < 0)
 return size;
 else if (!size)
-goto end;
+goto err;
 avio_write(pb, pkt->data, size);
 #endif
 } else {
@@ -5533,7 +5533,6 @@ int ff_mov_write_packet(AVFormatContext *s, 
AVPacket *pkt)

 ff_mov_add_hinted_packet(s, pkt, trk->hint_track, trk->entry,
  reformatted_data, size);

-end:
 err:

 av_free(reformatted_data);
--
2.20.1 (Apple Git-117)

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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH] dash: change default MP4 extension to .m4s

2019-06-25 Thread Alfred E. Heggestad



On 25/06/2019 11:43, Jeyapal, Karthick wrote:


On 6/24/19 4:23 PM, Alfred E. Heggestad wrote:






Hi Karthick,


here is the rebased patch as an attachment.


please review and apply if it looks okay.


Thanks. I have applied it.



Thanks for applying it :)


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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH] dash: change default MP4 extension to .m4s

2019-06-24 Thread Alfred E. Heggestad

On 24/06/2019 11:24, Jeyapal, Karthick wrote:


On 6/20/19 3:00 PM, Alfred E. Heggestad wrote:



On 20/06/2019 05:19, Jeyapal, Karthick wrote:


On 6/19/19 3:08 PM, Alfred E. Heggestad wrote:

On 19/06/2019 07:21, Jeyapal, Karthick wrote:


On 6/18/19 1:48 PM, Alfred E. Heggestad wrote:

On 18/06/2019 04:02, Steven Liu wrote:

Alfred E. Heggestad  于2019年6月17日周一 下午4:02写道:


 From 923da82598bddd1ed05750427dbc71e607d296a2 Mon Sep 17 00:00:00 2001
From: "Alfred E. Heggestad" 
Date: Mon, 17 Jun 2019 09:59:04 +0200
Subject: [PATCH] dash: change default MP4 extension to .m4s

this was changed in commit 281a21ed50849e3c8c0d03005230e9fd07c24370
---
  libavformat/dashenc.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c
index 3fd7e78166..a51a1da0ca 100644
--- a/libavformat/dashenc.c
+++ b/libavformat/dashenc.c
@@ -166,7 +166,7 @@ static struct format_string {
  const char *str;
  } formats[] = {
  { SEGMENT_TYPE_AUTO, "auto" },
-{ SEGMENT_TYPE_MP4, "mp4" },
+{ SEGMENT_TYPE_MP4, "m4s" },
  { SEGMENT_TYPE_WEBM, "webm" },
  { 0, NULL }
  };
--
2.20.1 (Apple Git-117)

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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".




LGTM



the background for this is the extension for DASH media files
used to be *.m4s and it is now *.mp4


the patch is a suggestion and should be checked by the DASH experts

what is correct according to the standard ?

the media-file is not really an .mp4 file, it cannot be
played with e.g. ffplay:

 $ ffplay chunk-stream1-1.m4s

Thanks for submitting the patch. I agree that m4s should be extension for media 
segments.
mp4 should be used only for complete files.
With respect to the patch, dashenc generates either multiple segments or a single 
file(with byte range as segments) based on "single_file" option.
The default of mp4 is correct when "single_file" is enabled. But it is wrong when 
"single_file" is disabled. The proposed patch just reverses this situation.
I would suggest the patch should handle both cases correctly.


Hi,

many thanks for your review comments.

I have updated the patch based on your comments, please see below.


this code works in my application (both single and multi files)
but the code should be reviewed by someone who has better
knowledge with the code.

Thanks for sending a revised patch promptly.
I think your patch below might adversely affect the following code
  avio_printf(out, "\t\t\tformat_name, os->codec_str, bandwidth_str, 
s->streams[i]->codecpar->width, s->streams[i]->codecpar->height);

mimetype will become "video/m4s" for if the file extension is m4s. But I am not 
sure if it is correct or if such a mimetype exists.
I guess mimetype should remain as "video/mp4" even if the file extension is m4s.
Please let me know your views on this.



I tested with ffmpeg 4.1.3 and the mimetype is video/mp4






I made a new patch which is a bit more readable. Please see here:



 From c90254066e08a8dc46f275fbc2a1d65f26608bd4 Mon Sep 17 00:00:00 2001
From: "Alfred E. Heggestad" 
Date: Thu, 20 Jun 2019 11:27:53 +0200
Subject: [PATCH] dash: split extension for MP4 into .mp4 or .m4s

---
  libavformat/dashenc.c | 23 ---
  1 file changed, 20 insertions(+), 3 deletions(-)

diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c
index 3fd7e78166..b25afb40aa 100644
--- a/libavformat/dashenc.c
+++ b/libavformat/dashenc.c
@@ -89,6 +89,7 @@ typedef struct OutputStream {
  int bit_rate;
  SegmentType segment_type;  /* segment type selected for this particular 
stream */
  const char *format_name;
+const char *extension_name;
  const char *single_file_name;  /* file names selected for this particular 
stream */
  const char *init_seg_name;
  const char *media_seg_name;
@@ -217,6 +218,16 @@ static const char *get_format_str(SegmentType 
segment_type) {
  return NULL;
  }

+static const char *get_extension_str(SegmentType type, int single_file)
+{
+switch (type) {
+
+case SEGMENT_TYPE_MP4:  return single_file ? "mp4" : "m4s";
+case SEGMENT_TYPE_WEBM: return "webm";
+default: return NULL;
+}
+}
+
  static int handle_io_open_error(AVFormatContext *s, int err, char *url) {
  DASHContext *c = s->priv_data;
  char errbuf[AV_ERROR_MAX_STRING_SIZE];
@@ -254,6 +265,12 @@ static int init_segment_types(AVFormatContext *s)
  av_log(s, AV_LOG_ERROR, "Could not select DASH segment type for stream 
%d\n", i);
  return AVERROR_MUXER_NOT_FOUND;
  }
+

Re: [FFmpeg-devel] [PATCH] movenc: calculate track_duration without packet duration

2019-06-20 Thread Alfred E. Heggestad



On 19/06/2019 15:36, Derek Buitenhuis wrote:

On 19/06/2019 06:43, Gyan wrote:

setting track_duration is inconsistent; some times it includes
duration and some times not.

It may be best to check the commits for these assignments to see if the
inconsistency is deliberate.
The track duration is written into the media header box for the track. I
also see it being used elsewhere to adjust dts. Do those roles remain
intact?

Does FATE pass?


Wouldn't the correct fix be to fix the places where duration is *not*
used?

Writing the track duration without taking into account the actual
packet duration of the last packet is just wrong. That's not the
track's duration, and is in fact very problematic for low frame
rate files, such a slide shows; QuickTime will cut off at the
end of the media and track duration, dropping possibly a whole
slide, for example.



I tested with this relatively innocent patch:


diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index 46d314ff17..719c491869 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -5012,7 +5012,7 @@ static int mov_flush_fragment(AVFormatContext *s, int 
force)
 if (!ff_interleaved_peek(s, i, &pkt, 1)) {
 if (track->dts_shift != AV_NOPTS_VALUE)
 pkt.dts += track->dts_shift;
-track->track_duration = pkt.dts - track->start_dts;
+track->track_duration = pkt.dts - track->start_dts + 
pkt.duration;
 if (pkt.pts != AV_NOPTS_VALUE)
 track->end_pts = pkt.pts;
 else



but this broke the FATE test for movenc:




make fate-movenc SAMPLES=fate-suite/
LD  libavformat/tests/movenc
TESTmovenc
--- ./tests/ref/fate/movenc 2019-03-24 10:21:55.0 +0100
+++ tests/data/fate/movenc  2019-06-20 14:27:27.0 +0200
@@ -134,12 +134,12 @@
 3c2c3f98c8a047f0ecefff07570fd457 9299 large_frag
 write_data len 1231, time nopts, type header atom ftyp
 write_data len 684, time -3, type sync atom moof
-write_data len 504, time 80, type boundary atom moof
-write_data len 420, time 127, type boundary atom moof
-write_data len 668, time 157, type sync atom moof
-write_data len 440, time 223, type boundary atom moof
+write_data len 504, time 83, type boundary atom moof
+write_data len 512, time 130, type boundary atom moof
+write_data len 792, time 157, type sync atom moof
+write_data len 488, time 223, type boundary atom moof
 write_data len 262, time nopts, type trailer atom -
-edd19deae2b70afcf2cd744b89b7013d 4209 vfr-noduration-interleave
+f579e7fec9c37179ed2def2f8930a093 4473 vfr-noduration-interleave
 write_data len 1231, time nopts, type header atom ftyp
 write_data len 916, time 0, type sync atom moof
 write_data len 908, time 100, type sync atom moof
Test movenc failed. Look at tests/data/fate/movenc.err for details.
make: *** [fate-movenc] Error 1




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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH] dash: change default MP4 extension to .m4s

2019-06-20 Thread Alfred E. Heggestad



On 20/06/2019 05:19, Jeyapal, Karthick wrote:


On 6/19/19 3:08 PM, Alfred E. Heggestad wrote:

On 19/06/2019 07:21, Jeyapal, Karthick wrote:


On 6/18/19 1:48 PM, Alfred E. Heggestad wrote:

On 18/06/2019 04:02, Steven Liu wrote:

Alfred E. Heggestad  于2019年6月17日周一 下午4:02写道:


From 923da82598bddd1ed05750427dbc71e607d296a2 Mon Sep 17 00:00:00 2001
From: "Alfred E. Heggestad" 
Date: Mon, 17 Jun 2019 09:59:04 +0200
Subject: [PATCH] dash: change default MP4 extension to .m4s

this was changed in commit 281a21ed50849e3c8c0d03005230e9fd07c24370
---
 libavformat/dashenc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c
index 3fd7e78166..a51a1da0ca 100644
--- a/libavformat/dashenc.c
+++ b/libavformat/dashenc.c
@@ -166,7 +166,7 @@ static struct format_string {
 const char *str;
 } formats[] = {
 { SEGMENT_TYPE_AUTO, "auto" },
-{ SEGMENT_TYPE_MP4, "mp4" },
+{ SEGMENT_TYPE_MP4, "m4s" },
 { SEGMENT_TYPE_WEBM, "webm" },
 { 0, NULL }
 };
--
2.20.1 (Apple Git-117)

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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".




LGTM



the background for this is the extension for DASH media files
used to be *.m4s and it is now *.mp4


the patch is a suggestion and should be checked by the DASH experts

what is correct according to the standard ?

the media-file is not really an .mp4 file, it cannot be
played with e.g. ffplay:

$ ffplay chunk-stream1-1.m4s

Thanks for submitting the patch. I agree that m4s should be extension for media 
segments.
mp4 should be used only for complete files.
With respect to the patch, dashenc generates either multiple segments or a single 
file(with byte range as segments) based on "single_file" option.
The default of mp4 is correct when "single_file" is enabled. But it is wrong when 
"single_file" is disabled. The proposed patch just reverses this situation.
I would suggest the patch should handle both cases correctly.


Hi,

many thanks for your review comments.

I have updated the patch based on your comments, please see below.


this code works in my application (both single and multi files)
but the code should be reviewed by someone who has better
knowledge with the code.

Thanks for sending a revised patch promptly.
I think your patch below might adversely affect the following code
 avio_printf(out, "\t\t\tformat_name, os->codec_str, bandwidth_str, 
s->streams[i]->codecpar->width, s->streams[i]->codecpar->height);

mimetype will become "video/m4s" for if the file extension is m4s. But I am not 
sure if it is correct or if such a mimetype exists.
I guess mimetype should remain as "video/mp4" even if the file extension is m4s.
Please let me know your views on this.



I tested with ffmpeg 4.1.3 and the mimetype is video/mp4






I made a new patch which is a bit more readable. Please see here:



From c90254066e08a8dc46f275fbc2a1d65f26608bd4 Mon Sep 17 00:00:00 2001
From: "Alfred E. Heggestad" 
Date: Thu, 20 Jun 2019 11:27:53 +0200
Subject: [PATCH] dash: split extension for MP4 into .mp4 or .m4s

---
 libavformat/dashenc.c | 23 ---
 1 file changed, 20 insertions(+), 3 deletions(-)

diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c
index 3fd7e78166..b25afb40aa 100644
--- a/libavformat/dashenc.c
+++ b/libavformat/dashenc.c
@@ -89,6 +89,7 @@ typedef struct OutputStream {
 int bit_rate;
 SegmentType segment_type;  /* segment type selected for this particular 
stream */
 const char *format_name;
+const char *extension_name;
 const char *single_file_name;  /* file names selected for this particular 
stream */
 const char *init_seg_name;
 const char *media_seg_name;
@@ -217,6 +218,16 @@ static const char *get_format_str(SegmentType 
segment_type) {
 return NULL;
 }

+static const char *get_extension_str(SegmentType type, int single_file)
+{
+switch (type) {
+
+case SEGMENT_TYPE_MP4:  return single_file ? "mp4" : "m4s";
+case SEGMENT_TYPE_WEBM: return "webm";
+default: return NULL;
+}
+}
+
 static int handle_io_open_error(AVFormatContext *s, int err, char *url) {
 DASHContext *c = s->priv_data;
 char errbuf[AV_ERROR_MAX_STRING_SIZE];
@@ -254,6 +265,12 @@ static int init_segment_types(AVFormatContext *s)
 av_log(s, AV_LOG_ERROR, "Could not select DASH segment type for stream 
%d\n", i);
 return AVERROR_MUXER_NOT_FOUND;
 }
+os->extension_name = get_extension_str(segment_type, c->single_file);
+if (!os->extension_name) {
+ 

Re: [FFmpeg-devel] [PATCH] movenc: calculate track_duration without packet duration

2019-06-19 Thread Alfred E. Heggestad

On 19/06/2019 15:36, Derek Buitenhuis wrote:

On 19/06/2019 06:43, Gyan wrote:

setting track_duration is inconsistent; some times it includes
duration and some times not.

It may be best to check the commits for these assignments to see if the
inconsistency is deliberate.
The track duration is written into the media header box for the track. I
also see it being used elsewhere to adjust dts. Do those roles remain
intact?

Does FATE pass?


Wouldn't the correct fix be to fix the places where duration is *not*
used?

Writing the track duration without taking into account the actual
packet duration of the last packet is just wrong. That's not the
track's duration, and is in fact very problematic for low frame
rate files, such a slide shows; QuickTime will cut off at the
end of the media and track duration, dropping possibly a whole
slide, for example.



Hi,

thanks for your comments. I agree that track_duration should
include duration, I will take a look at this tomorrow.


but why do you require that dts > prev_dts + prev_dur when dur
is unknown ? I think this check is too strict. a better check
would be:


   dts > prev_dts


a very simple example of how to demonstrate this:

$ ffmpeg -y -loglevel info \
-listen 1 -i rtmp://127.0.0.1:1935/live \
-f dash out.mpd

and then use ffmpeg to send FLV/RTMP stream to 127.0.0.1

after some seconds ffmpeg prints this warning:

[mp4 @ 0x7faffe065600] Application provided duration: -2 / timestamp: 
1761244 is out of range for mov/mp4 format





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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH] dash: change default MP4 extension to .m4s

2019-06-19 Thread Alfred E. Heggestad

On 19/06/2019 07:21, Jeyapal, Karthick wrote:


On 6/18/19 1:48 PM, Alfred E. Heggestad wrote:

On 18/06/2019 04:02, Steven Liu wrote:

Alfred E. Heggestad  于2019年6月17日周一 下午4:02写道:


   From 923da82598bddd1ed05750427dbc71e607d296a2 Mon Sep 17 00:00:00 2001
From: "Alfred E. Heggestad" 
Date: Mon, 17 Jun 2019 09:59:04 +0200
Subject: [PATCH] dash: change default MP4 extension to .m4s

this was changed in commit 281a21ed50849e3c8c0d03005230e9fd07c24370
---
libavformat/dashenc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c
index 3fd7e78166..a51a1da0ca 100644
--- a/libavformat/dashenc.c
+++ b/libavformat/dashenc.c
@@ -166,7 +166,7 @@ static struct format_string {
const char *str;
} formats[] = {
{ SEGMENT_TYPE_AUTO, "auto" },
-{ SEGMENT_TYPE_MP4, "mp4" },
+{ SEGMENT_TYPE_MP4, "m4s" },
{ SEGMENT_TYPE_WEBM, "webm" },
{ 0, NULL }
};
--
2.20.1 (Apple Git-117)

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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".




LGTM



the background for this is the extension for DASH media files
used to be *.m4s and it is now *.mp4


the patch is a suggestion and should be checked by the DASH experts

what is correct according to the standard ?

the media-file is not really an .mp4 file, it cannot be
played with e.g. ffplay:

   $ ffplay chunk-stream1-1.m4s

Thanks for submitting the patch. I agree that m4s should be extension for media 
segments.
mp4 should be used only for complete files.
With respect to the patch, dashenc generates either multiple segments or a single 
file(with byte range as segments) based on "single_file" option.
The default of mp4 is correct when "single_file" is enabled. But it is wrong when 
"single_file" is disabled. The proposed patch just reverses this situation.
I would suggest the patch should handle both cases correctly.


Hi,

many thanks for your review comments.

I have updated the patch based on your comments, please see below.


this code works in my application (both single and multi files)
but the code should be reviewed by someone who has better
knowledge with the code.


...



From 2059bfad56eadbccee968cc34dd594089a1e8984 Mon Sep 17 00:00:00 2001
From: "Alfred E. Heggestad" 
Date: Wed, 19 Jun 2019 11:33:13 +0200
Subject: [PATCH] dash: change default MP4 extension to .m4s

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

diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c
index 3fd7e78166..a60547ef0d 100644
--- a/libavformat/dashenc.c
+++ b/libavformat/dashenc.c
@@ -250,6 +250,10 @@ static int init_segment_types(AVFormatContext *s)
 c->segment_type_option, s->streams[i]->codecpar->codec_id);
 os->segment_type = segment_type;
 os->format_name = get_format_str(segment_type);
+
+if (segment_type == SEGMENT_TYPE_MP4 && !c->single_file)
+os->format_name = "m4s";
+
 if (!os->format_name) {
 av_log(s, AV_LOG_ERROR, "Could not select DASH segment 
type for stream %d\n", i);

 return AVERROR_MUXER_NOT_FOUND;
@@ -1210,7 +1214,7 @@ static int dash_init(AVFormatContext *s)
 }
 }

-ctx->oformat = av_guess_format(os->format_name, NULL, NULL);
+ctx->oformat = 
av_guess_format(get_format_str(os->segment_type), NULL, NULL);

 if (!ctx->oformat)
 return AVERROR_MUXER_NOT_FOUND;
 os->ctx = ctx;
--
2.20.1 (Apple Git-117)




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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH] movenc: calculate track_duration without packet duration

2019-06-18 Thread Alfred E. Heggestad

On 17/06/2019 10:23, Gyan wrote:



On 17-06-2019 01:37 PM, Alfred E. Heggestad wrote:

From c69b63a7af5531257753754e64ac33b7ef530e75 Mon Sep 17 00:00:00 2001
From: "Alfred E. Heggestad" 
Date: Mon, 17 Jun 2019 10:04:08 +0200
Subject: [PATCH] movenc: calculate track_duration without packet duration

---
 libavformat/movenc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index 46d314ff17..fa5833962b 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -5486,7 +5486,7 @@ int ff_mov_write_packet(AVFormatContext *s, 
AVPacket *pkt)

    "this case.\n",
    pkt->stream_index, pkt->dts);
 }
-    trk->track_duration = pkt->dts - trk->start_dts + pkt->duration;
+    trk->track_duration = pkt->dts - trk->start_dts;


Why?


trk->last_sample_is_subtitle_end = 0;

 if (pkt->pts == AV_NOPTS_VALUE) {




the background for this change is the check done in check_pkt():

   if (trk->entry) {
ref = trk->cluster[trk->entry - 1].dts;
} else if (   trk->start_dts != AV_NOPTS_VALUE
   && !trk->frag_discont) {
ref = trk->start_dts + trk->track_duration;
} else
ref = pkt->dts; // Skip tests for the first packet

if (trk->dts_shift != AV_NOPTS_VALUE) {
/* With negative CTS offsets we have set an offset to the DTS,
 * reverse this for the check. */
ref -= trk->dts_shift;
}

duration = pkt->dts - ref;
if (pkt->dts < ref || duration >= INT_MAX) {
av_log(s, AV_LOG_ERROR, "Application provided duration: 
%"PRId64" / timestamp: %"PRId64" is out of range for mov/mp4 format\n",

duration, pkt->dts
);

pkt->dts = ref + 1;
pkt->pts = AV_NOPTS_VALUE;
}



it requires that the DTS of the packet is larger than
"ref" which in some cases is equal to track_duration.


line 5015:

 track->track_duration = pkt.dts - track->start_dts;

line 5489:

 trk->track_duration = pkt->dts - trk->start_dts + pkt->duration;


line 5615:

 trk->track_duration = pkt->dts - trk->start_dts;



setting track_duration is inconsistent; some times it includes
duration and some times not.


here is an example with a stream of AVPacket's that increment
the DTS by approx. 10 (and duration is set to 0):

pkt:  dts:
 1 0
 210
 320
 430
 540
 650


after packet 6 has arrived, the "ref" value in check_pkt will now
be calculated to 50 + 10 = 60. the code assumes a duration of 10.

when packet 7 arrives it has a DTS of 59 (which is valid).
but this packet will fail in check_pkt and print a warning,
because 59 < 60.






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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH] dash: change default MP4 extension to .m4s

2019-06-18 Thread Alfred E. Heggestad

On 18/06/2019 04:02, Steven Liu wrote:

Alfred E. Heggestad  于2019年6月17日周一 下午4:02写道:


  From 923da82598bddd1ed05750427dbc71e607d296a2 Mon Sep 17 00:00:00 2001
From: "Alfred E. Heggestad" 
Date: Mon, 17 Jun 2019 09:59:04 +0200
Subject: [PATCH] dash: change default MP4 extension to .m4s

this was changed in commit 281a21ed50849e3c8c0d03005230e9fd07c24370
---
   libavformat/dashenc.c | 2 +-
   1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c
index 3fd7e78166..a51a1da0ca 100644
--- a/libavformat/dashenc.c
+++ b/libavformat/dashenc.c
@@ -166,7 +166,7 @@ static struct format_string {
   const char *str;
   } formats[] = {
   { SEGMENT_TYPE_AUTO, "auto" },
-{ SEGMENT_TYPE_MP4, "mp4" },
+{ SEGMENT_TYPE_MP4, "m4s" },
   { SEGMENT_TYPE_WEBM, "webm" },
   { 0, NULL }
   };
--
2.20.1 (Apple Git-117)

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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".




LGTM



the background for this is the extension for DASH media files
used to be *.m4s and it is now *.mp4


the patch is a suggestion and should be checked by the DASH experts

what is correct according to the standard ?

the media-file is not really an .mp4 file, it cannot be
played with e.g. ffplay:

  $ ffplay chunk-stream1-1.m4s




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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-devel] [PATCH] movenc: calculate track_duration without packet duration

2019-06-17 Thread Alfred E. Heggestad

From c69b63a7af5531257753754e64ac33b7ef530e75 Mon Sep 17 00:00:00 2001
From: "Alfred E. Heggestad" 
Date: Mon, 17 Jun 2019 10:04:08 +0200
Subject: [PATCH] movenc: calculate track_duration without packet duration

---
 libavformat/movenc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index 46d314ff17..fa5833962b 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -5486,7 +5486,7 @@ int ff_mov_write_packet(AVFormatContext *s, 
AVPacket *pkt)

"this case.\n",
pkt->stream_index, pkt->dts);
 }
-trk->track_duration = pkt->dts - trk->start_dts + pkt->duration;
+trk->track_duration = pkt->dts - trk->start_dts;
 trk->last_sample_is_subtitle_end = 0;

 if (pkt->pts == AV_NOPTS_VALUE) {
--
2.20.1 (Apple Git-117)

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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-devel] [PATCH] dash: change default MP4 extension to .m4s

2019-06-17 Thread Alfred E. Heggestad

From 923da82598bddd1ed05750427dbc71e607d296a2 Mon Sep 17 00:00:00 2001
From: "Alfred E. Heggestad" 
Date: Mon, 17 Jun 2019 09:59:04 +0200
Subject: [PATCH] dash: change default MP4 extension to .m4s

this was changed in commit 281a21ed50849e3c8c0d03005230e9fd07c24370
---
 libavformat/dashenc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c
index 3fd7e78166..a51a1da0ca 100644
--- a/libavformat/dashenc.c
+++ b/libavformat/dashenc.c
@@ -166,7 +166,7 @@ static struct format_string {
 const char *str;
 } formats[] = {
 { SEGMENT_TYPE_AUTO, "auto" },
-{ SEGMENT_TYPE_MP4, "mp4" },
+{ SEGMENT_TYPE_MP4, "m4s" },
 { SEGMENT_TYPE_WEBM, "webm" },
 { 0, NULL }
 };
--
2.20.1 (Apple Git-117)

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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH] fix typo in dashenc

2019-06-04 Thread Alfred E. Heggestad

On 04/06/2019 14:07, Gyan wrote:



On 04-06-2019 04:28 PM, Alfred E. Heggestad wrote:

Hi Karthick,

thanks for your feedback. here is an updated patch
as you suggested.






From 7879e39c25ede24693f166eb6a63094757d9fb1e Mon Sep 17 00:00:00 2001
From: "Alfred E. Heggestad" 
Date: Tue, 4 Jun 2019 09:39:59 +0200
Subject: [PATCH] dashenc: fix typo in seg_duration description

doc: fix typo (seconds -> microseconds)
---
 doc/muxers.texi   | 2 +-
 libavformat/dashenc.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/doc/muxers.texi b/doc/muxers.texi
index c73719c421..be02912b29 100644
--- a/doc/muxers.texi
+++ b/doc/muxers.texi
@@ -232,7 +232,7 @@ ffmpeg -re -i  -map 0 -map 0 -c:a 
libfdk_aac -c:v libx264

 @item -min_seg_duration @var{microseconds}
 This is a deprecated option to set the segment length in 
microseconds, use @var{seg_duration} instead.

 @item -seg_duration @var{duration}
-Set the segment length in seconds (fractional value can be set). The 
value is
+Set the segment length in microseconds (fractional value can be set). 
The value is
 treated as average segment duration when @var{use_template} is 
enabled and
 @var{use_timeline} is disabled and as minimum segment duration for 
all the other

 use cases.
diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c
index 94b198ceb8..a70e9d176c 100644
--- a/libavformat/dashenc.c
+++ b/libavformat/dashenc.c
@@ -1863,7 +1863,7 @@ static const AVOption options[] = {
 #if FF_API_DASH_MIN_SEG_DURATION
 { "min_seg_duration", "minimum segment duration (in microseconds) 
(will be deprecated)", OFFSET(min_seg_duration), AV_OPT_TYPE_INT, { 
.i64 = 500 }, 0, INT_MAX, E },

 #endif
-    { "seg_duration", "segment duration (in seconds, fractional value 
can be set)", OFFSET(seg_duration), AV_OPT_TYPE_DURATION, { .i64 = 
500 }, 0, INT_MAX, E },
+    { "seg_duration", "segment duration (in microseconds, fractional 
value can be set)", OFFSET(seg_duration), AV_OPT_TYPE_DURATION, { .i64 
= 500 }, 0, INT_MAX, E },
 { "remove_at_exit", "remove all segments when finished", 
OFFSET(remove_at_exit), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, E },
 { "use_template", "Use SegmentTemplate instead of SegmentList", 
OFFSET(use_template), AV_OPT_TYPE_BOOL, { .i64 = 1 }, 0, 1, E },
 { "use_timeline", "Use SegmentTimeline in SegmentTemplate", 
OFFSET(use_timeline), AV_OPT_TYPE_BOOL, { .i64 = 1 }, 0, 1, E },


This doesn't look right.

I just tested ffmpeg cli with -seg_duration 4 and -seg_duration 400. 
The latter failed with "Value 400.00 for parameter 
'seg_duration' out of range [0 - 2147.48]" and the former produced 
segments of duration 4 seconds each.


The field type is AV_OPT_TYPE_DURATION, and the avutil parser returns a 
microsecond value to the caller, but it expects the user string to be 
either HH:MM:SS or MM:SS or S+. Millisecond and microsecond values can 
be fed, with a suffix of ms or us, respectively.





this code is working for me:

ret |= av_opt_set_int(obj, "seg_duration",  1000, 0);



if you look in the declarations of options in dashenc.c:

#if FF_API_DASH_MIN_SEG_DURATION
{ "min_seg_duration", "minimum segment duration (in microseconds) 
(will be deprecated)", OFFSET(min_seg_duration), AV_OPT_TYPE_INT, { .i64 
= 500 }, 0, INT_MAX, E },

#endif
{ "seg_duration", "segment duration (in seconds, fractional value 
can be set)", OFFSET(seg_duration), AV_OPT_TYPE_DURATION, { .i64 = 
500 }, 0, INT_MAX, E },



see the default value:

.i64 = 500




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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH] fix typo in dashenc

2019-06-04 Thread Alfred E. Heggestad

Hi Karthick,

thanks for your feedback. here is an updated patch
as you suggested.






From 7879e39c25ede24693f166eb6a63094757d9fb1e Mon Sep 17 00:00:00 2001
From: "Alfred E. Heggestad" 
Date: Tue, 4 Jun 2019 09:39:59 +0200
Subject: [PATCH] dashenc: fix typo in seg_duration description

doc: fix typo (seconds -> microseconds)
---
 doc/muxers.texi   | 2 +-
 libavformat/dashenc.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/doc/muxers.texi b/doc/muxers.texi
index c73719c421..be02912b29 100644
--- a/doc/muxers.texi
+++ b/doc/muxers.texi
@@ -232,7 +232,7 @@ ffmpeg -re -i  -map 0 -map 0 -c:a libfdk_aac 
-c:v libx264

 @item -min_seg_duration @var{microseconds}
 This is a deprecated option to set the segment length in microseconds, 
use @var{seg_duration} instead.

 @item -seg_duration @var{duration}
-Set the segment length in seconds (fractional value can be set). The 
value is
+Set the segment length in microseconds (fractional value can be set). 
The value is

 treated as average segment duration when @var{use_template} is enabled and
 @var{use_timeline} is disabled and as minimum segment duration for all 
the other

 use cases.
diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c
index 94b198ceb8..a70e9d176c 100644
--- a/libavformat/dashenc.c
+++ b/libavformat/dashenc.c
@@ -1863,7 +1863,7 @@ static const AVOption options[] = {
 #if FF_API_DASH_MIN_SEG_DURATION
 { "min_seg_duration", "minimum segment duration (in microseconds) 
(will be deprecated)", OFFSET(min_seg_duration), AV_OPT_TYPE_INT, { .i64 
= 500 }, 0, INT_MAX, E },

 #endif
-{ "seg_duration", "segment duration (in seconds, fractional value 
can be set)", OFFSET(seg_duration), AV_OPT_TYPE_DURATION, { .i64 = 
500 }, 0, INT_MAX, E },
+{ "seg_duration", "segment duration (in microseconds, fractional 
value can be set)", OFFSET(seg_duration), AV_OPT_TYPE_DURATION, { .i64 = 
500 }, 0, INT_MAX, E },
 { "remove_at_exit", "remove all segments when finished", 
OFFSET(remove_at_exit), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, E },
 { "use_template", "Use SegmentTemplate instead of SegmentList", 
OFFSET(use_template), AV_OPT_TYPE_BOOL, { .i64 = 1 }, 0, 1, E },
 { "use_timeline", "Use SegmentTimeline in SegmentTemplate", 
OFFSET(use_timeline), AV_OPT_TYPE_BOOL, { .i64 = 1 }, 0, 1, E },

--
2.20.1 (Apple Git-117)

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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-devel] [PATCH] fix typo in dashenc

2019-06-04 Thread Alfred E. Heggestad




From 885abee797458936e39b4a252e96836d3d6e3213 Mon Sep 17 00:00:00 2001
From: "Alfred E. Heggestad" 
Date: Tue, 4 Jun 2019 09:39:59 +0200
Subject: [PATCH] dashenc: fix typo in seg_duration description

---
 libavformat/dashenc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c
index 94b198ceb8..a70e9d176c 100644
--- a/libavformat/dashenc.c
+++ b/libavformat/dashenc.c
@@ -1863,7 +1863,7 @@ static const AVOption options[] = {
 #if FF_API_DASH_MIN_SEG_DURATION
 { "min_seg_duration", "minimum segment duration (in microseconds) 
(will be deprecated)", OFFSET(min_seg_duration), AV_OPT_TYPE_INT, { .i64 
= 500 }, 0, INT_MAX, E },

 #endif
-{ "seg_duration", "segment duration (in seconds, fractional value 
can be set)", OFFSET(seg_duration), AV_OPT_TYPE_DURATION, { .i64 = 
500 }, 0, INT_MAX, E },
+{ "seg_duration", "segment duration (in microseconds, fractional 
value can be set)", OFFSET(seg_duration), AV_OPT_TYPE_DURATION, { .i64 = 
500 }, 0, INT_MAX, E },
 { "remove_at_exit", "remove all segments when finished", 
OFFSET(remove_at_exit), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, E },
 { "use_template", "Use SegmentTemplate instead of SegmentList", 
OFFSET(use_template), AV_OPT_TYPE_BOOL, { .i64 = 1 }, 0, 1, E },
 { "use_timeline", "Use SegmentTimeline in SegmentTemplate", 
OFFSET(use_timeline), AV_OPT_TYPE_BOOL, { .i64 = 1 }, 0, 1, E },

--
2.20.1 (Apple Git-117)

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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".