Re: [FFmpeg-devel] [PATCH] lavf/mov.c: Set st->start_time for video streams explicitly.

2018-06-05 Thread Michael Niedermayer
On Thu, May 31, 2018 at 04:26:24PM -0700, Sasi Inguva wrote:
> Pls find attached, the correctly signed patch
> Thanks.
> 
> On Thu, May 31, 2018 at 4:14 PM Sasi Inguva  wrote:
> 
> > Sorry. Forgot to attach the file. Pls find it attached. Also resending the
> > patch signed with correct email address
> >
> > On Thu, May 31, 2018 at 2:14 PM Michael Niedermayer 
> > wrote:
> >
> >> On Tue, May 29, 2018 at 03:39:40PM -0700, Sasi Inguva wrote:
> >> > If start_time is not set, ffmpeg takes the duration from the global
> >> > movie instead of the per stream duration.
> >> > Signed-off-by: Sasi Inguva  >> >
> >> > ---
> >> >  libavformat/mov.c| 20 +---
> >> >  tests/fate/mov.mak   |  4 +++
> >> >  tests/ref/fate/mov-neg-firstpts-discard  |  2 +-
> >> >  tests/ref/fate/mov-stream-shorter-than-movie | 33 
> >> >  4 files changed, 54 insertions(+), 5 deletions(-)
> >> >  create mode 100644 tests/ref/fate/mov-stream-shorter-than-movie
> >>
> >> i may have missed a link to a sample file
> >>
> >> fate-suite//mov/mov_stream_shorter_than_movie.mov: No such file or
> >> directory
> >> make: *** [fate-mov-stream-shorter-than-movie] Error 1
> >>
> >>
> >>
> >>
> >> [...]
> >> --
> >> Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
> >>
> >> It is dangerous to be right in matters on which the established
> >> authorities
> >> are wrong. -- Voltaire
> >> ___
> >> ffmpeg-devel mailing list
> >> ffmpeg-devel@ffmpeg.org
> >> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> >>
> >

>  libavformat/mov.c|   20 +---
>  tests/fate/mov.mak   |4 +++
>  tests/ref/fate/mov-neg-firstpts-discard  |2 -
>  tests/ref/fate/mov-stream-shorter-than-movie |   33 
> +++
>  4 files changed, 54 insertions(+), 5 deletions(-)
> 5d8c7d670192a5f785f22bc79e8bf02be950c9f4  
> 0001-lavf-mov.c-Set-st-start_time-for-video-streams-expli.patch
> From ba2feb04ef1ca94f7e1972e23c84c2acde93bf68 Mon Sep 17 00:00:00 2001
> From: Sasi Inguva 
> Date: Tue, 29 May 2018 15:36:07 -0700
> Subject: [PATCH] lavf/mov.c: Set st->start_time for video streams explicitly.
> 
> If start_time is not set, ffmpeg takes the duration from the global
> movie instead of the per stream duration.
> Signed-off-by: Sasi Inguva 
> ---
>  libavformat/mov.c| 20 +---
>  tests/fate/mov.mak   |  4 +++
>  tests/ref/fate/mov-neg-firstpts-discard  |  2 +-
>  tests/ref/fate/mov-stream-shorter-than-movie | 33 
>  4 files changed, 54 insertions(+), 5 deletions(-)
>  create mode 100644 tests/ref/fate/mov-stream-shorter-than-movie

will apply

thanks


[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Why not whip the teacher when the pupil misbehaves? -- Diogenes of Sinope


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


Re: [FFmpeg-devel] [PATCH] lavf/mov.c: Set st->start_time for video streams explicitly.

2018-06-04 Thread Sasi Inguva
friendly ping. thx.

On Thu, May 31, 2018 at 4:26 PM Sasi Inguva  wrote:

> Pls find attached, the correctly signed patch
> Thanks.
>
> On Thu, May 31, 2018 at 4:14 PM Sasi Inguva  wrote:
>
>> Sorry. Forgot to attach the file. Pls find it attached. Also resending
>> the patch signed with correct email address
>>
>> On Thu, May 31, 2018 at 2:14 PM Michael Niedermayer
>>  wrote:
>>
>>> On Tue, May 29, 2018 at 03:39:40PM -0700, Sasi Inguva wrote:
>>> > If start_time is not set, ffmpeg takes the duration from the global
>>> > movie instead of the per stream duration.
>>> > Signed-off-by: Sasi Inguva <
>>> is...@rodete-desktop-imager.corp.google.com>
>>> > ---
>>> >  libavformat/mov.c| 20 +---
>>> >  tests/fate/mov.mak   |  4 +++
>>> >  tests/ref/fate/mov-neg-firstpts-discard  |  2 +-
>>> >  tests/ref/fate/mov-stream-shorter-than-movie | 33 
>>> >  4 files changed, 54 insertions(+), 5 deletions(-)
>>> >  create mode 100644 tests/ref/fate/mov-stream-shorter-than-movie
>>>
>>> i may have missed a link to a sample file
>>>
>>> fate-suite//mov/mov_stream_shorter_than_movie.mov: No such file or
>>> directory
>>> make: *** [fate-mov-stream-shorter-than-movie] Error 1
>>>
>>>
>>>
>>>
>>> [...]
>>> --
>>> Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
>>>
>>> It is dangerous to be right in matters on which the established
>>> authorities
>>> are wrong. -- Voltaire
>>> ___
>>> ffmpeg-devel mailing list
>>> ffmpeg-devel@ffmpeg.org
>>> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>>>
>>
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] lavf/mov.c: Set st->start_time for video streams explicitly.

2018-05-31 Thread Sasi Inguva
Pls find attached, the correctly signed patch
Thanks.

On Thu, May 31, 2018 at 4:14 PM Sasi Inguva  wrote:

> Sorry. Forgot to attach the file. Pls find it attached. Also resending the
> patch signed with correct email address
>
> On Thu, May 31, 2018 at 2:14 PM Michael Niedermayer 
> wrote:
>
>> On Tue, May 29, 2018 at 03:39:40PM -0700, Sasi Inguva wrote:
>> > If start_time is not set, ffmpeg takes the duration from the global
>> > movie instead of the per stream duration.
>> > Signed-off-by: Sasi Inguva > >
>> > ---
>> >  libavformat/mov.c| 20 +---
>> >  tests/fate/mov.mak   |  4 +++
>> >  tests/ref/fate/mov-neg-firstpts-discard  |  2 +-
>> >  tests/ref/fate/mov-stream-shorter-than-movie | 33 
>> >  4 files changed, 54 insertions(+), 5 deletions(-)
>> >  create mode 100644 tests/ref/fate/mov-stream-shorter-than-movie
>>
>> i may have missed a link to a sample file
>>
>> fate-suite//mov/mov_stream_shorter_than_movie.mov: No such file or
>> directory
>> make: *** [fate-mov-stream-shorter-than-movie] Error 1
>>
>>
>>
>>
>> [...]
>> --
>> Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
>>
>> It is dangerous to be right in matters on which the established
>> authorities
>> are wrong. -- Voltaire
>> ___
>> ffmpeg-devel mailing list
>> ffmpeg-devel@ffmpeg.org
>> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>>
>
From ba2feb04ef1ca94f7e1972e23c84c2acde93bf68 Mon Sep 17 00:00:00 2001
From: Sasi Inguva 
Date: Tue, 29 May 2018 15:36:07 -0700
Subject: [PATCH] lavf/mov.c: Set st->start_time for video streams explicitly.

If start_time is not set, ffmpeg takes the duration from the global
movie instead of the per stream duration.
Signed-off-by: Sasi Inguva 
---
 libavformat/mov.c| 20 +---
 tests/fate/mov.mak   |  4 +++
 tests/ref/fate/mov-neg-firstpts-discard  |  2 +-
 tests/ref/fate/mov-stream-shorter-than-movie | 33 
 4 files changed, 54 insertions(+), 5 deletions(-)
 create mode 100644 tests/ref/fate/mov-stream-shorter-than-movie

diff --git a/libavformat/mov.c b/libavformat/mov.c
index f2a540ad50..1915be5fb5 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -3672,11 +3672,15 @@ static void mov_fix_index(MOVContext *mov, AVStream *st)
 
 // If the minimum pts turns out to be greater than zero after fixing the index, then we subtract the
 // dts by that amount to make the first pts zero.
-if (st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO && msc->min_corrected_pts > 0) {
-av_log(mov->fc, AV_LOG_DEBUG, "Offset DTS by %"PRId64" to make first pts zero.\n", msc->min_corrected_pts);
-for (i = 0; i < st->nb_index_entries; ++i) {
-st->index_entries[i].timestamp -= msc->min_corrected_pts;
+if (st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO) {
+if (msc->min_corrected_pts > 0) {
+av_log(mov->fc, AV_LOG_DEBUG, "Offset DTS by %"PRId64" to make first pts zero.\n", msc->min_corrected_pts);
+for (i = 0; i < st->nb_index_entries; ++i) {
+st->index_entries[i].timestamp -= msc->min_corrected_pts;
+}
 }
+// Start time should be equal to zero or the duration of any empty edits.
+st->start_time = empty_edits_sum_duration;
 }
 
 // Update av stream length, if it ends up shorter than the track's media duration
@@ -4012,6 +4016,14 @@ static void mov_build_index(MOVContext *mov, AVStream *st)
 mov_fix_index(mov, st);
 }
 
+// Update start time of the stream.
+if (st->start_time == AV_NOPTS_VALUE && st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO && st->nb_index_entries > 0) {
+st->start_time = st->index_entries[0].timestamp + sc->dts_shift;
+if (sc->ctts_data) {
+st->start_time += sc->ctts_data[0].duration;
+}
+}
+
 mov_estimate_video_delay(mov, st);
 }
 
diff --git a/tests/fate/mov.mak b/tests/fate/mov.mak
index eadee3abfa..c1d399e5c0 100644
--- a/tests/fate/mov.mak
+++ b/tests/fate/mov.mak
@@ -16,6 +16,7 @@ FATE_MOV = fate-mov-3elist \
fate-mov-frag-overlap \
fate-mov-bbi-elst-starts-b \
fate-mov-neg-firstpts-discard-frames \
+	   fate-mov-stream-shorter-than-movie \
 
 FATE_MOV_FFPROBE = fate-mov-neg-firstpts-discard \
fate-mov-aac-2048-priming \
@@ -88,6 +89,9 @@ fate-mov-neg-firstpts-discard: CMD = run ffprobe$(PROGSSUF)$(EXESUF) -show_entri
 # Makes sure that expected frames are generated for mov_neg_first_pts_discard.mov with -vsync 1
 fate-mov-neg-firstpts-discard-frames: CMD = framemd5 -flags +bitexact -i $(TARGET_SAMPLES)/mov/mov_neg_first_pts_discard.mov -vsync 1
 
+# Makes sure that no frame is dropped/duplicated with fps filter due to start_time / duration miscalculations.
+fate-mov-stream-shorter-than-movie: CMD = framemd5 -flags 

Re: [FFmpeg-devel] [PATCH] lavf/mov.c: Set st->start_time for video streams explicitly.

2018-05-31 Thread Sasi Inguva
Sorry. Forgot to attach the file. Pls find it attached. Also resending the
patch signed with correct email address

On Thu, May 31, 2018 at 2:14 PM Michael Niedermayer 
wrote:

> On Tue, May 29, 2018 at 03:39:40PM -0700, Sasi Inguva wrote:
> > If start_time is not set, ffmpeg takes the duration from the global
> > movie instead of the per stream duration.
> > Signed-off-by: Sasi Inguva 
> > ---
> >  libavformat/mov.c| 20 +---
> >  tests/fate/mov.mak   |  4 +++
> >  tests/ref/fate/mov-neg-firstpts-discard  |  2 +-
> >  tests/ref/fate/mov-stream-shorter-than-movie | 33 
> >  4 files changed, 54 insertions(+), 5 deletions(-)
> >  create mode 100644 tests/ref/fate/mov-stream-shorter-than-movie
>
> i may have missed a link to a sample file
>
> fate-suite//mov/mov_stream_shorter_than_movie.mov: No such file or
> directory
> make: *** [fate-mov-stream-shorter-than-movie] Error 1
>
>
>
>
> [...]
> --
> Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
>
> It is dangerous to be right in matters on which the established authorities
> are wrong. -- Voltaire
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>


mov_stream_shorter_than_movie.mov
Description: QuickTime movie
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] lavf/mov.c: Set st->start_time for video streams explicitly.

2018-05-31 Thread Michael Niedermayer
On Tue, May 29, 2018 at 03:39:40PM -0700, Sasi Inguva wrote:
> If start_time is not set, ffmpeg takes the duration from the global
> movie instead of the per stream duration.
> Signed-off-by: Sasi Inguva 
> ---
>  libavformat/mov.c| 20 +---
>  tests/fate/mov.mak   |  4 +++
>  tests/ref/fate/mov-neg-firstpts-discard  |  2 +-
>  tests/ref/fate/mov-stream-shorter-than-movie | 33 
>  4 files changed, 54 insertions(+), 5 deletions(-)
>  create mode 100644 tests/ref/fate/mov-stream-shorter-than-movie

i may have missed a link to a sample file 

fate-suite//mov/mov_stream_shorter_than_movie.mov: No such file or directory
make: *** [fate-mov-stream-shorter-than-movie] Error 1




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

It is dangerous to be right in matters on which the established authorities
are wrong. -- Voltaire


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


Re: [FFmpeg-devel] [PATCH] lavf/mov.c: Set st->start_time for video streams explicitly.

2018-05-30 Thread Derek Buitenhuis
On Tue, May 29, 2018 at 11:39 PM, Sasi Inguva
 wrote:
> If start_time is not set, ffmpeg takes the duration from the global
> movie instead of the per stream duration.
> Signed-off-by: Sasi Inguva 

Probably OK, though it seems your git client didn't have your email configured.

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