Re: [FFmpeg-devel] [PATCH v4 2/2] avformat/mux: Set AV_PKT_FLAG_KEY for is_intra_only packet

2020-05-06 Thread lance . lmwang
On Wed, May 06, 2020 at 07:12:23PM +0200, Marton Balint wrote:
> 
> 
> On Wed, 6 May 2020, lance.lmw...@gmail.com wrote:
> 
> > On Wed, May 06, 2020 at 10:11:22AM +0200, Marton Balint wrote:
> > > 
> > > 
> > > On Tue, 21 Apr 2020, lance.lmw...@gmail.com wrote:
> > > 
> > > > From: Limin Wang 
> > > > > The patch will make audio and subtitle packets be marked as
> > > AV_PKT_FLAG_KEY.
> > > 
> > > Why the subtitles? Is it possible that the patch description is outdated? 
> > > I
> > > don't see from the code how would this apply to subtitles, after all
> > > is_intra_only only check for audio and video, no?
> > 
> > No, is_intra_only() check for subtitle also. It'll return 0 for audio and 
> > video
> > and not AV_CODEC_PROP_INTRA_ONLY, other will return 1(is_intra).
> 
> Ah, ok. Is there a practical benefit for setting the keyframe flag for
> subtitles? Or it just happens to work out this way?

yes, hls webvtt subtitle need split by segment by the keyframe flag.

> 
> Either way, fine by me.
> 
> Thanks,
> Marton
> 
> > 
> > 
> > > 
> > > Thanks,
> > > Marton
> > > 
> > > > > For audio, it'll caused the audio sample to be sync sample.
> > > > To verify ref/fate/movenc results:
> > > > 1. Get the movenc test data
> > > > [lmwang@vpn ffmpeg]$ libavformat/tests/movenc -w && mkdir -p audio_old 
> > > > && mv *.mp4 audio_old_
> > > > > After applied the patch:
> > > > [lmwang@vpn ffmpeg]$ make fate-movenc SAMPLES=../fate-suite
> > > > [lmwang@vpn ffmpeg]$ libavformat/tests/movenc -w && mkdir -p audio_key 
> > > > && mv *.mp4 audio_key
> > > > > 2. Get l-smash and build boxdumper
> > > > https://github.com/l-smash/l-smash.git
> > > > > 3. dump the box of crc change mp4 and diff -u
> > > > [lmwang@vpn ffmpeg]$ ../l-smash/cli/boxdumper --box 
> > > > audio_key/non-empty-moov-no-elst.mp4  > 
> > > > audio_key/non-empty-moov-no-elst.log
> > > > [lmwang@vpn ffmpeg]$ ../l-smash/cli/boxdumper --box 
> > > > audio_old/non-empty-moov-no-elst.mp4  > 
> > > > audio_old/non-empty-moov-no-elst.log
> > > > [lmwang@vpn ffmpeg]$ diff -u audio_key/non-empty-moov-no-elst.log 
> > > > audio_old/non-empty-moov-no-elst.log
> > > > -default_sample_flags = 0x0200
> > > > -independent
> > > > -sync sample
> > > > +default_sample_flags = 0x0101
> > > > +dependent
> > > > +non-sync sample
> > > > > 4. have checked the change of crc are caused by
> > > default_sample_flags
> > > > non-empty-moov.mp4, non-empty-moov-elst.mp4,
> > > > non-empty-moov-no-elst.mp4, empty-moov.mp4, delay-moov-content.mp4,
> > > > empty-moov-second-frag.mp4, empty-moov-second-frag-discont.mp4,
> > > > delay-moov-second-frag-discont.mp4, delay-moov-elst-second-frag.mp4
> > > > etc
> > > > > 5 For subtitle, it'll effect for
> > > tests/ref/fate/binsub-movtextenc and
> > > > tests/ref/fate/sub2video, that's expecting result for the subtitle is
> > > > marked as keyframe. Below is the checking result of binsub-movtextenc:
> > > > > [lmwang@vpn ffmpeg]$ ./ffmpeg -i
> > > ../fate-suite/sub/MovText_capability_tester.mp4 -map 0 -scodec
> > > mov_text -f mp4 -flags +bitexact -fflags +bitexact -movflags
> > > frag_keyframe+empty_moov audio_key/binsub-movtextenc.mp4
> > > > [lmwang@vpn ffmpeg]$ ./ffmpeg -i 
> > > > ../fate-suite/sub/MovText_capability_tester.mp4 -map 0 -scodec mov_text 
> > > > -f mp4 -flags +bitexact -fflags +bitexact -movflags 
> > > > frag_keyframe+empty_moov audio_old/binsub-movtextenc.mp4
> > > > [lmwang@vpn ffmpeg]$../l-smash/cli/boxdumper 
> > > > audio_key/binsub-movtextenc.mp4  > audio_key/binsub-movtextenc.log
> > > > [lmwang@vpn ffmpeg]$../l-smash/cli/boxdumper 
> > > > audio_old/binsub-movtextenc.mp4  > audio_old/binsub-movtextenc.log
> > > > [lmwang@vpn ffmpeg]$ diff -u audio_key/binsub-movtextenc.log 
> > > > audio_old/binsub-movtextenc.log
> > > >  // the key difference is the flag for sync sample
> > > > -flags = 0x000701
> > > > +flags = 0x000301
> > > > data-offset-present
> > > > sample-duration-present
> > > > sample-size-present
> > > > -sample-flags-present
> > > > sample_count = 6
> > > > -data_offset = 188
> > > > +data_offset = 164
> > > > sample[0]
> > > > sample_duration = 157
> > > > sample_size = 21
> > > > -sample_flags = 0x0200
> > > > -independent
> > > > -sync sample
> > > > -degradation_priority = 0
> > > > sample[1]
> > > > sample_duration = 51
> > > > sample_size = 2
> > > > -sample_flags = 0x0101
> > > > -dependent
> > > > -non-sync sample
> > > > - 

Re: [FFmpeg-devel] [PATCH v4 2/2] avformat/mux: Set AV_PKT_FLAG_KEY for is_intra_only packet

2020-05-06 Thread Marton Balint



On Wed, 6 May 2020, lance.lmw...@gmail.com wrote:


On Wed, May 06, 2020 at 10:11:22AM +0200, Marton Balint wrote:



On Tue, 21 Apr 2020, lance.lmw...@gmail.com wrote:

> From: Limin Wang 
> 
> The patch will make audio and subtitle packets be marked as AV_PKT_FLAG_KEY.


Why the subtitles? Is it possible that the patch description is outdated? I
don't see from the code how would this apply to subtitles, after all
is_intra_only only check for audio and video, no?


No, is_intra_only() check for subtitle also. It'll return 0 for audio and video
and not AV_CODEC_PROP_INTRA_ONLY, other will return 1(is_intra).


Ah, ok. Is there a practical benefit for setting the keyframe flag for 
subtitles? Or it just happens to work out this way?


Either way, fine by me.

Thanks,
Marton






Thanks,
Marton

> 
> For audio, it'll caused the audio sample to be sync sample.

> To verify ref/fate/movenc results:
> 1. Get the movenc test data
> [lmwang@vpn ffmpeg]$ libavformat/tests/movenc -w && mkdir -p audio_old && mv 
*.mp4 audio_old_
> 
> After applied the patch:

> [lmwang@vpn ffmpeg]$ make fate-movenc SAMPLES=../fate-suite
> [lmwang@vpn ffmpeg]$ libavformat/tests/movenc -w && mkdir -p audio_key && mv 
*.mp4 audio_key
> 
> 2. Get l-smash and build boxdumper

> https://github.com/l-smash/l-smash.git
> 
> 3. dump the box of crc change mp4 and diff -u

> [lmwang@vpn ffmpeg]$ ../l-smash/cli/boxdumper --box 
audio_key/non-empty-moov-no-elst.mp4  > audio_key/non-empty-moov-no-elst.log
> [lmwang@vpn ffmpeg]$ ../l-smash/cli/boxdumper --box 
audio_old/non-empty-moov-no-elst.mp4  > audio_old/non-empty-moov-no-elst.log
> [lmwang@vpn ffmpeg]$ diff -u audio_key/non-empty-moov-no-elst.log 
audio_old/non-empty-moov-no-elst.log
> -default_sample_flags = 0x0200
> -independent
> -sync sample
> +default_sample_flags = 0x0101
> +dependent
> +non-sync sample
> 
> 4. have checked the change of crc are caused by default_sample_flags

> non-empty-moov.mp4, non-empty-moov-elst.mp4,
> non-empty-moov-no-elst.mp4, empty-moov.mp4, delay-moov-content.mp4,
> empty-moov-second-frag.mp4, empty-moov-second-frag-discont.mp4,
> delay-moov-second-frag-discont.mp4, delay-moov-elst-second-frag.mp4
> etc
> 
> 5 For subtitle, it'll effect for tests/ref/fate/binsub-movtextenc and

> tests/ref/fate/sub2video, that's expecting result for the subtitle is
> marked as keyframe. Below is the checking result of binsub-movtextenc:
> 
> [lmwang@vpn ffmpeg]$ ./ffmpeg -i ../fate-suite/sub/MovText_capability_tester.mp4 -map 0 -scodec mov_text -f mp4 -flags +bitexact -fflags +bitexact -movflags frag_keyframe+empty_moov audio_key/binsub-movtextenc.mp4

> [lmwang@vpn ffmpeg]$ ./ffmpeg -i 
../fate-suite/sub/MovText_capability_tester.mp4 -map 0 -scodec mov_text -f mp4 
-flags +bitexact -fflags +bitexact -movflags frag_keyframe+empty_moov 
audio_old/binsub-movtextenc.mp4
> [lmwang@vpn ffmpeg]$../l-smash/cli/boxdumper audio_key/binsub-movtextenc.mp4  
> audio_key/binsub-movtextenc.log
> [lmwang@vpn ffmpeg]$../l-smash/cli/boxdumper audio_old/binsub-movtextenc.mp4  
> audio_old/binsub-movtextenc.log
> [lmwang@vpn ffmpeg]$ diff -u audio_key/binsub-movtextenc.log 
audio_old/binsub-movtextenc.log
>  // the key difference is the flag for sync sample
> -flags = 0x000701
> +flags = 0x000301
> data-offset-present
> sample-duration-present
> sample-size-present
> -sample-flags-present
> sample_count = 6
> -data_offset = 188
> +data_offset = 164
> sample[0]
> sample_duration = 157
> sample_size = 21
> -sample_flags = 0x0200
> -independent
> -sync sample
> -degradation_priority = 0
> sample[1]
> sample_duration = 51
> sample_size = 2
> -sample_flags = 0x0101
> -dependent
> -non-sync sample
> -degradation_priority = 0
> sample[2]
> sample_duration = 169
> sample_size = 9
> -sample_flags = 0x0200
> -independent
> -sync sample
> -degradation_priority = 0
> 
> Signed-off-by: Limin Wang 

> ---
> libavformat/internal.h   |  2 +
> libavformat/mux.c|  7 +++-
> tests/ref/fate/binsub-movtextenc |  2 +-
> tests/ref/fate/movenc| 50 +++
> tests/ref/fate/sub2video | 86 
> 5 files changed, 77 insertions(+), 70 deletions(-)
> 
> diff --git a/libavformat/internal.

Re: [FFmpeg-devel] [PATCH v4 2/2] avformat/mux: Set AV_PKT_FLAG_KEY for is_intra_only packet

2020-05-06 Thread lance . lmwang
On Wed, May 06, 2020 at 10:11:22AM +0200, Marton Balint wrote:
> 
> 
> On Tue, 21 Apr 2020, lance.lmw...@gmail.com wrote:
> 
> > From: Limin Wang 
> > 
> > The patch will make audio and subtitle packets be marked as AV_PKT_FLAG_KEY.
> 
> Why the subtitles? Is it possible that the patch description is outdated? I
> don't see from the code how would this apply to subtitles, after all
> is_intra_only only check for audio and video, no?

No, is_intra_only() check for subtitle also. It'll return 0 for audio and video
and not AV_CODEC_PROP_INTRA_ONLY, other will return 1(is_intra).


> 
> Thanks,
> Marton
> 
> > 
> > For audio, it'll caused the audio sample to be sync sample.
> > To verify ref/fate/movenc results:
> > 1. Get the movenc test data
> > [lmwang@vpn ffmpeg]$ libavformat/tests/movenc -w && mkdir -p audio_old && 
> > mv *.mp4 audio_old_
> > 
> > After applied the patch:
> > [lmwang@vpn ffmpeg]$ make fate-movenc SAMPLES=../fate-suite
> > [lmwang@vpn ffmpeg]$ libavformat/tests/movenc -w && mkdir -p audio_key && 
> > mv *.mp4 audio_key
> > 
> > 2. Get l-smash and build boxdumper
> > https://github.com/l-smash/l-smash.git
> > 
> > 3. dump the box of crc change mp4 and diff -u
> > [lmwang@vpn ffmpeg]$ ../l-smash/cli/boxdumper --box 
> > audio_key/non-empty-moov-no-elst.mp4  > audio_key/non-empty-moov-no-elst.log
> > [lmwang@vpn ffmpeg]$ ../l-smash/cli/boxdumper --box 
> > audio_old/non-empty-moov-no-elst.mp4  > audio_old/non-empty-moov-no-elst.log
> > [lmwang@vpn ffmpeg]$ diff -u audio_key/non-empty-moov-no-elst.log 
> > audio_old/non-empty-moov-no-elst.log
> > -default_sample_flags = 0x0200
> > -independent
> > -sync sample
> > +default_sample_flags = 0x0101
> > +dependent
> > +non-sync sample
> > 
> > 4. have checked the change of crc are caused by default_sample_flags
> > non-empty-moov.mp4, non-empty-moov-elst.mp4,
> > non-empty-moov-no-elst.mp4, empty-moov.mp4, delay-moov-content.mp4,
> > empty-moov-second-frag.mp4, empty-moov-second-frag-discont.mp4,
> > delay-moov-second-frag-discont.mp4, delay-moov-elst-second-frag.mp4
> > etc
> > 
> > 5 For subtitle, it'll effect for tests/ref/fate/binsub-movtextenc and
> > tests/ref/fate/sub2video, that's expecting result for the subtitle is
> > marked as keyframe. Below is the checking result of binsub-movtextenc:
> > 
> > [lmwang@vpn ffmpeg]$ ./ffmpeg -i 
> > ../fate-suite/sub/MovText_capability_tester.mp4 -map 0 -scodec mov_text -f 
> > mp4 -flags +bitexact -fflags +bitexact -movflags frag_keyframe+empty_moov 
> > audio_key/binsub-movtextenc.mp4
> > [lmwang@vpn ffmpeg]$ ./ffmpeg -i 
> > ../fate-suite/sub/MovText_capability_tester.mp4 -map 0 -scodec mov_text -f 
> > mp4 -flags +bitexact -fflags +bitexact -movflags frag_keyframe+empty_moov 
> > audio_old/binsub-movtextenc.mp4
> > [lmwang@vpn ffmpeg]$../l-smash/cli/boxdumper 
> > audio_key/binsub-movtextenc.mp4  > audio_key/binsub-movtextenc.log
> > [lmwang@vpn ffmpeg]$../l-smash/cli/boxdumper 
> > audio_old/binsub-movtextenc.mp4  > audio_old/binsub-movtextenc.log
> > [lmwang@vpn ffmpeg]$ diff -u audio_key/binsub-movtextenc.log 
> > audio_old/binsub-movtextenc.log
> >  // the key difference is the flag for sync sample
> > -flags = 0x000701
> > +flags = 0x000301
> > data-offset-present
> > sample-duration-present
> > sample-size-present
> > -sample-flags-present
> > sample_count = 6
> > -data_offset = 188
> > +data_offset = 164
> > sample[0]
> > sample_duration = 157
> > sample_size = 21
> > -sample_flags = 0x0200
> > -independent
> > -sync sample
> > -degradation_priority = 0
> > sample[1]
> > sample_duration = 51
> > sample_size = 2
> > -sample_flags = 0x0101
> > -dependent
> > -non-sync sample
> > -degradation_priority = 0
> > sample[2]
> > sample_duration = 169
> > sample_size = 9
> > -sample_flags = 0x0200
> > -independent
> > -sync sample
> > -degradation_priority = 0
> > 
> > Signed-off-by: Limin Wang 
> > ---
> > libavformat/internal.h   |  2 +
> > libavformat/mux.c|  7 +++-
> > tests/ref/fate/binsub-movtextenc |  2 +-
> > tests/ref/fate/movenc| 50 +++
> > tests/ref/fate/sub2video | 86 
> > 
> > 5 files changed, 77 insertions(+), 70 deletions(-)
> > 
> > diff --git a/

Re: [FFmpeg-devel] [PATCH v4 2/2] avformat/mux: Set AV_PKT_FLAG_KEY for is_intra_only packet

2020-05-06 Thread Marton Balint



On Tue, 21 Apr 2020, lance.lmw...@gmail.com wrote:


From: Limin Wang 

The patch will make audio and subtitle packets be marked as AV_PKT_FLAG_KEY.


Why the subtitles? Is it possible that the patch description is outdated? 
I don't see from the code how would this apply to subtitles, after all 
is_intra_only only check for audio and video, no?


Thanks,
Marton



For audio, it'll caused the audio sample to be sync sample.
To verify ref/fate/movenc results:
1. Get the movenc test data
[lmwang@vpn ffmpeg]$ libavformat/tests/movenc -w && mkdir -p audio_old && mv 
*.mp4 audio_old_

After applied the patch:
[lmwang@vpn ffmpeg]$ make fate-movenc SAMPLES=../fate-suite
[lmwang@vpn ffmpeg]$ libavformat/tests/movenc -w && mkdir -p audio_key && mv 
*.mp4 audio_key

2. Get l-smash and build boxdumper
https://github.com/l-smash/l-smash.git

3. dump the box of crc change mp4 and diff -u
[lmwang@vpn ffmpeg]$ ../l-smash/cli/boxdumper --box 
audio_key/non-empty-moov-no-elst.mp4  > audio_key/non-empty-moov-no-elst.log
[lmwang@vpn ffmpeg]$ ../l-smash/cli/boxdumper --box 
audio_old/non-empty-moov-no-elst.mp4  > audio_old/non-empty-moov-no-elst.log
[lmwang@vpn ffmpeg]$ diff -u audio_key/non-empty-moov-no-elst.log 
audio_old/non-empty-moov-no-elst.log
-default_sample_flags = 0x0200
-independent
-sync sample
+default_sample_flags = 0x0101
+dependent
+non-sync sample

4. have checked the change of crc are caused by default_sample_flags
non-empty-moov.mp4, non-empty-moov-elst.mp4,
non-empty-moov-no-elst.mp4, empty-moov.mp4, delay-moov-content.mp4,
empty-moov-second-frag.mp4, empty-moov-second-frag-discont.mp4,
delay-moov-second-frag-discont.mp4, delay-moov-elst-second-frag.mp4
etc

5 For subtitle, it'll effect for tests/ref/fate/binsub-movtextenc and
tests/ref/fate/sub2video, that's expecting result for the subtitle is
marked as keyframe. Below is the checking result of binsub-movtextenc:

[lmwang@vpn ffmpeg]$ ./ffmpeg -i 
../fate-suite/sub/MovText_capability_tester.mp4 -map 0 -scodec mov_text -f mp4 
-flags +bitexact -fflags +bitexact -movflags frag_keyframe+empty_moov 
audio_key/binsub-movtextenc.mp4
[lmwang@vpn ffmpeg]$ ./ffmpeg -i 
../fate-suite/sub/MovText_capability_tester.mp4 -map 0 -scodec mov_text -f mp4 
-flags +bitexact -fflags +bitexact -movflags frag_keyframe+empty_moov 
audio_old/binsub-movtextenc.mp4
[lmwang@vpn ffmpeg]$../l-smash/cli/boxdumper audio_key/binsub-movtextenc.mp4  > 
audio_key/binsub-movtextenc.log
[lmwang@vpn ffmpeg]$../l-smash/cli/boxdumper audio_old/binsub-movtextenc.mp4  > 
audio_old/binsub-movtextenc.log
[lmwang@vpn ffmpeg]$ diff -u audio_key/binsub-movtextenc.log 
audio_old/binsub-movtextenc.log
 // the key difference is the flag for sync sample
-flags = 0x000701
+flags = 0x000301
data-offset-present
sample-duration-present
sample-size-present
-sample-flags-present
sample_count = 6
-data_offset = 188
+data_offset = 164
sample[0]
sample_duration = 157
sample_size = 21
-sample_flags = 0x0200
-independent
-sync sample
-degradation_priority = 0
sample[1]
sample_duration = 51
sample_size = 2
-sample_flags = 0x0101
-dependent
-non-sync sample
-degradation_priority = 0
sample[2]
sample_duration = 169
sample_size = 9
-sample_flags = 0x0200
-independent
-sync sample
-degradation_priority = 0

Signed-off-by: Limin Wang 
---
libavformat/internal.h   |  2 +
libavformat/mux.c|  7 +++-
tests/ref/fate/binsub-movtextenc |  2 +-
tests/ref/fate/movenc| 50 +++
tests/ref/fate/sub2video | 86 
5 files changed, 77 insertions(+), 70 deletions(-)

diff --git a/libavformat/internal.h b/libavformat/internal.h
index 716e42c..c4fac5c 100644
--- a/libavformat/internal.h
+++ b/libavformat/internal.h
@@ -189,6 +189,8 @@ struct AVStreamInternal {
 */
int need_context_update;

+int is_intra_only;
+
FFFrac *priv_pts;
};

diff --git a/libavformat/mux.c b/libavformat/mux.c
index a6253f5..ea6524f 100644
--- a/libavformat/mux.c
+++ b/libavformat/mux.c
@@ -357,6 +357,8 @@ FF_ENABLE_DEPRECATION_WARNINGS
if (desc && desc->props & AV_CODEC_PROP_REORDER)
st->internal->reorder = 1;

+st->internal->is_intra_only = ff_is_intra_only(par->codec_id);
+
  

Re: [FFmpeg-devel] [PATCH v4 2/2] avformat/mux: Set AV_PKT_FLAG_KEY for is_intra_only packet

2020-05-05 Thread lance . lmwang
On Tue, Apr 21, 2020 at 11:35:24PM +0800, lance.lmw...@gmail.com wrote:
> From: Limin Wang 
> 
> The patch will make audio and subtitle packets be marked as AV_PKT_FLAG_KEY.
> 
> For audio, it'll caused the audio sample to be sync sample.
> To verify ref/fate/movenc results:
> 1. Get the movenc test data
> [lmwang@vpn ffmpeg]$ libavformat/tests/movenc -w && mkdir -p audio_old && mv 
> *.mp4 audio_old_
> 
> After applied the patch:
> [lmwang@vpn ffmpeg]$ make fate-movenc SAMPLES=../fate-suite
> [lmwang@vpn ffmpeg]$ libavformat/tests/movenc -w && mkdir -p audio_key && mv 
> *.mp4 audio_key
> 
> 2. Get l-smash and build boxdumper
> https://github.com/l-smash/l-smash.git
> 
> 3. dump the box of crc change mp4 and diff -u
> [lmwang@vpn ffmpeg]$ ../l-smash/cli/boxdumper --box 
> audio_key/non-empty-moov-no-elst.mp4  > audio_key/non-empty-moov-no-elst.log
> [lmwang@vpn ffmpeg]$ ../l-smash/cli/boxdumper --box 
> audio_old/non-empty-moov-no-elst.mp4  > audio_old/non-empty-moov-no-elst.log
> [lmwang@vpn ffmpeg]$ diff -u audio_key/non-empty-moov-no-elst.log 
> audio_old/non-empty-moov-no-elst.log
> -default_sample_flags = 0x0200
> -independent
> -sync sample
> +default_sample_flags = 0x0101
> +dependent
> +non-sync sample
> 
> 4. have checked the change of crc are caused by default_sample_flags
> non-empty-moov.mp4, non-empty-moov-elst.mp4,
> non-empty-moov-no-elst.mp4, empty-moov.mp4, delay-moov-content.mp4,
> empty-moov-second-frag.mp4, empty-moov-second-frag-discont.mp4,
> delay-moov-second-frag-discont.mp4, delay-moov-elst-second-frag.mp4
> etc
> 
> 5 For subtitle, it'll effect for tests/ref/fate/binsub-movtextenc and
> tests/ref/fate/sub2video, that's expecting result for the subtitle is
> marked as keyframe. Below is the checking result of binsub-movtextenc:
> 
> [lmwang@vpn ffmpeg]$ ./ffmpeg -i 
> ../fate-suite/sub/MovText_capability_tester.mp4 -map 0 -scodec mov_text -f 
> mp4 -flags +bitexact -fflags +bitexact -movflags frag_keyframe+empty_moov 
> audio_key/binsub-movtextenc.mp4
> [lmwang@vpn ffmpeg]$ ./ffmpeg -i 
> ../fate-suite/sub/MovText_capability_tester.mp4 -map 0 -scodec mov_text -f 
> mp4 -flags +bitexact -fflags +bitexact -movflags frag_keyframe+empty_moov 
> audio_old/binsub-movtextenc.mp4
> [lmwang@vpn ffmpeg]$../l-smash/cli/boxdumper audio_key/binsub-movtextenc.mp4  
> > audio_key/binsub-movtextenc.log
> [lmwang@vpn ffmpeg]$../l-smash/cli/boxdumper audio_old/binsub-movtextenc.mp4  
> > audio_old/binsub-movtextenc.log
> [lmwang@vpn ffmpeg]$ diff -u audio_key/binsub-movtextenc.log 
> audio_old/binsub-movtextenc.log
>  // the key difference is the flag for sync sample
> -flags = 0x000701
> +flags = 0x000301
>  data-offset-present
>  sample-duration-present
>  sample-size-present
> -sample-flags-present
>  sample_count = 6
> -data_offset = 188
> +data_offset = 164
>  sample[0]
>  sample_duration = 157
>  sample_size = 21
> -sample_flags = 0x0200
> -independent
> -sync sample
> -degradation_priority = 0
>  sample[1]
>  sample_duration = 51
>  sample_size = 2
> -sample_flags = 0x0101
> -dependent
> -non-sync sample
> -degradation_priority = 0
>  sample[2]
>  sample_duration = 169
>  sample_size = 9
> -sample_flags = 0x0200
> -independent
> -sync sample
> -degradation_priority = 0
> 


will apply the patchset if no further comments tomorrow.


> Signed-off-by: Limin Wang 
> ---
>  libavformat/internal.h   |  2 +
>  libavformat/mux.c|  7 +++-
>  tests/ref/fate/binsub-movtextenc |  2 +-
>  tests/ref/fate/movenc| 50 +++
>  tests/ref/fate/sub2video | 86 
> 
>  5 files changed, 77 insertions(+), 70 deletions(-)
> 
> diff --git a/libavformat/internal.h b/libavformat/internal.h
> index 716e42c..c4fac5c 100644
> --- a/libavformat/internal.h
> +++ b/libavformat/internal.h
> @@ -189,6 +189,8 @@ struct AVStreamInternal {
>   */
>  int need_context_update;
>  
> +int is_intra_only;
> +
>  FFFrac *priv_pts;
>  };
>  
> diff --git a/libavformat/mux.c b/libavformat/mux.c
> index a6253f5..ea6524f 100644
> --- a/libavformat/mux.c
> +++ b/libavformat/mux.c
> @@ -357,6 +357,8 @@ FF_ENABLE_DEPRECATION_WARNINGS
>  if (desc && desc->props & AV_CODEC_PROP_REORDER