Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
* [FFmpeg-devel] [PATCH 1/8] fftools/ffprobe: Report initial and trailing padding
@ 2022-09-01 20:38 Andreas Rheinhardt
  2022-09-01 21:23 ` [FFmpeg-devel] [PATCH 2/8] fate/matroska: Add tests for muxing with initial_padding Andreas Rheinhardt
                   ` (7 more replies)
  0 siblings, 8 replies; 11+ messages in thread
From: Andreas Rheinhardt @ 2022-09-01 20:38 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: Andreas Rheinhardt

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
trailing_padding seems to be unused and could actually be deprecated.

 doc/ffprobe.xsd                                     | 2 ++
 fftools/ffprobe.c                                   | 3 +++
 tests/ref/fate/concat-demuxer-extended-lavf-mxf     | 2 +-
 tests/ref/fate/concat-demuxer-extended-lavf-mxf_d10 | 2 +-
 tests/ref/fate/concat-demuxer-simple1-lavf-mxf      | 2 +-
 tests/ref/fate/concat-demuxer-simple1-lavf-mxf_d10  | 2 +-
 tests/ref/fate/concat-demuxer-simple2-lavf-ts       | 2 +-
 tests/ref/fate/ffprobe_compact                      | 2 +-
 tests/ref/fate/ffprobe_csv                          | 2 +-
 tests/ref/fate/ffprobe_default                      | 2 ++
 tests/ref/fate/ffprobe_flat                         | 2 ++
 tests/ref/fate/ffprobe_ini                          | 2 ++
 tests/ref/fate/ffprobe_json                         | 2 ++
 tests/ref/fate/ffprobe_xml                          | 2 +-
 tests/ref/fate/flv-demux                            | 2 +-
 tests/ref/fate/gapless-mp3-side-data                | 2 +-
 tests/ref/fate/mxf-probe-applehdr10                 | 4 ++++
 tests/ref/fate/mxf-probe-d10                        | 2 ++
 tests/ref/fate/mxf-probe-dv25                       | 4 ++++
 tests/ref/fate/oggopus-demux                        | 2 +-
 tests/ref/fate/ts-demux                             | 4 ++--
 tests/ref/fate/ts-opus-demux                        | 2 +-
 22 files changed, 37 insertions(+), 14 deletions(-)

diff --git a/doc/ffprobe.xsd b/doc/ffprobe.xsd
index 6e678a9970..6052a5eff4 100644
--- a/doc/ffprobe.xsd
+++ b/doc/ffprobe.xsd
@@ -246,6 +246,8 @@
       <xsd:attribute name="channels"         type="xsd:int"/>
       <xsd:attribute name="channel_layout"   type="xsd:string"/>
       <xsd:attribute name="bits_per_sample"  type="xsd:int"/>
+      <xsd:attribute name="initial_padding"  type="xsd:int"/>
+      <xsd:attribute name="trailing_padding" type="xsd:int"/>
 
       <xsd:attribute name="id"               type="xsd:string"/>
       <xsd:attribute name="r_frame_rate"     type="xsd:string" use="required"/>
diff --git a/fftools/ffprobe.c b/fftools/ffprobe.c
index 3344a06409..9eb20fa4cd 100644
--- a/fftools/ffprobe.c
+++ b/fftools/ffprobe.c
@@ -3044,6 +3044,9 @@ static int show_stream(WriterContext *w, AVFormatContext *fmt_ctx, int stream_id
         }
 
         print_int("bits_per_sample", av_get_bits_per_sample(par->codec_id));
+
+        print_int("initial_padding",  par->initial_padding);
+        print_int("trailing_padding", par->trailing_padding);
         break;
 
     case AVMEDIA_TYPE_SUBTITLE:
diff --git a/tests/ref/fate/concat-demuxer-extended-lavf-mxf b/tests/ref/fate/concat-demuxer-extended-lavf-mxf
index 543c7d6a8c..973ce5d4a4 100644
--- a/tests/ref/fate/concat-demuxer-extended-lavf-mxf
+++ b/tests/ref/fate/concat-demuxer-extended-lavf-mxf
@@ -1 +1 @@
-d367d7f6df7292cbf454c6d07fca9b04 *tests/data/fate/concat-demuxer-extended-lavf-mxf.ffprobe
+3fa8632676f0e40c42be38b842794afc *tests/data/fate/concat-demuxer-extended-lavf-mxf.ffprobe
diff --git a/tests/ref/fate/concat-demuxer-extended-lavf-mxf_d10 b/tests/ref/fate/concat-demuxer-extended-lavf-mxf_d10
index 57b22848b9..905ae46343 100644
--- a/tests/ref/fate/concat-demuxer-extended-lavf-mxf_d10
+++ b/tests/ref/fate/concat-demuxer-extended-lavf-mxf_d10
@@ -1 +1 @@
-1fac6962d4c5f1070d0d2db5ab7d86aa *tests/data/fate/concat-demuxer-extended-lavf-mxf_d10.ffprobe
+f88c5d6b16ec3ffd5d35b64a031489be *tests/data/fate/concat-demuxer-extended-lavf-mxf_d10.ffprobe
diff --git a/tests/ref/fate/concat-demuxer-simple1-lavf-mxf b/tests/ref/fate/concat-demuxer-simple1-lavf-mxf
index dcc98e9bdb..c227fa534c 100644
--- a/tests/ref/fate/concat-demuxer-simple1-lavf-mxf
+++ b/tests/ref/fate/concat-demuxer-simple1-lavf-mxf
@@ -100,4 +100,4 @@ video|0|33|1.320000|33|1.320000|1|0.040000|12362|195072|__|1|Strings Metadata
 audio|1|65280|1.360000|65280|1.360000|1920|0.040000|3840|207872|K_|1|Strings Metadata
 video|0|37|1.480000|34|1.360000|1|0.040000|24786|212480|K_|1|Strings Metadata
 0|mpeg2video|4|video|[0][0][0][0]|0x0000|352|288|0|0|0|0|1|1:1|11:9|yuv420p|8|tv|unknown|unknown|unknown|left|progressive|1|N/A|25/1|25/1|1/25|N/A|N/A|N/A|N/A|N/A|N/A|N/A|N/A|N/A|51|22|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0x060A2B340101010501010D001300000000000000000000000000000000000001|CPB properties|0|0|0|49152|-1
-1|pcm_s16le|unknown|audio|[0][0][0][0]|0x0000|s16|48000|1|unknown|16|N/A|0/0|0/0|1/48000|0|0.000000|N/A|N/A|768000|N/A|N/A|N/A|N/A|50|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0x060A2B340101010501010D001300000000000000000000000000000000000001
+1|pcm_s16le|unknown|audio|[0][0][0][0]|0x0000|s16|48000|1|unknown|16|0|0|N/A|0/0|0/0|1/48000|0|0.000000|N/A|N/A|768000|N/A|N/A|N/A|N/A|50|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0x060A2B340101010501010D001300000000000000000000000000000000000001
diff --git a/tests/ref/fate/concat-demuxer-simple1-lavf-mxf_d10 b/tests/ref/fate/concat-demuxer-simple1-lavf-mxf_d10
index 8937724ed1..f26e3c2e1b 100644
--- a/tests/ref/fate/concat-demuxer-simple1-lavf-mxf_d10
+++ b/tests/ref/fate/concat-demuxer-simple1-lavf-mxf_d10
@@ -69,4 +69,4 @@ audio|1|63360|1.320000|63360|1.320000|1920|0.040000|7680|1861632|K_|1|Strings Me
 video|0|34|1.360000|34|1.360000|1|0.040000|150000|1924096|K_|1|Strings Metadata
 audio|1|65280|1.360000|65280|1.360000|1920|0.040000|7680|2074624|K_|1|Strings Metadata
 0|mpeg2video|0|video|[0][0][0][0]|0x0000|720|608|0|0|0|0|0|1:1|45:38|yuv422p|5|tv|unknown|unknown|unknown|topleft|tb|1|N/A|25/1|25/1|1/25|0|0.000000|N/A|N/A|30000000|N/A|N/A|N/A|N/A|35|22|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0x060A2B340101010501010D001300000000000000000000000000000000000001|CPB properties|30000000|0|0|1212416|-1
-1|pcm_s16le|unknown|audio|[0][0][0][0]|0x0000|s16|48000|2|unknown|16|N/A|0/0|0/0|1/48000|0|0.000000|N/A|N/A|1536000|N/A|N/A|N/A|N/A|35|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0x060A2B340101010501010D001300000000000000000000000000000000000001
+1|pcm_s16le|unknown|audio|[0][0][0][0]|0x0000|s16|48000|2|unknown|16|0|0|N/A|0/0|0/0|1/48000|0|0.000000|N/A|N/A|1536000|N/A|N/A|N/A|N/A|35|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0x060A2B340101010501010D001300000000000000000000000000000000000001
diff --git a/tests/ref/fate/concat-demuxer-simple2-lavf-ts b/tests/ref/fate/concat-demuxer-simple2-lavf-ts
index 9603ca21d0..5d03e5cd50 100644
--- a/tests/ref/fate/concat-demuxer-simple2-lavf-ts
+++ b/tests/ref/fate/concat-demuxer-simple2-lavf-ts
@@ -211,5 +211,5 @@ video|1|171982|1.910911|168382|1.870911|3600|0.040000|17440|206988|__|MPEGTS Str
 
 video|1|175582|1.950911|171982|1.910911|3600|0.040000|15019|224848|__|MPEGTS Stream ID|224
 
-0|mp2|unknown|audio|[3][0][0][0]|0x0003|s16p|44100|1|mono|0|N/A|0/0|0/0|1/90000|0|0.000000|N/A|N/A|64000|N/A|N/A|N/A|N/A|89|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|this is stream 0
+0|mp2|unknown|audio|[3][0][0][0]|0x0003|s16p|44100|1|mono|0|0|0|N/A|0/0|0/0|1/90000|0|0.000000|N/A|N/A|64000|N/A|N/A|N/A|N/A|89|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|this is stream 0
 1|mpeg2video|4|video|[2][0][0][0]|0x0002|352|288|0|0|0|0|1|1:1|11:9|yuv420p|8|tv|unknown|unknown|unknown|left|progressive|1|N/A|25/1|25/1|1/90000|N/A|N/A|N/A|N/A|N/A|N/A|N/A|N/A|N/A|60|22|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|this is stream 1|CPB properties|0|0|0|49152|-1
diff --git a/tests/ref/fate/ffprobe_compact b/tests/ref/fate/ffprobe_compact
index 5374bfca03..4f7cc1e09d 100644
--- a/tests/ref/fate/ffprobe_compact
+++ b/tests/ref/fate/ffprobe_compact
@@ -26,7 +26,7 @@ packet|codec_type=video|stream_index=1|pts=6144|pts_time=0.120000|dts=6144|dts_t
 frame|media_type=video|stream_index=1|key_frame=1|pts=6144|pts_time=0.120000|pkt_dts=6144|pkt_dts_time=0.120000|best_effort_timestamp=6144|best_effort_timestamp_time=0.120000|pkt_duration=2048|pkt_duration_time=0.040000|duration=2048|duration_time=0.040000|pkt_pos=793142|pkt_size=230400|width=320|height=240|pix_fmt=rgb24|sample_aspect_ratio=1:1|pict_type=I|coded_picture_number=0|display_picture_number=0|interlaced_frame=0|top_field_first=0|repeat_pict=0|color_range=unknown|color_space=unknown|color_primaries=unknown|color_transfer=unknown|chroma_location=unspecified
 packet|codec_type=video|stream_index=2|pts=6144|pts_time=0.120000|dts=6144|dts_time=0.120000|duration=2048|duration_time=0.040000|size=30000|pos=1023566|flags=K_
 frame|media_type=video|stream_index=2|key_frame=1|pts=6144|pts_time=0.120000|pkt_dts=6144|pkt_dts_time=0.120000|best_effort_timestamp=6144|best_effort_timestamp_time=0.120000|pkt_duration=2048|pkt_duration_time=0.040000|duration=2048|duration_time=0.040000|pkt_pos=1023566|pkt_size=30000|width=100|height=100|pix_fmt=rgb24|sample_aspect_ratio=1:1|pict_type=I|coded_picture_number=0|display_picture_number=0|interlaced_frame=0|top_field_first=0|repeat_pict=0|color_range=unknown|color_space=unknown|color_primaries=unknown|color_transfer=unknown|chroma_location=unspecified
-stream|index=0|codec_name=pcm_s16le|profile=unknown|codec_type=audio|codec_tag_string=PSD[16]|codec_tag=0x10445350|sample_fmt=s16|sample_rate=44100|channels=1|channel_layout=unknown|bits_per_sample=16|id=N/A|r_frame_rate=0/0|avg_frame_rate=0/0|time_base=1/44100|start_pts=0|start_time=0.000000|duration_ts=N/A|duration=N/A|bit_rate=705600|max_bit_rate=N/A|bits_per_raw_sample=N/A|nb_frames=N/A|nb_read_frames=6|nb_read_packets=6|disposition:default=0|disposition:dub=0|disposition:original=0|disposition:comment=0|disposition:lyrics=0|disposition:karaoke=0|disposition:forced=0|disposition:hearing_impaired=0|disposition:visual_impaired=0|disposition:clean_effects=0|disposition:attached_pic=0|disposition:timed_thumbnails=0|disposition:captions=0|disposition:descriptions=0|disposition:metadata=0|disposition:dependent=0|disposition:still_image=0|tag:E=mc²|tag:encoder=Lavc pcm_s16le
+stream|index=0|codec_name=pcm_s16le|profile=unknown|codec_type=audio|codec_tag_string=PSD[16]|codec_tag=0x10445350|sample_fmt=s16|sample_rate=44100|channels=1|channel_layout=unknown|bits_per_sample=16|initial_padding=0|trailing_padding=0|id=N/A|r_frame_rate=0/0|avg_frame_rate=0/0|time_base=1/44100|start_pts=0|start_time=0.000000|duration_ts=N/A|duration=N/A|bit_rate=705600|max_bit_rate=N/A|bits_per_raw_sample=N/A|nb_frames=N/A|nb_read_frames=6|nb_read_packets=6|disposition:default=0|disposition:dub=0|disposition:original=0|disposition:comment=0|disposition:lyrics=0|disposition:karaoke=0|disposition:forced=0|disposition:hearing_impaired=0|disposition:visual_impaired=0|disposition:clean_effects=0|disposition:attached_pic=0|disposition:timed_thumbnails=0|disposition:captions=0|disposition:descriptions=0|disposition:metadata=0|disposition:dependent=0|disposition:still_image=0|tag:E=mc²|tag:encoder=Lavc pcm_s16le
 stream|index=1|codec_name=rawvideo|profile=unknown|codec_type=video|codec_tag_string=RGB[24]|codec_tag=0x18424752|width=320|height=240|coded_width=320|coded_height=240|closed_captions=0|film_grain=0|has_b_frames=0|sample_aspect_ratio=1:1|display_aspect_ratio=4:3|pix_fmt=rgb24|level=-99|color_range=unknown|color_space=unknown|color_transfer=unknown|color_primaries=unknown|chroma_location=unspecified|field_order=unknown|refs=1|id=N/A|r_frame_rate=25/1|avg_frame_rate=25/1|time_base=1/51200|start_pts=0|start_time=0.000000|duration_ts=N/A|duration=N/A|bit_rate=N/A|max_bit_rate=N/A|bits_per_raw_sample=N/A|nb_frames=N/A|nb_read_frames=4|nb_read_packets=4|disposition:default=1|disposition:dub=0|disposition:original=0|disposition:comment=0|disposition:lyrics=0|disposition:karaoke=0|disposition:forced=0|disposition:hearing_impaired=0|disposition:visual_impaired=0|disposition:clean_effects=0|disposition:attached_pic=0|disposition:timed_thumbnails=0|disposition:captions=0|disposition:descriptions=0|disposition:metadata=0|disposition:dependent=0|disposition:still_image=0|tag:title=foobar|tag:duration_ts=field-and-tags-conflict-attempt|tag:encoder=Lavc rawvideo
 stream|index=2|codec_name=rawvideo|profile=unknown|codec_type=video|codec_tag_string=RGB[24]|codec_tag=0x18424752|width=100|height=100|coded_width=100|coded_height=100|closed_captions=0|film_grain=0|has_b_frames=0|sample_aspect_ratio=1:1|display_aspect_ratio=1:1|pix_fmt=rgb24|level=-99|color_range=unknown|color_space=unknown|color_transfer=unknown|color_primaries=unknown|chroma_location=unspecified|field_order=unknown|refs=1|id=N/A|r_frame_rate=25/1|avg_frame_rate=25/1|time_base=1/51200|start_pts=0|start_time=0.000000|duration_ts=N/A|duration=N/A|bit_rate=N/A|max_bit_rate=N/A|bits_per_raw_sample=N/A|nb_frames=N/A|nb_read_frames=4|nb_read_packets=4|disposition:default=0|disposition:dub=0|disposition:original=0|disposition:comment=0|disposition:lyrics=0|disposition:karaoke=0|disposition:forced=0|disposition:hearing_impaired=0|disposition:visual_impaired=0|disposition:clean_effects=0|disposition:attached_pic=0|disposition:timed_thumbnails=0|disposition:captions=0|disposition:descriptions=0|disposition:metadata=0|disposition:dependent=0|disposition:still_image=0|tag:encoder=Lavc rawvideo
 format|filename=tests/data/ffprobe-test.nut|nb_streams=3|nb_programs=0|format_name=nut|start_time=0.000000|duration=0.120000|size=1053646|bit_rate=70243066|probe_score=100|tag:title=ffprobe test file|tag:comment='A comment with CSV, XML & JSON special chars': <tag value="x">|tag:comment2=I ♥ Üñîçød€
diff --git a/tests/ref/fate/ffprobe_csv b/tests/ref/fate/ffprobe_csv
index 7af4db7bc0..22a997c55f 100644
--- a/tests/ref/fate/ffprobe_csv
+++ b/tests/ref/fate/ffprobe_csv
@@ -26,7 +26,7 @@ packet,video,1,6144,0.120000,6144,0.120000,2048,0.040000,230400,793142,K_
 frame,video,1,1,6144,0.120000,6144,0.120000,6144,0.120000,2048,0.040000,2048,0.040000,793142,230400,320,240,rgb24,1:1,I,0,0,0,0,0,unknown,unknown,unknown,unknown,unspecified
 packet,video,2,6144,0.120000,6144,0.120000,2048,0.040000,30000,1023566,K_
 frame,video,2,1,6144,0.120000,6144,0.120000,6144,0.120000,2048,0.040000,2048,0.040000,1023566,30000,100,100,rgb24,1:1,I,0,0,0,0,0,unknown,unknown,unknown,unknown,unspecified
-stream,0,pcm_s16le,unknown,audio,PSD[16],0x10445350,s16,44100,1,unknown,16,N/A,0/0,0/0,1/44100,0,0.000000,N/A,N/A,705600,N/A,N/A,N/A,6,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,mc²,Lavc pcm_s16le
+stream,0,pcm_s16le,unknown,audio,PSD[16],0x10445350,s16,44100,1,unknown,16,0,0,N/A,0/0,0/0,1/44100,0,0.000000,N/A,N/A,705600,N/A,N/A,N/A,6,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,mc²,Lavc pcm_s16le
 stream,1,rawvideo,unknown,video,RGB[24],0x18424752,320,240,320,240,0,0,0,1:1,4:3,rgb24,-99,unknown,unknown,unknown,unknown,unspecified,unknown,1,N/A,25/1,25/1,1/51200,0,0.000000,N/A,N/A,N/A,N/A,N/A,N/A,4,4,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,foobar,field-and-tags-conflict-attempt,Lavc rawvideo
 stream,2,rawvideo,unknown,video,RGB[24],0x18424752,100,100,100,100,0,0,0,1:1,1:1,rgb24,-99,unknown,unknown,unknown,unknown,unspecified,unknown,1,N/A,25/1,25/1,1/51200,0,0.000000,N/A,N/A,N/A,N/A,N/A,N/A,4,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,Lavc rawvideo
 format,tests/data/ffprobe-test.nut,3,0,nut,0.000000,0.120000,1053646,70243066,100,ffprobe test file,"'A comment with CSV, XML & JSON special chars': <tag value=""x"">",I ♥ Üñîçød€
diff --git a/tests/ref/fate/ffprobe_default b/tests/ref/fate/ffprobe_default
index f296fc0dc2..6541b8950f 100644
--- a/tests/ref/fate/ffprobe_default
+++ b/tests/ref/fate/ffprobe_default
@@ -574,6 +574,8 @@ sample_rate=44100
 channels=1
 channel_layout=unknown
 bits_per_sample=16
+initial_padding=0
+trailing_padding=0
 id=N/A
 r_frame_rate=0/0
 avg_frame_rate=0/0
diff --git a/tests/ref/fate/ffprobe_flat b/tests/ref/fate/ffprobe_flat
index 655c0fe836..d72166c361 100644
--- a/tests/ref/fate/ffprobe_flat
+++ b/tests/ref/fate/ffprobe_flat
@@ -517,6 +517,8 @@ streams.stream.0.sample_rate="44100"
 streams.stream.0.channels=1
 streams.stream.0.channel_layout="unknown"
 streams.stream.0.bits_per_sample=16
+streams.stream.0.initial_padding=0
+streams.stream.0.trailing_padding=0
 streams.stream.0.id="N/A"
 streams.stream.0.r_frame_rate="0/0"
 streams.stream.0.avg_frame_rate="0/0"
diff --git a/tests/ref/fate/ffprobe_ini b/tests/ref/fate/ffprobe_ini
index 58f508faa6..2c299fc51a 100644
--- a/tests/ref/fate/ffprobe_ini
+++ b/tests/ref/fate/ffprobe_ini
@@ -576,6 +576,8 @@ sample_rate=44100
 channels=1
 channel_layout=unknown
 bits_per_sample=16
+initial_padding=0
+trailing_padding=0
 id=N/A
 r_frame_rate=0/0
 avg_frame_rate=0/0
diff --git a/tests/ref/fate/ffprobe_json b/tests/ref/fate/ffprobe_json
index 2e8b39f126..2e17195e69 100644
--- a/tests/ref/fate/ffprobe_json
+++ b/tests/ref/fate/ffprobe_json
@@ -558,6 +558,8 @@
             "sample_rate": "44100",
             "channels": 1,
             "bits_per_sample": 16,
+            "initial_padding": 0,
+            "trailing_padding": 0,
             "r_frame_rate": "0/0",
             "avg_frame_rate": "0/0",
             "time_base": "1/44100",
diff --git a/tests/ref/fate/ffprobe_xml b/tests/ref/fate/ffprobe_xml
index e5152655b9..0cad5b8842 100644
--- a/tests/ref/fate/ffprobe_xml
+++ b/tests/ref/fate/ffprobe_xml
@@ -32,7 +32,7 @@
     </packets_and_frames>
 
     <streams>
-        <stream index="0" codec_name="pcm_s16le" codec_type="audio" codec_tag_string="PSD[16]" codec_tag="0x10445350" sample_fmt="s16" sample_rate="44100" channels="1" bits_per_sample="16" r_frame_rate="0/0" avg_frame_rate="0/0" time_base="1/44100" start_pts="0" start_time="0.000000" bit_rate="705600" nb_read_frames="6" nb_read_packets="6">
+        <stream index="0" codec_name="pcm_s16le" codec_type="audio" codec_tag_string="PSD[16]" codec_tag="0x10445350" sample_fmt="s16" sample_rate="44100" channels="1" bits_per_sample="16" initial_padding="0" trailing_padding="0" r_frame_rate="0/0" avg_frame_rate="0/0" time_base="1/44100" start_pts="0" start_time="0.000000" bit_rate="705600" nb_read_frames="6" nb_read_packets="6">
             <disposition default="0" dub="0" original="0" comment="0" lyrics="0" karaoke="0" forced="0" hearing_impaired="0" visual_impaired="0" clean_effects="0" attached_pic="0" timed_thumbnails="0" captions="0" descriptions="0" metadata="0" dependent="0" still_image="0"/>
             <tag key="E" value="mc²"/>
             <tag key="encoder" value="Lavc pcm_s16le"/>
diff --git a/tests/ref/fate/flv-demux b/tests/ref/fate/flv-demux
index a7c98d3d76..fc315cec54 100644
--- a/tests/ref/fate/flv-demux
+++ b/tests/ref/fate/flv-demux
@@ -604,5 +604,5 @@ packet|codec_type=video|stream_index=0|pts=11645|pts_time=11.645000|dts=11645|dt
 packet|codec_type=audio|stream_index=1|pts=11656|pts_time=11.656000|dts=11656|dts_time=11.656000|duration=46|duration_time=0.046000|size=346|pos=510431|flags=K_|data_hash=CRC32:4e6b44cb
 packet|codec_type=video|stream_index=0|pts=11678|pts_time=11.678000|dts=11678|dts_time=11.678000|duration=33|duration_time=0.033000|size=1190|pos=510794|flags=__|data_hash=CRC32:a0206c90
 stream|index=0|codec_name=h264|profile=77|codec_type=video|codec_tag_string=[0][0][0][0]|codec_tag=0x0000|width=426|height=240|coded_width=426|coded_height=240|closed_captions=0|film_grain=0|has_b_frames=1|sample_aspect_ratio=1:1|display_aspect_ratio=71:40|pix_fmt=yuv420p|level=21|color_range=unknown|color_space=unknown|color_transfer=unknown|color_primaries=unknown|chroma_location=left|field_order=progressive|refs=1|is_avc=true|nal_length_size=4|id=N/A|r_frame_rate=30000/1001|avg_frame_rate=30/1|time_base=1/1000|start_pts=0|start_time=0.000000|duration_ts=N/A|duration=N/A|bit_rate=393929|max_bit_rate=N/A|bits_per_raw_sample=8|nb_frames=N/A|nb_read_frames=N/A|nb_read_packets=351|extradata_size=39|extradata_hash=CRC32:07b85ca9|disposition:default=0|disposition:dub=0|disposition:original=0|disposition:comment=0|disposition:lyrics=0|disposition:karaoke=0|disposition:forced=0|disposition:hearing_impaired=0|disposition:visual_impaired=0|disposition:clean_effects=0|disposition:attached_pic=0|disposition:timed_thumbnails=0|disposition:captions=0|disposition:descriptions=0|disposition:metadata=0|disposition:dependent=0|disposition:still_image=0
-stream|index=1|codec_name=aac|profile=1|codec_type=audio|codec_tag_string=[0][0][0][0]|codec_tag=0x0000|sample_fmt=fltp|sample_rate=22050|channels=2|channel_layout=stereo|bits_per_sample=0|id=N/A|r_frame_rate=0/0|avg_frame_rate=0/0|time_base=1/1000|start_pts=0|start_time=0.000000|duration_ts=N/A|duration=N/A|bit_rate=67874|max_bit_rate=N/A|bits_per_raw_sample=N/A|nb_frames=N/A|nb_read_frames=N/A|nb_read_packets=252|extradata_size=2|extradata_hash=CRC32:d039c029|disposition:default=0|disposition:dub=0|disposition:original=0|disposition:comment=0|disposition:lyrics=0|disposition:karaoke=0|disposition:forced=0|disposition:hearing_impaired=0|disposition:visual_impaired=0|disposition:clean_effects=0|disposition:attached_pic=0|disposition:timed_thumbnails=0|disposition:captions=0|disposition:descriptions=0|disposition:metadata=0|disposition:dependent=0|disposition:still_image=0
+stream|index=1|codec_name=aac|profile=1|codec_type=audio|codec_tag_string=[0][0][0][0]|codec_tag=0x0000|sample_fmt=fltp|sample_rate=22050|channels=2|channel_layout=stereo|bits_per_sample=0|initial_padding=0|trailing_padding=0|id=N/A|r_frame_rate=0/0|avg_frame_rate=0/0|time_base=1/1000|start_pts=0|start_time=0.000000|duration_ts=N/A|duration=N/A|bit_rate=67874|max_bit_rate=N/A|bits_per_raw_sample=N/A|nb_frames=N/A|nb_read_frames=N/A|nb_read_packets=252|extradata_size=2|extradata_hash=CRC32:d039c029|disposition:default=0|disposition:dub=0|disposition:original=0|disposition:comment=0|disposition:lyrics=0|disposition:karaoke=0|disposition:forced=0|disposition:hearing_impaired=0|disposition:visual_impaired=0|disposition:clean_effects=0|disposition:attached_pic=0|disposition:timed_thumbnails=0|disposition:captions=0|disposition:descriptions=0|disposition:metadata=0|disposition:dependent=0|disposition:still_image=0
 format|filename=Enigma_Principles_of_Lust-part.flv|nb_streams=2|nb_programs=0|format_name=flv|start_time=0.000000|duration=210.209999|size=512000|bit_rate=19485|probe_score=100|tag:hasKeyframes=true|tag:hasMetadata=true|tag:datasize=11970544|tag:hasVideo=true|tag:canSeekToEnd=false|tag:lasttimestamp=210|tag:lastkeyframetimestamp=210|tag:audiosize=1791332|tag:hasAudio=true|tag:audiodelay=0|tag:videosize=10176110|tag:metadatadate=2011-02-27T11:00:33.125000Z|tag:metadatacreator=inlet media FLVTool2 v1.0.6 - http://www.inlet-media.de/flvtool2|tag:hasCuePoints=false
diff --git a/tests/ref/fate/gapless-mp3-side-data b/tests/ref/fate/gapless-mp3-side-data
index 59907f8ca4..6579b980aa 100644
--- a/tests/ref/fate/gapless-mp3-side-data
+++ b/tests/ref/fate/gapless-mp3-side-data
@@ -596,5 +596,5 @@ packet|codec_type=audio|stream_index=0|pts=218603520|pts_time=15.490612|dts=2186
 |data_hash=CRC32:d5fb5f9c
 packet|codec_type=audio|stream_index=0|pts=218972160|pts_time=15.516735|dts=218972160|dts_time=15.516735|duration=368640|duration_time=0.026122|size=418|pos=249718|flags=K_|side_data|side_data_type=Skip Samples|skip_samples=0|discard_padding=1152|skip_reason=0|discard_reason=0
 |data_hash=CRC32:3789f3cf
-stream|index=0|codec_name=mp3|profile=unknown|codec_type=audio|codec_tag_string=[0][0][0][0]|codec_tag=0x0000|sample_fmt=fltp|sample_rate=44100|channels=2|channel_layout=stereo|bits_per_sample=0|id=N/A|r_frame_rate=0/0|avg_frame_rate=0/0|time_base=1/14112000|start_pts=353600|start_time=0.025057|duration_ts=219340800|duration=15.542857|bit_rate=128000|max_bit_rate=N/A|bits_per_raw_sample=N/A|nb_frames=N/A|nb_read_frames=N/A|nb_read_packets=595|disposition:default=0|disposition:dub=0|disposition:original=0|disposition:comment=0|disposition:lyrics=0|disposition:karaoke=0|disposition:forced=0|disposition:hearing_impaired=0|disposition:visual_impaired=0|disposition:clean_effects=0|disposition:attached_pic=0|disposition:timed_thumbnails=0|disposition:captions=0|disposition:descriptions=0|disposition:metadata=0|disposition:dependent=0|disposition:still_image=0|tag:encoder=LAME3.93
+stream|index=0|codec_name=mp3|profile=unknown|codec_type=audio|codec_tag_string=[0][0][0][0]|codec_tag=0x0000|sample_fmt=fltp|sample_rate=44100|channels=2|channel_layout=stereo|bits_per_sample=0|initial_padding=0|trailing_padding=0|id=N/A|r_frame_rate=0/0|avg_frame_rate=0/0|time_base=1/14112000|start_pts=353600|start_time=0.025057|duration_ts=219340800|duration=15.542857|bit_rate=128000|max_bit_rate=N/A|bits_per_raw_sample=N/A|nb_frames=N/A|nb_read_frames=N/A|nb_read_packets=595|disposition:default=0|disposition:dub=0|disposition:original=0|disposition:comment=0|disposition:lyrics=0|disposition:karaoke=0|disposition:forced=0|disposition:hearing_impaired=0|disposition:visual_impaired=0|disposition:clean_effects=0|disposition:attached_pic=0|disposition:timed_thumbnails=0|disposition:captions=0|disposition:descriptions=0|disposition:metadata=0|disposition:dependent=0|disposition:still_image=0|tag:encoder=LAME3.93 
 format|filename=gapless.mp3|nb_streams=1|nb_programs=0|format_name=mp3|start_time=0.025057|duration=15.542857|size=250264|bit_rate=128812|probe_score=51|tag:title=test
diff --git a/tests/ref/fate/mxf-probe-applehdr10 b/tests/ref/fate/mxf-probe-applehdr10
index 90eefad6ad..e0803239ba 100644
--- a/tests/ref/fate/mxf-probe-applehdr10
+++ b/tests/ref/fate/mxf-probe-applehdr10
@@ -86,6 +86,8 @@ sample_rate=48000
 channels=1
 channel_layout=unknown
 bits_per_sample=24
+initial_padding=0
+trailing_padding=0
 id=N/A
 r_frame_rate=0/0
 avg_frame_rate=0/0
@@ -131,6 +133,8 @@ sample_rate=48000
 channels=1
 channel_layout=unknown
 bits_per_sample=24
+initial_padding=0
+trailing_padding=0
 id=N/A
 r_frame_rate=0/0
 avg_frame_rate=0/0
diff --git a/tests/ref/fate/mxf-probe-d10 b/tests/ref/fate/mxf-probe-d10
index b2692c6513..2897a3a821 100644
--- a/tests/ref/fate/mxf-probe-d10
+++ b/tests/ref/fate/mxf-probe-d10
@@ -77,6 +77,8 @@ sample_rate=48000
 channels=8
 channel_layout=unknown
 bits_per_sample=16
+initial_padding=0
+trailing_padding=0
 id=N/A
 r_frame_rate=0/0
 avg_frame_rate=0/0
diff --git a/tests/ref/fate/mxf-probe-dv25 b/tests/ref/fate/mxf-probe-dv25
index 67a510fc5c..7408d4fd60 100644
--- a/tests/ref/fate/mxf-probe-dv25
+++ b/tests/ref/fate/mxf-probe-dv25
@@ -68,6 +68,8 @@ sample_rate=48000
 channels=1
 channel_layout=unknown
 bits_per_sample=16
+initial_padding=0
+trailing_padding=0
 id=N/A
 r_frame_rate=0/0
 avg_frame_rate=0/0
@@ -113,6 +115,8 @@ sample_rate=48000
 channels=1
 channel_layout=unknown
 bits_per_sample=16
+initial_padding=0
+trailing_padding=0
 id=N/A
 r_frame_rate=0/0
 avg_frame_rate=0/0
diff --git a/tests/ref/fate/oggopus-demux b/tests/ref/fate/oggopus-demux
index 7ea5dfe8a0..ce375bc037 100644
--- a/tests/ref/fate/oggopus-demux
+++ b/tests/ref/fate/oggopus-demux
@@ -41,5 +41,5 @@ packet|codec_type=audio|stream_index=0|pts=36124|pts_time=0.752583|dts=36124|dts
 packet|codec_type=audio|stream_index=0|pts=37084|pts_time=0.772583|dts=37084|dts_time=0.772583|duration=960|duration_time=0.020000|size=217|pos=841|flags=K_|data_hash=CRC32:06797ece
 packet|codec_type=audio|stream_index=0|pts=38044|pts_time=0.792583|dts=38044|dts_time=0.792583|duration=356|duration_time=0.007417|size=359|pos=841|flags=K_|side_data|side_data_type=Skip Samples|skip_samples=0|discard_padding=604|skip_reason=0|discard_reason=0
 |data_hash=CRC32:01ca3f8f
-stream|index=0|codec_name=opus|profile=unknown|codec_type=audio|codec_tag_string=[0][0][0][0]|codec_tag=0x0000|sample_fmt=fltp|sample_rate=48000|channels=2|channel_layout=stereo|bits_per_sample=0|id=N/A|r_frame_rate=0/0|avg_frame_rate=0/0|time_base=1/48000|start_pts=0|start_time=0.000000|duration_ts=38756|duration=0.807417|bit_rate=N/A|max_bit_rate=N/A|bits_per_raw_sample=N/A|nb_frames=N/A|nb_read_frames=N/A|nb_read_packets=41|extradata_size=19|extradata_hash=CRC32:58ba5ff3|disposition:default=0|disposition:dub=0|disposition:original=0|disposition:comment=0|disposition:lyrics=0|disposition:karaoke=0|disposition:forced=0|disposition:hearing_impaired=0|disposition:visual_impaired=0|disposition:clean_effects=0|disposition:attached_pic=0|disposition:timed_thumbnails=0|disposition:captions=0|disposition:descriptions=0|disposition:metadata=0|disposition:dependent=0|disposition:still_image=0|tag:ENCODER=opusenc from opus-tools 0.1.9|tag:ENCODER_OPTIONS=--discard-comments
+stream|index=0|codec_name=opus|profile=unknown|codec_type=audio|codec_tag_string=[0][0][0][0]|codec_tag=0x0000|sample_fmt=fltp|sample_rate=48000|channels=2|channel_layout=stereo|bits_per_sample=0|initial_padding=356|trailing_padding=0|id=N/A|r_frame_rate=0/0|avg_frame_rate=0/0|time_base=1/48000|start_pts=0|start_time=0.000000|duration_ts=38756|duration=0.807417|bit_rate=N/A|max_bit_rate=N/A|bits_per_raw_sample=N/A|nb_frames=N/A|nb_read_frames=N/A|nb_read_packets=41|extradata_size=19|extradata_hash=CRC32:58ba5ff3|disposition:default=0|disposition:dub=0|disposition:original=0|disposition:comment=0|disposition:lyrics=0|disposition:karaoke=0|disposition:forced=0|disposition:hearing_impaired=0|disposition:visual_impaired=0|disposition:clean_effects=0|disposition:attached_pic=0|disposition:timed_thumbnails=0|disposition:captions=0|disposition:descriptions=0|disposition:metadata=0|disposition:dependent=0|disposition:still_image=0|tag:ENCODER=opusenc from opus-tools 0.1.9|tag:ENCODER_OPTIONS=--discard-comments
 format|filename=intro-partial.opus|nb_streams=1|nb_programs=0|format_name=ogg|start_time=0.000000|duration=0.807417|size=10250|bit_rate=101558|probe_score=100
diff --git a/tests/ref/fate/ts-demux b/tests/ref/fate/ts-demux
index a90c65ce1c..e6c35a990f 100644
--- a/tests/ref/fate/ts-demux
+++ b/tests/ref/fate/ts-demux
@@ -42,6 +42,6 @@ packet|codec_type=video|stream_index=0|pts=3912686363|pts_time=43474.292922|dts=
 packet|codec_type=audio|stream_index=1|pts=3912644825|pts_time=43473.831389|dts=3912644825|dts_time=43473.831389|duration=2880|duration_time=0.032000|size=906|pos=474888|flags=K_|data_hash=CRC32:0893d398
 packet|codec_type=audio|stream_index=2|pts=3912645580|pts_time=43473.839778|dts=3912645580|dts_time=43473.839778|duration=2880|duration_time=0.032000|size=354|pos=491808|flags=K_|data_hash=CRC32:f5963fa6
 stream|index=0|codec_name=mpeg2video|profile=4|codec_type=video|codec_tag_string=[2][0][0][0]|codec_tag=0x0002|width=1280|height=720|coded_width=0|coded_height=0|closed_captions=0|film_grain=0|has_b_frames=1|sample_aspect_ratio=1:1|display_aspect_ratio=16:9|pix_fmt=yuv420p|level=4|color_range=tv|color_space=unknown|color_transfer=unknown|color_primaries=unknown|chroma_location=left|field_order=progressive|refs=1|id=0x31|r_frame_rate=60000/1001|avg_frame_rate=60000/1001|time_base=1/90000|start_pts=3912669846|start_time=43474.109400|duration_ts=19519|duration=0.216878|bit_rate=15000000|max_bit_rate=N/A|bits_per_raw_sample=N/A|nb_frames=N/A|nb_read_frames=N/A|nb_read_packets=15|extradata_size=150|extradata_hash=CRC32:53134fa8|disposition:default=0|disposition:dub=0|disposition:original=0|disposition:comment=0|disposition:lyrics=0|disposition:karaoke=0|disposition:forced=0|disposition:hearing_impaired=0|disposition:visual_impaired=0|disposition:clean_effects=0|disposition:attached_pic=0|disposition:timed_thumbnails=0|disposition:captions=0|disposition:descriptions=0|disposition:metadata=0|disposition:dependent=0|disposition:still_image=0|side_data|side_data_type=CPB properties|max_bitrate=15000000|min_bitrate=0|avg_bitrate=0|buffer_size=9781248|vbv_delay=-1
-stream|index=1|codec_name=ac3|profile=unknown|codec_type=audio|codec_tag_string=[4][0][0][0]|codec_tag=0x0004|sample_fmt=fltp|sample_rate=48000|channels=6|channel_layout=5.1(side)|bits_per_sample=0|id=0x34|r_frame_rate=0/0|avg_frame_rate=0/0|time_base=1/90000|start_pts=3912633305|start_time=43473.703389|duration_ts=14400|duration=0.160000|bit_rate=384000|max_bit_rate=N/A|bits_per_raw_sample=N/A|nb_frames=N/A|nb_read_frames=N/A|nb_read_packets=5|disposition:default=0|disposition:dub=0|disposition:original=0|disposition:comment=0|disposition:lyrics=0|disposition:karaoke=0|disposition:forced=0|disposition:hearing_impaired=0|disposition:visual_impaired=0|disposition:clean_effects=0|disposition:attached_pic=0|disposition:timed_thumbnails=0|disposition:captions=0|disposition:descriptions=0|disposition:metadata=0|disposition:dependent=0|disposition:still_image=0|tag:language=eng
-stream|index=2|codec_name=ac3|profile=unknown|codec_type=audio|codec_tag_string=[4][0][0][0]|codec_tag=0x0004|sample_fmt=fltp|sample_rate=48000|channels=2|channel_layout=stereo|bits_per_sample=0|id=0x35|r_frame_rate=0/0|avg_frame_rate=0/0|time_base=1/90000|start_pts=3912634060|start_time=43473.711778|duration_ts=14400|duration=0.160000|bit_rate=192000|max_bit_rate=N/A|bits_per_raw_sample=N/A|nb_frames=N/A|nb_read_frames=N/A|nb_read_packets=5|disposition:default=0|disposition:dub=0|disposition:original=0|disposition:comment=0|disposition:lyrics=0|disposition:karaoke=0|disposition:forced=0|disposition:hearing_impaired=0|disposition:visual_impaired=0|disposition:clean_effects=0|disposition:attached_pic=0|disposition:timed_thumbnails=0|disposition:captions=0|disposition:descriptions=0|disposition:metadata=0|disposition:dependent=0|disposition:still_image=0|tag:language=es
+stream|index=1|codec_name=ac3|profile=unknown|codec_type=audio|codec_tag_string=[4][0][0][0]|codec_tag=0x0004|sample_fmt=fltp|sample_rate=48000|channels=6|channel_layout=5.1(side)|bits_per_sample=0|initial_padding=0|trailing_padding=0|id=0x34|r_frame_rate=0/0|avg_frame_rate=0/0|time_base=1/90000|start_pts=3912633305|start_time=43473.703389|duration_ts=14400|duration=0.160000|bit_rate=384000|max_bit_rate=N/A|bits_per_raw_sample=N/A|nb_frames=N/A|nb_read_frames=N/A|nb_read_packets=5|disposition:default=0|disposition:dub=0|disposition:original=0|disposition:comment=0|disposition:lyrics=0|disposition:karaoke=0|disposition:forced=0|disposition:hearing_impaired=0|disposition:visual_impaired=0|disposition:clean_effects=0|disposition:attached_pic=0|disposition:timed_thumbnails=0|disposition:captions=0|disposition:descriptions=0|disposition:metadata=0|disposition:dependent=0|disposition:still_image=0|tag:language=eng
+stream|index=2|codec_name=ac3|profile=unknown|codec_type=audio|codec_tag_string=[4][0][0][0]|codec_tag=0x0004|sample_fmt=fltp|sample_rate=48000|channels=2|channel_layout=stereo|bits_per_sample=0|initial_padding=0|trailing_padding=0|id=0x35|r_frame_rate=0/0|avg_frame_rate=0/0|time_base=1/90000|start_pts=3912634060|start_time=43473.711778|duration_ts=14400|duration=0.160000|bit_rate=192000|max_bit_rate=N/A|bits_per_raw_sample=N/A|nb_frames=N/A|nb_read_frames=N/A|nb_read_packets=5|disposition:default=0|disposition:dub=0|disposition:original=0|disposition:comment=0|disposition:lyrics=0|disposition:karaoke=0|disposition:forced=0|disposition:hearing_impaired=0|disposition:visual_impaired=0|disposition:clean_effects=0|disposition:attached_pic=0|disposition:timed_thumbnails=0|disposition:captions=0|disposition:descriptions=0|disposition:metadata=0|disposition:dependent=0|disposition:still_image=0|tag:language=es
 format|filename=mp3ac325-4864-small.ts|nb_streams=3|nb_programs=1|format_name=mpegts|start_time=43473.703389|duration=0.622889|size=512000|bit_rate=6575810|probe_score=50
diff --git a/tests/ref/fate/ts-opus-demux b/tests/ref/fate/ts-opus-demux
index ba6059a019..193d94889a 100644
--- a/tests/ref/fate/ts-opus-demux
+++ b/tests/ref/fate/ts-opus-demux
@@ -1022,5 +1022,5 @@ packet|codec_type=audio|stream_index=0|pts=918000|pts_time=10.200000|dts=918000|
 |data_hash=CRC32:75113c11
 packet|codec_type=audio|stream_index=0|pts=919800|pts_time=10.220000|dts=919800|dts_time=10.220000|duration=1800|duration_time=0.020000|size=759|pos=510984|flags=K_|side_data|side_data_type=MPEGTS Stream ID|id=189
 |data_hash=CRC32:59fc266f
-stream|index=0|codec_name=opus|profile=unknown|codec_type=audio|codec_tag_string=Opus|codec_tag=0x7375704f|sample_fmt=fltp|sample_rate=48000|channels=8|channel_layout=7.1|bits_per_sample=0|id=0x44|r_frame_rate=0/0|avg_frame_rate=0/0|time_base=1/90000|start_pts=0|start_time=0.000000|duration_ts=919800|duration=10.220000|bit_rate=N/A|max_bit_rate=N/A|bits_per_raw_sample=N/A|nb_frames=N/A|nb_read_frames=N/A|nb_read_packets=512|extradata_size=29|extradata_hash=CRC32:6d6089a7|disposition:default=0|disposition:dub=0|disposition:original=0|disposition:comment=0|disposition:lyrics=0|disposition:karaoke=0|disposition:forced=0|disposition:hearing_impaired=0|disposition:visual_impaired=0|disposition:clean_effects=0|disposition:attached_pic=0|disposition:timed_thumbnails=0|disposition:captions=0|disposition:descriptions=0|disposition:metadata=0|disposition:dependent=0|disposition:still_image=0
+stream|index=0|codec_name=opus|profile=unknown|codec_type=audio|codec_tag_string=Opus|codec_tag=0x7375704f|sample_fmt=fltp|sample_rate=48000|channels=8|channel_layout=7.1|bits_per_sample=0|initial_padding=0|trailing_padding=0|id=0x44|r_frame_rate=0/0|avg_frame_rate=0/0|time_base=1/90000|start_pts=0|start_time=0.000000|duration_ts=919800|duration=10.220000|bit_rate=N/A|max_bit_rate=N/A|bits_per_raw_sample=N/A|nb_frames=N/A|nb_read_frames=N/A|nb_read_packets=512|extradata_size=29|extradata_hash=CRC32:6d6089a7|disposition:default=0|disposition:dub=0|disposition:original=0|disposition:comment=0|disposition:lyrics=0|disposition:karaoke=0|disposition:forced=0|disposition:hearing_impaired=0|disposition:visual_impaired=0|disposition:clean_effects=0|disposition:attached_pic=0|disposition:timed_thumbnails=0|disposition:captions=0|disposition:descriptions=0|disposition:metadata=0|disposition:dependent=0|disposition:still_image=0
 format|filename=test-8-7.1.opus-small.ts|nb_streams=1|nb_programs=1|format_name=mpegts|start_time=0.000000|duration=10.220000|size=512000|bit_rate=400782|probe_score=50
-- 
2.34.1

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

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

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [FFmpeg-devel] [PATCH 2/8] fate/matroska: Add tests for muxing with initial_padding
  2022-09-01 20:38 [FFmpeg-devel] [PATCH 1/8] fftools/ffprobe: Report initial and trailing padding Andreas Rheinhardt
@ 2022-09-01 21:23 ` Andreas Rheinhardt
  2022-09-01 21:23 ` [FFmpeg-devel] [PATCH 3/8] avformat/matroskaenc: Only write DiscardPadding if nonzero Andreas Rheinhardt
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 11+ messages in thread
From: Andreas Rheinhardt @ 2022-09-01 21:23 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: Andreas Rheinhardt

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
 tests/fate/matroska.mak                |  19 +++++
 tests/ref/fate/matroska-encoding-delay |  85 ++++++++++++++++++++
 tests/ref/fate/matroska-ogg-opus-remux |  92 ++++++++++++++++++++++
 tests/ref/fate/matroska-opus-remux     | 103 +++++++++++++++++++++++++
 4 files changed, 299 insertions(+)
 create mode 100644 tests/ref/fate/matroska-encoding-delay
 create mode 100644 tests/ref/fate/matroska-ogg-opus-remux
 create mode 100644 tests/ref/fate/matroska-opus-remux

diff --git a/tests/fate/matroska.mak b/tests/fate/matroska.mak
index b49ec761cf..94532b31dc 100644
--- a/tests/fate/matroska.mak
+++ b/tests/fate/matroska.mak
@@ -163,6 +163,25 @@ FATE_MATROSKA_FFMPEG_FFPROBE-$(call REMUX, MATROSKA, MPEGTS_DEMUXER AC3_DECODER)
                                += fate-matroska-mpegts-remux
 fate-matroska-mpegts-remux: CMD = transcode mpegts $(TARGET_SAMPLES)/mpegts/pmtchange.ts matroska "-map 0:2 -map 0:2 -c copy -disposition:a:1 -visual_impaired+hearing_impaired -default_mode infer" "-map 0 -c copy" "-show_entries stream_disposition:stream=index"
 
+# Tests maintaining codec delay while remuxing from Matroska.
+# For some reason, ffmpeg shifts the timestamps of the input file
+# to make them zero before reaching the muxer while it does not
+# for the ogg-opus-remux test.
+FATE_MATROSKA_FFMPEG_FFPROBE-$(call REMUX, MATROSKA, OPUS_PARSER OPUS_DECODER) += fate-matroska-opus-remux
+fate-matroska-opus-remux: CMD = transcode matroska $(TARGET_SAMPLES)/mkv/codec_delay_opus.mkv matroska "-avoid_negative_ts make_zero -c copy" "-copyts -c copy" "-show_packets -show_entries stream=codec_name,initial_padding -read_intervals %0.05"
+
+# Tests maintaining codec delay while remuxing from ogg.
+FATE_MATROSKA_FFMPEG_FFPROBE-$(call REMUX, MATROSKA, OGG_DEMUXER OPUS_PARSER OPUS_DECODER) += fate-matroska-ogg-opus-remux
+fate-matroska-ogg-opus-remux: CMD = transcode ogg $(TARGET_SAMPLES)/ogg/intro-partial.opus matroska "-c copy" "-copyts -c copy" "-show_packets -show_entries stream=codec_name,initial_padding -read_intervals %0.05"
+
+# This tests reencoding with an audio encoder that adds initial padding.
+# The initial padding is currently not maintained.
+FATE_MATROSKA_FFMPEG_FFPROBE-$(call REMUX, MATROSKA, MXF_DEMUXER PCM_S16LE_DECODER \
+                                           MP2FIXED_ENCODER ARESAMPLE_FILTER       \
+                                           MPEG2VIDEO_DECODER MPEGVIDEO_PARSER     \
+                                           EXTRACT_EXTRADATA_BSF) += fate-matroska-encoding-delay
+fate-matroska-encoding-delay: CMD = transcode mxf $(TARGET_SAMPLES)/mxf/Sony-00001.mxf matroska "-c:v copy -af aresample -c:a mp2fixed" "-copyts -c copy" "-show_packets -show_entries stream=codec_name,initial_padding -read_intervals %0.05"
+
 FATE_MATROSKA-$(call REMUX, MATROSKA, SUP_DEMUXER) += fate-matroska-pgs-remux
 fate-matroska-pgs-remux: CMD = transcode sup $(TARGET_SAMPLES)/sub/pgs_sub.sup matroska "-copyts -c:s copy" "-copyts -c:s copy"
 
diff --git a/tests/ref/fate/matroska-encoding-delay b/tests/ref/fate/matroska-encoding-delay
new file mode 100644
index 0000000000..fb7909fe29
--- /dev/null
+++ b/tests/ref/fate/matroska-encoding-delay
@@ -0,0 +1,85 @@
+df0524cac5393212ee103c1d1221f4b3 *tests/data/fate/matroska-encoding-delay.matroska
+961215 tests/data/fate/matroska-encoding-delay.matroska
+#extradata 0:       22, 0x32ea0490
+#tb 0: 1/1000
+#media_type 0: video
+#codec_id 0: mpeg2video
+#dimensions 0: 720x608
+#sar 0: 152/135
+#tb 1: 1/1000
+#media_type 1: audio
+#codec_id 1: mp2
+#sample_rate 1: 48000
+#channel_layout_name 1: stereo
+1,          0,          0,       24,     1152, 0x724077b8
+0,         10,         10,       40,   237628, 0xeff25579, S=1,       40
+1,         24,         24,       24,     1152, 0x80625572
+1,         48,         48,       24,     1152, 0x7d7f4dce
+0,         50,         50,       40,   238066, 0xb2265f41
+1,         72,         72,       24,     1152, 0xa6725739
+0,         90,         90,       40,   237723, 0x00d7cd24
+1,         96,         96,       24,     1152, 0xc9e85398
+1,        120,        120,       24,     1152, 0xda1287d3
+0,        130,        130,       40,   238290, 0xbe18b18f
+1,        144,        144,       24,     1152, 0x1c9a6102
+[PACKET]
+codec_type=audio
+stream_index=1
+pts=0
+pts_time=0.000000
+dts=0
+dts_time=0.000000
+duration=24
+duration_time=0.024000
+size=1152
+pos=1232
+flags=K_
+[/PACKET]
+[PACKET]
+codec_type=video
+stream_index=0
+pts=10
+pts_time=0.010000
+dts=10
+dts_time=0.010000
+duration=40
+duration_time=0.040000
+size=237628
+pos=2392
+flags=K_
+[/PACKET]
+[PACKET]
+codec_type=audio
+stream_index=1
+pts=24
+pts_time=0.024000
+dts=24
+dts_time=0.024000
+duration=24
+duration_time=0.024000
+size=1152
+pos=240027
+flags=K_
+[/PACKET]
+[PACKET]
+codec_type=audio
+stream_index=1
+pts=48
+pts_time=0.048000
+dts=48
+dts_time=0.048000
+duration=24
+duration_time=0.024000
+size=1152
+pos=241202
+flags=K_
+[/PACKET]
+[STREAM]
+codec_name=mpeg2video
+[SIDE_DATA]
+[/SIDE_DATA]
+[/STREAM]
+[STREAM]
+codec_name=mp2
+initial_padding=0
+[/STREAM]
diff --git a/tests/ref/fate/matroska-ogg-opus-remux b/tests/ref/fate/matroska-ogg-opus-remux
new file mode 100644
index 0000000000..b69c29df8e
--- /dev/null
+++ b/tests/ref/fate/matroska-ogg-opus-remux
@@ -0,0 +1,92 @@
+605e8e89efb3028e261dd10255c7f59a *tests/data/fate/matroska-ogg-opus-remux.matroska
+10207 tests/data/fate/matroska-ogg-opus-remux.matroska
+#extradata 0:       19, 0x399c0471
+#tb 0: 1/1000
+#media_type 0: audio
+#codec_id 0: opus
+#sample_rate 0: 48000
+#channel_layout_name 0: stereo
+0,         -7,         -7,       20,      402, 0x89b1c40f
+0,         13,         13,       20,      216, 0x7bf97146
+0,         33,         33,       20,      215, 0x6cb86d8b
+0,         53,         53,       20,      218, 0x9cfd691c
+0,         73,         73,       20,      218, 0xd7fe6a94
+0,         93,         93,       20,      194, 0x35735de6
+0,        113,        113,       20,      216, 0x3ee6705a
+0,        133,        133,       20,      218, 0x67eb6cb1
+0,        153,        153,       20,      218, 0x32d0700d
+0,        173,        173,       20,      219, 0xcb7f6c60
+0,        193,        193,       20,      218, 0x9c866b33
+0,        213,        213,       20,      217, 0xfe3e6a53
+0,        233,        233,       20,      218, 0x13586833
+0,        253,        253,       20,      222, 0xbcb2669e
+0,        273,        273,       20,      218, 0x8dfc6e33
+0,        293,        293,       20,      217, 0xf5957051
+0,        313,        313,       20,      210, 0xed126e6b
+0,        333,        333,       20,      216, 0xbf947249
+0,        353,        353,       20,      203, 0x6c7e680a
+0,        373,        373,       20,      209, 0xf78f6af4
+0,        393,        393,       20,      217, 0xd60c684d
+0,        413,        413,       20,      218, 0x89056a7a
+0,        433,        433,       20,      219, 0x0bc674ad
+0,        453,        453,       20,      217, 0xb1d86d1a
+0,        473,        473,       20,      220, 0x433d685a
+0,        493,        493,       20,      364, 0x0c88be84
+0,        513,        513,       20,      221, 0x804a733d
+0,        533,        533,       20,      215, 0x6e9d6e9b
+0,        553,        553,       20,      215, 0x63016a83
+0,        573,        573,       20,      218, 0xf9a46fbe
+0,        593,        593,       20,      216, 0xa0d66c08
+0,        613,        613,       20,      216, 0xa2ca6d0a
+0,        633,        633,       20,      216, 0xf50e6f1d
+0,        653,        653,       20,      215, 0x6aaa70b6
+0,        673,        673,       20,      219, 0x7ceb6ba0
+0,        693,        693,       20,      220, 0x398d6ca9
+0,        713,        713,       20,      218, 0x7bd06ed5
+0,        733,        733,       20,      219, 0xe2906c62
+0,        753,        753,       20,      217, 0xcf316ba1
+0,        773,        773,       20,      217, 0x470b6eea
+0,        793,        793,       20,      359, 0x36c2a18a, S=1,       10
+[PACKET]
+codec_type=audio
+stream_index=0
+pts=-7
+pts_time=-0.007000
+dts=-7
+dts_time=-0.007000
+duration=20
+duration_time=0.020000
+size=402
+pos=543
+flags=K_
+[/PACKET]
+[PACKET]
+codec_type=audio
+stream_index=0
+pts=13
+pts_time=0.013000
+dts=13
+dts_time=0.013000
+duration=20
+duration_time=0.020000
+size=216
+pos=956
+flags=K_
+[/PACKET]
+[PACKET]
+codec_type=audio
+stream_index=0
+pts=33
+pts_time=0.033000
+dts=33
+dts_time=0.033000
+duration=20
+duration_time=0.020000
+size=215
+pos=1179
+flags=K_
+[/PACKET]
+[STREAM]
+codec_name=opus
+initial_padding=356
+[/STREAM]
diff --git a/tests/ref/fate/matroska-opus-remux b/tests/ref/fate/matroska-opus-remux
new file mode 100644
index 0000000000..61afeaa751
--- /dev/null
+++ b/tests/ref/fate/matroska-opus-remux
@@ -0,0 +1,103 @@
+551e45142f0989b281e837a3a86f0218 *tests/data/fate/matroska-opus-remux.matroska
+9355 tests/data/fate/matroska-opus-remux.matroska
+#extradata 0:       19, 0x3a04048f
+#tb 0: 1/1000
+#media_type 0: audio
+#codec_id 0: opus
+#sample_rate 0: 48000
+#channel_layout_name 0: mono
+0,         -7,         -7,       20,      320, 0x58b9a88d
+0,         14,         14,       20,      159, 0x6c9c4b4c
+0,         34,         34,       20,      148, 0x0caf4b5d
+0,         54,         54,       20,      139, 0xc5624226
+0,         74,         74,       20,      146, 0x633c4937
+0,         94,         94,       20,      153, 0x3d0b4f93
+0,        114,        114,       20,      158, 0xe5c55641
+0,        134,        134,       20,      156, 0xf2fd50ef
+0,        154,        154,       20,      158, 0x93b15410
+0,        174,        174,       20,      157, 0xb6f74f5f
+0,        194,        194,       20,      159, 0x9aff4957
+0,        214,        214,       20,      153, 0xfc5f4aba
+0,        234,        234,       20,      158, 0x01e44f70
+0,        254,        254,       20,      153, 0x227149cf
+0,        274,        274,       20,      155, 0x312f4cf6
+0,        294,        294,       20,      155, 0xafc54bae
+0,        314,        314,       20,      151, 0x7b4252b3
+0,        334,        334,       20,      155, 0x29074a75
+0,        354,        354,       20,      149, 0x82c44bcd
+0,        374,        374,       20,      150, 0x55c24eb5
+0,        394,        394,       20,      156, 0xf71d4f33
+0,        414,        414,       20,      153, 0x9b6c4ae5
+0,        434,        434,       20,      156, 0x75954e51
+0,        454,        454,       20,      155, 0x28ff4ff3
+0,        474,        474,       20,      153, 0xc4424969
+0,        494,        494,       20,      154, 0xfbf94cc8
+0,        514,        514,       20,      155, 0x52c549af
+0,        534,        534,       20,      150, 0x6f1e4b7a
+0,        554,        554,       20,      158, 0xabb45566
+0,        574,        574,       20,      157, 0xe61d4a99
+0,        594,        594,       20,      159, 0xf45d4fac
+0,        614,        614,       20,      159, 0xcd0553a5
+0,        634,        634,       20,      156, 0xdb244e63
+0,        654,        654,       20,      154, 0x78654c52
+0,        674,        674,       20,      154, 0x9f804cc8
+0,        694,        694,       20,      150, 0x1fdf4c80
+0,        714,        714,       20,      155, 0x1adc4f89
+0,        734,        734,       20,      155, 0x4b53511c
+0,        754,        754,       20,      151, 0x8ff2546d
+0,        774,        774,       20,      158, 0xb7e34f1b
+0,        794,        794,       20,      154, 0x4d98474b
+0,        814,        814,       20,      154, 0x14924ea8
+0,        834,        834,       20,      153, 0x8d4752bf
+0,        854,        854,       20,      149, 0x74785066
+0,        874,        874,       20,      151, 0x36c94a4c
+0,        894,        894,       20,      155, 0x82904f3b
+0,        914,        914,       20,      154, 0xd76b4a45
+0,        934,        934,       20,      159, 0x9fec548d
+0,        954,        954,       20,      154, 0x9a084dcd
+0,        974,        974,       20,      155, 0x90a54ac8
+0,        994,        994,       20,      324, 0x8e34a2f5
+0,       1014,       1014,       20,      268, 0x10f37203, S=1,       10
+[PACKET]
+codec_type=audio
+stream_index=0
+pts=-7
+pts_time=-0.007000
+dts=-7
+dts_time=-0.007000
+duration=20
+duration_time=0.020000
+size=320
+pos=496
+flags=K_
+[/PACKET]
+[PACKET]
+codec_type=audio
+stream_index=0
+pts=14
+pts_time=0.014000
+dts=14
+dts_time=0.014000
+duration=20
+duration_time=0.020000
+size=159
+pos=823
+flags=K_
+[/PACKET]
+[PACKET]
+codec_type=audio
+stream_index=0
+pts=34
+pts_time=0.034000
+dts=34
+dts_time=0.034000
+duration=20
+duration_time=0.020000
+size=148
+pos=989
+flags=K_
+[/PACKET]
+[STREAM]
+codec_name=opus
+initial_padding=312
+[/STREAM]
-- 
2.34.1

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

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

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [FFmpeg-devel] [PATCH 3/8] avformat/matroskaenc: Only write DiscardPadding if nonzero
  2022-09-01 20:38 [FFmpeg-devel] [PATCH 1/8] fftools/ffprobe: Report initial and trailing padding Andreas Rheinhardt
  2022-09-01 21:23 ` [FFmpeg-devel] [PATCH 2/8] fate/matroska: Add tests for muxing with initial_padding Andreas Rheinhardt
@ 2022-09-01 21:23 ` Andreas Rheinhardt
  2022-09-01 21:23 ` [FFmpeg-devel] [PATCH 4/8] avformat/matroskaenc: Don't override samplerate for CodecDelay Andreas Rheinhardt
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 11+ messages in thread
From: Andreas Rheinhardt @ 2022-09-01 21:23 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: Andreas Rheinhardt

It is possible for the trailing padding to be zero, namely
e.g. if the AV_PKT_DATA_SKIP_SAMPLES side data is used
for leading padding. Matroska supports this (use a negative
DiscardPadding), but players do not; at least Firefox refuses
to play such a file. So for now only write DiscardPadding
if it is trailing padding and nonzero.
The fate-matroska-ogg-opus-remux was affected by this.

(I wish CodecDelay would not exist and DiscardPadding would
be used to instead trim the codec delay away (with the Block
timestamp corresponding to the time at which the actually
output audio is output).)

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
 libavformat/matroskaenc.c              | 12 +++++++-----
 tests/ref/fate/matroska-ogg-opus-remux | 10 +++++-----
 2 files changed, 12 insertions(+), 10 deletions(-)

diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
index 1256bdfe36..de6c993e6a 100644
--- a/libavformat/matroskaenc.c
+++ b/libavformat/matroskaenc.c
@@ -2591,7 +2591,6 @@ static int mkv_write_block(void *logctx, MatroskaMuxContext *mkv,
     uint8_t *side_data;
     size_t side_data_size;
     uint64_t additional_id;
-    int64_t discard_padding = 0;
     unsigned track_number = track->track_num;
     EBML_WRITER(9);
 
@@ -2619,10 +2618,13 @@ static int mkv_write_block(void *logctx, MatroskaMuxContext *mkv,
                                         AV_PKT_DATA_SKIP_SAMPLES,
                                         &side_data_size);
     if (side_data && side_data_size >= 10) {
-        discard_padding = av_rescale_q(AV_RL32(side_data + 4),
-                                       (AVRational){1, par->sample_rate},
-                                       (AVRational){1, 1000000000});
-        ebml_writer_add_sint(&writer, MATROSKA_ID_DISCARDPADDING, discard_padding);
+        int64_t discard_padding = AV_RL32(side_data + 4);
+        if (discard_padding) {
+            discard_padding = av_rescale_q(discard_padding,
+                                           (AVRational){1, par->sample_rate},
+                                           (AVRational){1, 1000000000});
+            ebml_writer_add_sint(&writer, MATROSKA_ID_DISCARDPADDING, discard_padding);
+        }
     }
 
     side_data = av_packet_get_side_data(pkt,
diff --git a/tests/ref/fate/matroska-ogg-opus-remux b/tests/ref/fate/matroska-ogg-opus-remux
index b69c29df8e..1fa776ef01 100644
--- a/tests/ref/fate/matroska-ogg-opus-remux
+++ b/tests/ref/fate/matroska-ogg-opus-remux
@@ -1,5 +1,5 @@
-605e8e89efb3028e261dd10255c7f59a *tests/data/fate/matroska-ogg-opus-remux.matroska
-10207 tests/data/fate/matroska-ogg-opus-remux.matroska
+a3f98769fe55bc5234cf75fb1949749a *tests/data/fate/matroska-ogg-opus-remux.matroska
+10200 tests/data/fate/matroska-ogg-opus-remux.matroska
 #extradata 0:       19, 0x399c0471
 #tb 0: 1/1000
 #media_type 0: audio
@@ -57,7 +57,7 @@ dts_time=-0.007000
 duration=20
 duration_time=0.020000
 size=402
-pos=543
+pos=540
 flags=K_
 [/PACKET]
 [PACKET]
@@ -70,7 +70,7 @@ dts_time=0.013000
 duration=20
 duration_time=0.020000
 size=216
-pos=956
+pos=949
 flags=K_
 [/PACKET]
 [PACKET]
@@ -83,7 +83,7 @@ dts_time=0.033000
 duration=20
 duration_time=0.020000
 size=215
-pos=1179
+pos=1172
 flags=K_
 [/PACKET]
 [STREAM]
-- 
2.34.1

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

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

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [FFmpeg-devel] [PATCH 4/8] avformat/matroskaenc: Don't override samplerate for CodecDelay
  2022-09-01 20:38 [FFmpeg-devel] [PATCH 1/8] fftools/ffprobe: Report initial and trailing padding Andreas Rheinhardt
  2022-09-01 21:23 ` [FFmpeg-devel] [PATCH 2/8] fate/matroska: Add tests for muxing with initial_padding Andreas Rheinhardt
  2022-09-01 21:23 ` [FFmpeg-devel] [PATCH 3/8] avformat/matroskaenc: Only write DiscardPadding if nonzero Andreas Rheinhardt
@ 2022-09-01 21:23 ` Andreas Rheinhardt
  2022-09-01 21:24 ` [FFmpeg-devel] [PATCH 5/8] avformat/matroskaenc: Actually apply timestamp offset for Opus Andreas Rheinhardt
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 11+ messages in thread
From: Andreas Rheinhardt @ 2022-09-01 21:23 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: Andreas Rheinhardt

Opus can be decoded to multiple samplerates (namely 48kHz, 24KHz,
16Khz, 12 KHz and 8Khz); libopus as well as our encoder wrapper
support these sample rates. The OpusHead contains a field for
this original samplerate. Yet the pre-skip (and the granule-position
in the Ogg-Opus mapping in general) are always in the 48KHz clock,
irrespective of the original sample rate.

Before commit c3c22bee6362737cf290929b7f31df9fb88da983, our libopus
encoder was buggy: It did not account for the fact that the pre-skip
field is always according to a 48kHz clock and wrote a too small
value in case one uses the encoder with a sample rate other than 48kHz;
this discrepancy between CodecDelay and OpusHead led to Firefox
rejecting such streams.

In order to account for that, said commit made the muxer always use
48kHz instead of the actual sample rate to convert the initial_padding
(in samples in the stream's sample rate) to ns. This meant that both
fields are now off by the same factor, so Firefox was happy.

Then commit f4bdeddc3cab807e43e0450744dfe9a45661e1d7 fixed the issue
in libopusenc; so the OpusHead is correct, but the CodecDelay is
still off*. This commit fixes this by effectively reverting
c3c22bee6362737cf290929b7f31df9fb88da983.

*: Firefox seems to no longer abort when CodecDelay and OpusHead
are off.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
Non-48kHz Opus is also weird in the demuxer: avformat_find_stream_info()
sets the samplerate to 48kHz. Therefore 49b0246635 calculated
initial_padding based upon 48kHz for Opus, regardless of the actual
sample rate indicated in the TrackEntry. This is wrong if
avformat_find_stream_info() is not used. I think a better (but still
hacky) solution would be to just report the sample rate as 48kHz
for Opus regardless of what the header says.

(Trying to pass initial padding through the decoder is problematic:
The corresponding field of AVCodecContext is unused for decoding,
instead there is a delay field which is always set by libavcodec
whose semantics are unclear (there are two inconsistent definitions:
"Number of frames delay in addition to what a standard decoder
as specified in the spec would produce." and "the number of samples
the decoder needs to output before the decoder's output is valid".
The Opus decoders and parser are the only components that set delay
at all (based upon OpusHead). When converting
AVCodecParameters->AVCodecContext, initial_padding is mapped to both
delay and initial_padding; in the other direction, initial_padding
is taken from initial_padding (which is encoder-only). If one wants
to pass this value through the decoder, then the best way to do so
is probably to use initial_padding for decoding, too, and let the
user set it and let lavc update it if the decoder encounters
information about this in the bitstream/extradata. This includes
that lavc updates initial_padding if it changes the sample rate
(as it does for Opus). This would also fix delay (the second definition
would be deprecated).)


 libavformat/matroskaenc.c | 2 +-
 libavformat/version.h     | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
index de6c993e6a..c525edb39f 100644
--- a/libavformat/matroskaenc.c
+++ b/libavformat/matroskaenc.c
@@ -1830,7 +1830,7 @@ static int mkv_write_track(AVFormatContext *s, MatroskaMuxContext *mkv,
     case AVMEDIA_TYPE_AUDIO:
         if (par->initial_padding && par->codec_id == AV_CODEC_ID_OPUS) {
             int64_t codecdelay = av_rescale_q(par->initial_padding,
-                                              (AVRational){ 1, 48000 },
+                                              (AVRational){ 1, par->sample_rate },
                                               (AVRational){ 1, 1000000000 });
             if (codecdelay < 0) {
                 av_log(s, AV_LOG_ERROR, "Initial padding is invalid\n");
diff --git a/libavformat/version.h b/libavformat/version.h
index 7b414039ad..a54ffd6c0e 100644
--- a/libavformat/version.h
+++ b/libavformat/version.h
@@ -32,7 +32,7 @@
 #include "version_major.h"
 
 #define LIBAVFORMAT_VERSION_MINOR  30
-#define LIBAVFORMAT_VERSION_MICRO 100
+#define LIBAVFORMAT_VERSION_MICRO 101
 
 #define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \
                                                LIBAVFORMAT_VERSION_MINOR, \
-- 
2.34.1

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

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

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [FFmpeg-devel] [PATCH 5/8] avformat/matroskaenc: Actually apply timestamp offset for Opus
  2022-09-01 20:38 [FFmpeg-devel] [PATCH 1/8] fftools/ffprobe: Report initial and trailing padding Andreas Rheinhardt
                   ` (2 preceding siblings ...)
  2022-09-01 21:23 ` [FFmpeg-devel] [PATCH 4/8] avformat/matroskaenc: Don't override samplerate for CodecDelay Andreas Rheinhardt
@ 2022-09-01 21:24 ` Andreas Rheinhardt
  2022-09-01 21:24 ` [FFmpeg-devel] [PATCH 6/8] avformat/mux: Allow muxers to set custom min timestamp Andreas Rheinhardt
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 11+ messages in thread
From: Andreas Rheinhardt @ 2022-09-01 21:24 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: Andreas Rheinhardt

Matroska generally requires timestamps to be nonnegative, but
there is an exception: Data that corresponds to encoder delay
and is not supposed to be output anyway can have a negative
timestamp. This is achieved by using the CodecDelay header
field: The demuxer has to subtract this value from the raw
(nonnegative) timestamps of the corresponding track.
Therefore the muxer has to add this value first to write
this raw timestamp.

Support for writing CodecDelay has been added in FFmpeg commit
d92b1b1babe69268971863649c225e1747358a74 and in Libav commit
a1aa37dd0b96710d4a17718198a3f56aea2040c1. The former simply
wrote the header field and did not apply any timestamp offsets,
leading to desynchronisation (if one uses multiple tracks).
The latter applied it at two places, but not at the one where
it actually matters, namely in mkv_write_block(), leading to
the same desynchronisation as with the former commit. It furthermore
used the wrong stream timebase to convert the delay to the
stream's timebase, as the conversion used the timebase from
before avpriv_set_pts_info().

When the latter was merged in 82e4f39883932c1b1e5c7792a1be12dec6ab603d,
it was only done in a deactivated state that still did not
offset the timestamps when muxing due to "assertion failures
and av sync errors". a1aa37dd0b96710d4a17718198a3f56aea2040c1
made it definitely more likely to run into assertion failures
(namely if the relative block timestamp doesn't fit into an int16_t).

Yet all of the above issues have been fixed (in commits
962d63157322466a9a82f9f9d84c1b6f1b582f65,
5d3953a5dcfd5f71391b7f34908517eb6f7e5146 and
4ebeab15b037a21f195696cef1f7522daf42f3ee. This commit therefore
enables applying CodecDelay, fixing ticket #7182.

There is just one slight regression from this: If one has input
with encoder delay where the first timestamp is negative, but
the pts of the part of the data that is actually intended to be
output is nonnegative, then the timestamps will currently by default
be shifted to make them nonnegative before they reach the muxer;
the muxer will then ensure that the shifted timestamps are retained.
Before this commit, the muxer did not ensure this; instead the
timestamps that the demuxer will output were shifted and
if the first timestamp of the actually intended output was zero
before shifting, then this unintentional shift just cancels
the shift performed before the packet reached the muxer.
(But notice that this only applies if all the tracks use the same
CodecDelay, or the relative sync between tracks will be impaired.)
This happens in the matroska-opus-remux and matroska-ogg-opus-remux
FATE tests. Future commits will forward the information that
the Matroska muxer has a limited capability to handle negative
timestamps so that the shifting in libavformat can take advantage
of it.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
 libavformat/matroskaenc.c              |   8 +-
 tests/ref/fate/matroska-ogg-opus-remux | 108 ++++++++++----------
 tests/ref/fate/matroska-opus-remux     | 130 ++++++++++++-------------
 3 files changed, 123 insertions(+), 123 deletions(-)

diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
index c525edb39f..0ded53dc21 100644
--- a/libavformat/matroskaenc.c
+++ b/libavformat/matroskaenc.c
@@ -1836,11 +1836,11 @@ static int mkv_write_track(AVFormatContext *s, MatroskaMuxContext *mkv,
                 av_log(s, AV_LOG_ERROR, "Initial padding is invalid\n");
                 return AVERROR(EINVAL);
             }
-//            track->ts_offset = av_rescale_q(par->initial_padding,
-//                                            (AVRational){ 1, par->sample_rate },
-//                                            st->time_base);
-
             put_ebml_uint(pb, MATROSKA_ID_CODECDELAY, codecdelay);
+
+            track->ts_offset = av_rescale_q(par->initial_padding,
+                                            (AVRational){ 1, par->sample_rate },
+                                            st->time_base);
         }
         if (par->codec_id == AV_CODEC_ID_OPUS)
             put_ebml_uint(pb, MATROSKA_ID_SEEKPREROLL, OPUS_SEEK_PREROLL);
diff --git a/tests/ref/fate/matroska-ogg-opus-remux b/tests/ref/fate/matroska-ogg-opus-remux
index 1fa776ef01..da9c8d285b 100644
--- a/tests/ref/fate/matroska-ogg-opus-remux
+++ b/tests/ref/fate/matroska-ogg-opus-remux
@@ -1,4 +1,4 @@
-a3f98769fe55bc5234cf75fb1949749a *tests/data/fate/matroska-ogg-opus-remux.matroska
+47b6b69c2ffdf5729557e90c72d241e9 *tests/data/fate/matroska-ogg-opus-remux.matroska
 10200 tests/data/fate/matroska-ogg-opus-remux.matroska
 #extradata 0:       19, 0x399c0471
 #tb 0: 1/1000
@@ -6,54 +6,54 @@ a3f98769fe55bc5234cf75fb1949749a *tests/data/fate/matroska-ogg-opus-remux.matros
 #codec_id 0: opus
 #sample_rate 0: 48000
 #channel_layout_name 0: stereo
-0,         -7,         -7,       20,      402, 0x89b1c40f
-0,         13,         13,       20,      216, 0x7bf97146
-0,         33,         33,       20,      215, 0x6cb86d8b
-0,         53,         53,       20,      218, 0x9cfd691c
-0,         73,         73,       20,      218, 0xd7fe6a94
-0,         93,         93,       20,      194, 0x35735de6
-0,        113,        113,       20,      216, 0x3ee6705a
-0,        133,        133,       20,      218, 0x67eb6cb1
-0,        153,        153,       20,      218, 0x32d0700d
-0,        173,        173,       20,      219, 0xcb7f6c60
-0,        193,        193,       20,      218, 0x9c866b33
-0,        213,        213,       20,      217, 0xfe3e6a53
-0,        233,        233,       20,      218, 0x13586833
-0,        253,        253,       20,      222, 0xbcb2669e
-0,        273,        273,       20,      218, 0x8dfc6e33
-0,        293,        293,       20,      217, 0xf5957051
-0,        313,        313,       20,      210, 0xed126e6b
-0,        333,        333,       20,      216, 0xbf947249
-0,        353,        353,       20,      203, 0x6c7e680a
-0,        373,        373,       20,      209, 0xf78f6af4
-0,        393,        393,       20,      217, 0xd60c684d
-0,        413,        413,       20,      218, 0x89056a7a
-0,        433,        433,       20,      219, 0x0bc674ad
-0,        453,        453,       20,      217, 0xb1d86d1a
-0,        473,        473,       20,      220, 0x433d685a
-0,        493,        493,       20,      364, 0x0c88be84
-0,        513,        513,       20,      221, 0x804a733d
-0,        533,        533,       20,      215, 0x6e9d6e9b
-0,        553,        553,       20,      215, 0x63016a83
-0,        573,        573,       20,      218, 0xf9a46fbe
-0,        593,        593,       20,      216, 0xa0d66c08
-0,        613,        613,       20,      216, 0xa2ca6d0a
-0,        633,        633,       20,      216, 0xf50e6f1d
-0,        653,        653,       20,      215, 0x6aaa70b6
-0,        673,        673,       20,      219, 0x7ceb6ba0
-0,        693,        693,       20,      220, 0x398d6ca9
-0,        713,        713,       20,      218, 0x7bd06ed5
-0,        733,        733,       20,      219, 0xe2906c62
-0,        753,        753,       20,      217, 0xcf316ba1
-0,        773,        773,       20,      217, 0x470b6eea
-0,        793,        793,       20,      359, 0x36c2a18a, S=1,       10
+0,          0,          0,       20,      402, 0x89b1c40f
+0,         20,         20,       20,      216, 0x7bf97146
+0,         40,         40,       20,      215, 0x6cb86d8b
+0,         60,         60,       20,      218, 0x9cfd691c
+0,         80,         80,       20,      218, 0xd7fe6a94
+0,        100,        100,       20,      194, 0x35735de6
+0,        120,        120,       20,      216, 0x3ee6705a
+0,        140,        140,       20,      218, 0x67eb6cb1
+0,        160,        160,       20,      218, 0x32d0700d
+0,        180,        180,       20,      219, 0xcb7f6c60
+0,        200,        200,       20,      218, 0x9c866b33
+0,        220,        220,       20,      217, 0xfe3e6a53
+0,        240,        240,       20,      218, 0x13586833
+0,        260,        260,       20,      222, 0xbcb2669e
+0,        280,        280,       20,      218, 0x8dfc6e33
+0,        300,        300,       20,      217, 0xf5957051
+0,        320,        320,       20,      210, 0xed126e6b
+0,        340,        340,       20,      216, 0xbf947249
+0,        360,        360,       20,      203, 0x6c7e680a
+0,        380,        380,       20,      209, 0xf78f6af4
+0,        400,        400,       20,      217, 0xd60c684d
+0,        420,        420,       20,      218, 0x89056a7a
+0,        440,        440,       20,      219, 0x0bc674ad
+0,        460,        460,       20,      217, 0xb1d86d1a
+0,        480,        480,       20,      220, 0x433d685a
+0,        500,        500,       20,      364, 0x0c88be84
+0,        520,        520,       20,      221, 0x804a733d
+0,        540,        540,       20,      215, 0x6e9d6e9b
+0,        560,        560,       20,      215, 0x63016a83
+0,        580,        580,       20,      218, 0xf9a46fbe
+0,        600,        600,       20,      216, 0xa0d66c08
+0,        620,        620,       20,      216, 0xa2ca6d0a
+0,        640,        640,       20,      216, 0xf50e6f1d
+0,        660,        660,       20,      215, 0x6aaa70b6
+0,        680,        680,       20,      219, 0x7ceb6ba0
+0,        700,        700,       20,      220, 0x398d6ca9
+0,        720,        720,       20,      218, 0x7bd06ed5
+0,        740,        740,       20,      219, 0xe2906c62
+0,        760,        760,       20,      217, 0xcf316ba1
+0,        780,        780,       20,      217, 0x470b6eea
+0,        800,        800,       20,      359, 0x36c2a18a, S=1,       10
 [PACKET]
 codec_type=audio
 stream_index=0
-pts=-7
-pts_time=-0.007000
-dts=-7
-dts_time=-0.007000
+pts=0
+pts_time=0.000000
+dts=0
+dts_time=0.000000
 duration=20
 duration_time=0.020000
 size=402
@@ -63,10 +63,10 @@ flags=K_
 [PACKET]
 codec_type=audio
 stream_index=0
-pts=13
-pts_time=0.013000
-dts=13
-dts_time=0.013000
+pts=20
+pts_time=0.020000
+dts=20
+dts_time=0.020000
 duration=20
 duration_time=0.020000
 size=216
@@ -76,10 +76,10 @@ flags=K_
 [PACKET]
 codec_type=audio
 stream_index=0
-pts=33
-pts_time=0.033000
-dts=33
-dts_time=0.033000
+pts=40
+pts_time=0.040000
+dts=40
+dts_time=0.040000
 duration=20
 duration_time=0.020000
 size=215
diff --git a/tests/ref/fate/matroska-opus-remux b/tests/ref/fate/matroska-opus-remux
index 61afeaa751..286bb65949 100644
--- a/tests/ref/fate/matroska-opus-remux
+++ b/tests/ref/fate/matroska-opus-remux
@@ -1,4 +1,4 @@
-551e45142f0989b281e837a3a86f0218 *tests/data/fate/matroska-opus-remux.matroska
+2ab987ba7bad94b27fae427cdff57723 *tests/data/fate/matroska-opus-remux.matroska
 9355 tests/data/fate/matroska-opus-remux.matroska
 #extradata 0:       19, 0x3a04048f
 #tb 0: 1/1000
@@ -6,65 +6,65 @@
 #codec_id 0: opus
 #sample_rate 0: 48000
 #channel_layout_name 0: mono
-0,         -7,         -7,       20,      320, 0x58b9a88d
-0,         14,         14,       20,      159, 0x6c9c4b4c
-0,         34,         34,       20,      148, 0x0caf4b5d
-0,         54,         54,       20,      139, 0xc5624226
-0,         74,         74,       20,      146, 0x633c4937
-0,         94,         94,       20,      153, 0x3d0b4f93
-0,        114,        114,       20,      158, 0xe5c55641
-0,        134,        134,       20,      156, 0xf2fd50ef
-0,        154,        154,       20,      158, 0x93b15410
-0,        174,        174,       20,      157, 0xb6f74f5f
-0,        194,        194,       20,      159, 0x9aff4957
-0,        214,        214,       20,      153, 0xfc5f4aba
-0,        234,        234,       20,      158, 0x01e44f70
-0,        254,        254,       20,      153, 0x227149cf
-0,        274,        274,       20,      155, 0x312f4cf6
-0,        294,        294,       20,      155, 0xafc54bae
-0,        314,        314,       20,      151, 0x7b4252b3
-0,        334,        334,       20,      155, 0x29074a75
-0,        354,        354,       20,      149, 0x82c44bcd
-0,        374,        374,       20,      150, 0x55c24eb5
-0,        394,        394,       20,      156, 0xf71d4f33
-0,        414,        414,       20,      153, 0x9b6c4ae5
-0,        434,        434,       20,      156, 0x75954e51
-0,        454,        454,       20,      155, 0x28ff4ff3
-0,        474,        474,       20,      153, 0xc4424969
-0,        494,        494,       20,      154, 0xfbf94cc8
-0,        514,        514,       20,      155, 0x52c549af
-0,        534,        534,       20,      150, 0x6f1e4b7a
-0,        554,        554,       20,      158, 0xabb45566
-0,        574,        574,       20,      157, 0xe61d4a99
-0,        594,        594,       20,      159, 0xf45d4fac
-0,        614,        614,       20,      159, 0xcd0553a5
-0,        634,        634,       20,      156, 0xdb244e63
-0,        654,        654,       20,      154, 0x78654c52
-0,        674,        674,       20,      154, 0x9f804cc8
-0,        694,        694,       20,      150, 0x1fdf4c80
-0,        714,        714,       20,      155, 0x1adc4f89
-0,        734,        734,       20,      155, 0x4b53511c
-0,        754,        754,       20,      151, 0x8ff2546d
-0,        774,        774,       20,      158, 0xb7e34f1b
-0,        794,        794,       20,      154, 0x4d98474b
-0,        814,        814,       20,      154, 0x14924ea8
-0,        834,        834,       20,      153, 0x8d4752bf
-0,        854,        854,       20,      149, 0x74785066
-0,        874,        874,       20,      151, 0x36c94a4c
-0,        894,        894,       20,      155, 0x82904f3b
-0,        914,        914,       20,      154, 0xd76b4a45
-0,        934,        934,       20,      159, 0x9fec548d
-0,        954,        954,       20,      154, 0x9a084dcd
-0,        974,        974,       20,      155, 0x90a54ac8
-0,        994,        994,       20,      324, 0x8e34a2f5
-0,       1014,       1014,       20,      268, 0x10f37203, S=1,       10
+0,          0,          0,       20,      320, 0x58b9a88d
+0,         21,         21,       20,      159, 0x6c9c4b4c
+0,         41,         41,       20,      148, 0x0caf4b5d
+0,         61,         61,       20,      139, 0xc5624226
+0,         81,         81,       20,      146, 0x633c4937
+0,        101,        101,       20,      153, 0x3d0b4f93
+0,        121,        121,       20,      158, 0xe5c55641
+0,        141,        141,       20,      156, 0xf2fd50ef
+0,        161,        161,       20,      158, 0x93b15410
+0,        181,        181,       20,      157, 0xb6f74f5f
+0,        201,        201,       20,      159, 0x9aff4957
+0,        221,        221,       20,      153, 0xfc5f4aba
+0,        241,        241,       20,      158, 0x01e44f70
+0,        261,        261,       20,      153, 0x227149cf
+0,        281,        281,       20,      155, 0x312f4cf6
+0,        301,        301,       20,      155, 0xafc54bae
+0,        321,        321,       20,      151, 0x7b4252b3
+0,        341,        341,       20,      155, 0x29074a75
+0,        361,        361,       20,      149, 0x82c44bcd
+0,        381,        381,       20,      150, 0x55c24eb5
+0,        401,        401,       20,      156, 0xf71d4f33
+0,        421,        421,       20,      153, 0x9b6c4ae5
+0,        441,        441,       20,      156, 0x75954e51
+0,        461,        461,       20,      155, 0x28ff4ff3
+0,        481,        481,       20,      153, 0xc4424969
+0,        501,        501,       20,      154, 0xfbf94cc8
+0,        521,        521,       20,      155, 0x52c549af
+0,        541,        541,       20,      150, 0x6f1e4b7a
+0,        561,        561,       20,      158, 0xabb45566
+0,        581,        581,       20,      157, 0xe61d4a99
+0,        601,        601,       20,      159, 0xf45d4fac
+0,        621,        621,       20,      159, 0xcd0553a5
+0,        641,        641,       20,      156, 0xdb244e63
+0,        661,        661,       20,      154, 0x78654c52
+0,        681,        681,       20,      154, 0x9f804cc8
+0,        701,        701,       20,      150, 0x1fdf4c80
+0,        721,        721,       20,      155, 0x1adc4f89
+0,        741,        741,       20,      155, 0x4b53511c
+0,        761,        761,       20,      151, 0x8ff2546d
+0,        781,        781,       20,      158, 0xb7e34f1b
+0,        801,        801,       20,      154, 0x4d98474b
+0,        821,        821,       20,      154, 0x14924ea8
+0,        841,        841,       20,      153, 0x8d4752bf
+0,        861,        861,       20,      149, 0x74785066
+0,        881,        881,       20,      151, 0x36c94a4c
+0,        901,        901,       20,      155, 0x82904f3b
+0,        921,        921,       20,      154, 0xd76b4a45
+0,        941,        941,       20,      159, 0x9fec548d
+0,        961,        961,       20,      154, 0x9a084dcd
+0,        981,        981,       20,      155, 0x90a54ac8
+0,       1001,       1001,       20,      324, 0x8e34a2f5
+0,       1021,       1021,       20,      268, 0x10f37203, S=1,       10
 [PACKET]
 codec_type=audio
 stream_index=0
-pts=-7
-pts_time=-0.007000
-dts=-7
-dts_time=-0.007000
+pts=0
+pts_time=0.000000
+dts=0
+dts_time=0.000000
 duration=20
 duration_time=0.020000
 size=320
@@ -74,10 +74,10 @@ flags=K_
 [PACKET]
 codec_type=audio
 stream_index=0
-pts=14
-pts_time=0.014000
-dts=14
-dts_time=0.014000
+pts=21
+pts_time=0.021000
+dts=21
+dts_time=0.021000
 duration=20
 duration_time=0.020000
 size=159
@@ -87,10 +87,10 @@ flags=K_
 [PACKET]
 codec_type=audio
 stream_index=0
-pts=34
-pts_time=0.034000
-dts=34
-dts_time=0.034000
+pts=41
+pts_time=0.041000
+dts=41
+dts_time=0.041000
 duration=20
 duration_time=0.020000
 size=148
-- 
2.34.1

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

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

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [FFmpeg-devel] [PATCH 6/8] avformat/mux: Allow muxers to set custom min timestamp
  2022-09-01 20:38 [FFmpeg-devel] [PATCH 1/8] fftools/ffprobe: Report initial and trailing padding Andreas Rheinhardt
                   ` (3 preceding siblings ...)
  2022-09-01 21:24 ` [FFmpeg-devel] [PATCH 5/8] avformat/matroskaenc: Actually apply timestamp offset for Opus Andreas Rheinhardt
@ 2022-09-01 21:24 ` Andreas Rheinhardt
  2022-09-01 21:24 ` [FFmpeg-devel] [PATCH 7/8] avformat/matroskaenc: Use " Andreas Rheinhardt
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 11+ messages in thread
From: Andreas Rheinhardt @ 2022-09-01 21:24 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: Andreas Rheinhardt

Matroska requires pts to be >= 0 with a slight exception:
It has a mechanism to deal with codec delay, i.e. with
the data added at the beginning that does not correspond
to actual input data and should be discarded by the player.
Only the audio actually intended to be output needs to have
a timestamp >= 0.
In order to avoid unnecessary timestamp shifting, this patch
allows muxers to inform the shifting code about this so that
it can take it into account.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
 libavformat/internal.h | 7 +++++++
 libavformat/mux.c      | 7 +++++--
 2 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/libavformat/internal.h b/libavformat/internal.h
index 9b07cfb271..23757dc4fc 100644
--- a/libavformat/internal.h
+++ b/libavformat/internal.h
@@ -310,6 +310,13 @@ typedef struct FFStream {
      */
     int64_t mux_ts_offset;
 
+    /**
+     * This is the lowest ts allowed in this track; it may be set by the muxer
+     * during init or write_header and influences the automatic timestamp
+     * shifting code.
+     */
+    int64_t lowest_ts_allowed;
+
     /**
      * Internal data to check for wrapping of the time stamp
      */
diff --git a/libavformat/mux.c b/libavformat/mux.c
index a3b50dadb6..5d89458f82 100644
--- a/libavformat/mux.c
+++ b/libavformat/mux.c
@@ -632,6 +632,8 @@ static void handle_avoid_negative_ts(FFFormatContext *si, FFStream *sti,
         if (ts == AV_NOPTS_VALUE)
             return;
 
+        ts -= sti->lowest_ts_allowed;
+
         /* Peek into the muxing queue to improve our estimate
          * of the lowest timestamp if av_interleaved_write_frame() is used. */
         for (const PacketListEntry *pktl = si->packet_buffer.head;
@@ -640,6 +642,7 @@ static void handle_avoid_negative_ts(FFFormatContext *si, FFStream *sti,
             int64_t cmp_ts = use_pts ? pktl->pkt.pts : pktl->pkt.dts;
             if (cmp_ts == AV_NOPTS_VALUE)
                 continue;
+            cmp_ts -= ffstream(s->streams[pktl->pkt.stream_index])->lowest_ts_allowed;
             if (s->output_ts_offset)
                 cmp_ts += av_rescale_q(s->output_ts_offset, AV_TIME_BASE_Q, cmp_tb);
             if (av_compare_ts(cmp_ts, cmp_tb, ts, tb) < 0) {
@@ -669,7 +672,7 @@ static void handle_avoid_negative_ts(FFFormatContext *si, FFStream *sti,
         pkt->pts += offset;
 
     if (si->avoid_negative_ts_use_pts) {
-        if (pkt->pts != AV_NOPTS_VALUE && pkt->pts < 0) {
+        if (pkt->pts != AV_NOPTS_VALUE && pkt->pts < sti->lowest_ts_allowed) {
             av_log(s, AV_LOG_WARNING, "failed to avoid negative "
                    "pts %s in stream %d.\n"
                    "Try -avoid_negative_ts 1 as a possible workaround.\n",
@@ -678,7 +681,7 @@ static void handle_avoid_negative_ts(FFFormatContext *si, FFStream *sti,
             );
         }
     } else {
-        if (pkt->dts != AV_NOPTS_VALUE && pkt->dts < 0) {
+        if (pkt->dts != AV_NOPTS_VALUE && pkt->dts < sti->lowest_ts_allowed) {
             av_log(s, AV_LOG_WARNING,
                    "Packets poorly interleaved, failed to avoid negative "
                    "timestamp %s in stream %d.\n"
-- 
2.34.1

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

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

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [FFmpeg-devel] [PATCH 7/8] avformat/matroskaenc: Use custom min timestamp
  2022-09-01 20:38 [FFmpeg-devel] [PATCH 1/8] fftools/ffprobe: Report initial and trailing padding Andreas Rheinhardt
                   ` (4 preceding siblings ...)
  2022-09-01 21:24 ` [FFmpeg-devel] [PATCH 6/8] avformat/mux: Allow muxers to set custom min timestamp Andreas Rheinhardt
@ 2022-09-01 21:24 ` Andreas Rheinhardt
  2022-09-01 21:24 ` [FFmpeg-devel] [PATCH 8/8] avformat/matroskaenc: Write CodecDelay for codecs != Opus Andreas Rheinhardt
  2022-09-04 22:52 ` [FFmpeg-devel] [PATCH 1/8] fftools/ffprobe: Report initial and trailing padding Andreas Rheinhardt
  7 siblings, 0 replies; 11+ messages in thread
From: Andreas Rheinhardt @ 2022-09-01 21:24 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: Andreas Rheinhardt

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
 libavformat/matroskaenc.c              |   1 +
 libavformat/webm_chunk.c               |   4 +
 tests/fate/matroska.mak                |   2 +-
 tests/ref/fate/matroska-ogg-opus-remux | 108 ++++++++++----------
 tests/ref/fate/matroska-opus-remux     | 130 ++++++++++++-------------
 5 files changed, 125 insertions(+), 120 deletions(-)

diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
index 0ded53dc21..97dcff5607 100644
--- a/libavformat/matroskaenc.c
+++ b/libavformat/matroskaenc.c
@@ -1841,6 +1841,7 @@ static int mkv_write_track(AVFormatContext *s, MatroskaMuxContext *mkv,
             track->ts_offset = av_rescale_q(par->initial_padding,
                                             (AVRational){ 1, par->sample_rate },
                                             st->time_base);
+            ffstream(st)->lowest_ts_allowed = -track->ts_offset;
         }
         if (par->codec_id == AV_CODEC_ID_OPUS)
             put_ebml_uint(pb, MATROSKA_ID_SEEKPREROLL, OPUS_SEEK_PREROLL);
diff --git a/libavformat/webm_chunk.c b/libavformat/webm_chunk.c
index 9e71a1209d..916ed0cbab 100644
--- a/libavformat/webm_chunk.c
+++ b/libavformat/webm_chunk.c
@@ -127,6 +127,7 @@ fail:
     ffformatcontext(s)->avoid_negative_ts_use_pts =
         ffformatcontext(oc)->avoid_negative_ts_use_pts;
     oc->avoid_negative_ts = AVFMT_AVOID_NEG_TS_DISABLED;
+    ffformatcontext(oc)->avoid_negative_ts_status = AVOID_NEGATIVE_TS_DISABLED;
 
     return 0;
 }
@@ -149,10 +150,13 @@ static int webm_chunk_write_header(AVFormatContext *s)
 {
     WebMChunkContext *wc = s->priv_data;
     AVFormatContext *oc = wc->avf;
+    AVStream *st = s->streams[0], *ost = oc->streams[0];
     int ret;
 
     ret = avformat_write_header(oc, NULL);
     ff_format_io_close(s, &oc->pb);
+    ffstream(st)->lowest_ts_allowed = ffstream(ost)->lowest_ts_allowed;
+    ffstream(ost)->lowest_ts_allowed = 0;
     wc->header_written = 1;
     if (ret < 0)
         return ret;
diff --git a/tests/fate/matroska.mak b/tests/fate/matroska.mak
index 94532b31dc..63e81f121b 100644
--- a/tests/fate/matroska.mak
+++ b/tests/fate/matroska.mak
@@ -166,7 +166,7 @@ fate-matroska-mpegts-remux: CMD = transcode mpegts $(TARGET_SAMPLES)/mpegts/pmtc
 # Tests maintaining codec delay while remuxing from Matroska.
 # For some reason, ffmpeg shifts the timestamps of the input file
 # to make them zero before reaching the muxer while it does not
-# for the ogg-opus-remux test.
+# for the ogg-opus-remux test. -avoid_negative_ts make_zero counters this.
 FATE_MATROSKA_FFMPEG_FFPROBE-$(call REMUX, MATROSKA, OPUS_PARSER OPUS_DECODER) += fate-matroska-opus-remux
 fate-matroska-opus-remux: CMD = transcode matroska $(TARGET_SAMPLES)/mkv/codec_delay_opus.mkv matroska "-avoid_negative_ts make_zero -c copy" "-copyts -c copy" "-show_packets -show_entries stream=codec_name,initial_padding -read_intervals %0.05"
 
diff --git a/tests/ref/fate/matroska-ogg-opus-remux b/tests/ref/fate/matroska-ogg-opus-remux
index da9c8d285b..1fa776ef01 100644
--- a/tests/ref/fate/matroska-ogg-opus-remux
+++ b/tests/ref/fate/matroska-ogg-opus-remux
@@ -1,4 +1,4 @@
-47b6b69c2ffdf5729557e90c72d241e9 *tests/data/fate/matroska-ogg-opus-remux.matroska
+a3f98769fe55bc5234cf75fb1949749a *tests/data/fate/matroska-ogg-opus-remux.matroska
 10200 tests/data/fate/matroska-ogg-opus-remux.matroska
 #extradata 0:       19, 0x399c0471
 #tb 0: 1/1000
@@ -6,54 +6,54 @@
 #codec_id 0: opus
 #sample_rate 0: 48000
 #channel_layout_name 0: stereo
-0,          0,          0,       20,      402, 0x89b1c40f
-0,         20,         20,       20,      216, 0x7bf97146
-0,         40,         40,       20,      215, 0x6cb86d8b
-0,         60,         60,       20,      218, 0x9cfd691c
-0,         80,         80,       20,      218, 0xd7fe6a94
-0,        100,        100,       20,      194, 0x35735de6
-0,        120,        120,       20,      216, 0x3ee6705a
-0,        140,        140,       20,      218, 0x67eb6cb1
-0,        160,        160,       20,      218, 0x32d0700d
-0,        180,        180,       20,      219, 0xcb7f6c60
-0,        200,        200,       20,      218, 0x9c866b33
-0,        220,        220,       20,      217, 0xfe3e6a53
-0,        240,        240,       20,      218, 0x13586833
-0,        260,        260,       20,      222, 0xbcb2669e
-0,        280,        280,       20,      218, 0x8dfc6e33
-0,        300,        300,       20,      217, 0xf5957051
-0,        320,        320,       20,      210, 0xed126e6b
-0,        340,        340,       20,      216, 0xbf947249
-0,        360,        360,       20,      203, 0x6c7e680a
-0,        380,        380,       20,      209, 0xf78f6af4
-0,        400,        400,       20,      217, 0xd60c684d
-0,        420,        420,       20,      218, 0x89056a7a
-0,        440,        440,       20,      219, 0x0bc674ad
-0,        460,        460,       20,      217, 0xb1d86d1a
-0,        480,        480,       20,      220, 0x433d685a
-0,        500,        500,       20,      364, 0x0c88be84
-0,        520,        520,       20,      221, 0x804a733d
-0,        540,        540,       20,      215, 0x6e9d6e9b
-0,        560,        560,       20,      215, 0x63016a83
-0,        580,        580,       20,      218, 0xf9a46fbe
-0,        600,        600,       20,      216, 0xa0d66c08
-0,        620,        620,       20,      216, 0xa2ca6d0a
-0,        640,        640,       20,      216, 0xf50e6f1d
-0,        660,        660,       20,      215, 0x6aaa70b6
-0,        680,        680,       20,      219, 0x7ceb6ba0
-0,        700,        700,       20,      220, 0x398d6ca9
-0,        720,        720,       20,      218, 0x7bd06ed5
-0,        740,        740,       20,      219, 0xe2906c62
-0,        760,        760,       20,      217, 0xcf316ba1
-0,        780,        780,       20,      217, 0x470b6eea
-0,        800,        800,       20,      359, 0x36c2a18a, S=1,       10
+0,         -7,         -7,       20,      402, 0x89b1c40f
+0,         13,         13,       20,      216, 0x7bf97146
+0,         33,         33,       20,      215, 0x6cb86d8b
+0,         53,         53,       20,      218, 0x9cfd691c
+0,         73,         73,       20,      218, 0xd7fe6a94
+0,         93,         93,       20,      194, 0x35735de6
+0,        113,        113,       20,      216, 0x3ee6705a
+0,        133,        133,       20,      218, 0x67eb6cb1
+0,        153,        153,       20,      218, 0x32d0700d
+0,        173,        173,       20,      219, 0xcb7f6c60
+0,        193,        193,       20,      218, 0x9c866b33
+0,        213,        213,       20,      217, 0xfe3e6a53
+0,        233,        233,       20,      218, 0x13586833
+0,        253,        253,       20,      222, 0xbcb2669e
+0,        273,        273,       20,      218, 0x8dfc6e33
+0,        293,        293,       20,      217, 0xf5957051
+0,        313,        313,       20,      210, 0xed126e6b
+0,        333,        333,       20,      216, 0xbf947249
+0,        353,        353,       20,      203, 0x6c7e680a
+0,        373,        373,       20,      209, 0xf78f6af4
+0,        393,        393,       20,      217, 0xd60c684d
+0,        413,        413,       20,      218, 0x89056a7a
+0,        433,        433,       20,      219, 0x0bc674ad
+0,        453,        453,       20,      217, 0xb1d86d1a
+0,        473,        473,       20,      220, 0x433d685a
+0,        493,        493,       20,      364, 0x0c88be84
+0,        513,        513,       20,      221, 0x804a733d
+0,        533,        533,       20,      215, 0x6e9d6e9b
+0,        553,        553,       20,      215, 0x63016a83
+0,        573,        573,       20,      218, 0xf9a46fbe
+0,        593,        593,       20,      216, 0xa0d66c08
+0,        613,        613,       20,      216, 0xa2ca6d0a
+0,        633,        633,       20,      216, 0xf50e6f1d
+0,        653,        653,       20,      215, 0x6aaa70b6
+0,        673,        673,       20,      219, 0x7ceb6ba0
+0,        693,        693,       20,      220, 0x398d6ca9
+0,        713,        713,       20,      218, 0x7bd06ed5
+0,        733,        733,       20,      219, 0xe2906c62
+0,        753,        753,       20,      217, 0xcf316ba1
+0,        773,        773,       20,      217, 0x470b6eea
+0,        793,        793,       20,      359, 0x36c2a18a, S=1,       10
 [PACKET]
 codec_type=audio
 stream_index=0
-pts=0
-pts_time=0.000000
-dts=0
-dts_time=0.000000
+pts=-7
+pts_time=-0.007000
+dts=-7
+dts_time=-0.007000
 duration=20
 duration_time=0.020000
 size=402
@@ -63,10 +63,10 @@ flags=K_
 [PACKET]
 codec_type=audio
 stream_index=0
-pts=20
-pts_time=0.020000
-dts=20
-dts_time=0.020000
+pts=13
+pts_time=0.013000
+dts=13
+dts_time=0.013000
 duration=20
 duration_time=0.020000
 size=216
@@ -76,10 +76,10 @@ flags=K_
 [PACKET]
 codec_type=audio
 stream_index=0
-pts=40
-pts_time=0.040000
-dts=40
-dts_time=0.040000
+pts=33
+pts_time=0.033000
+dts=33
+dts_time=0.033000
 duration=20
 duration_time=0.020000
 size=215
diff --git a/tests/ref/fate/matroska-opus-remux b/tests/ref/fate/matroska-opus-remux
index 286bb65949..61afeaa751 100644
--- a/tests/ref/fate/matroska-opus-remux
+++ b/tests/ref/fate/matroska-opus-remux
@@ -1,4 +1,4 @@
-2ab987ba7bad94b27fae427cdff57723 *tests/data/fate/matroska-opus-remux.matroska
+551e45142f0989b281e837a3a86f0218 *tests/data/fate/matroska-opus-remux.matroska
 9355 tests/data/fate/matroska-opus-remux.matroska
 #extradata 0:       19, 0x3a04048f
 #tb 0: 1/1000
@@ -6,65 +6,65 @@
 #codec_id 0: opus
 #sample_rate 0: 48000
 #channel_layout_name 0: mono
-0,          0,          0,       20,      320, 0x58b9a88d
-0,         21,         21,       20,      159, 0x6c9c4b4c
-0,         41,         41,       20,      148, 0x0caf4b5d
-0,         61,         61,       20,      139, 0xc5624226
-0,         81,         81,       20,      146, 0x633c4937
-0,        101,        101,       20,      153, 0x3d0b4f93
-0,        121,        121,       20,      158, 0xe5c55641
-0,        141,        141,       20,      156, 0xf2fd50ef
-0,        161,        161,       20,      158, 0x93b15410
-0,        181,        181,       20,      157, 0xb6f74f5f
-0,        201,        201,       20,      159, 0x9aff4957
-0,        221,        221,       20,      153, 0xfc5f4aba
-0,        241,        241,       20,      158, 0x01e44f70
-0,        261,        261,       20,      153, 0x227149cf
-0,        281,        281,       20,      155, 0x312f4cf6
-0,        301,        301,       20,      155, 0xafc54bae
-0,        321,        321,       20,      151, 0x7b4252b3
-0,        341,        341,       20,      155, 0x29074a75
-0,        361,        361,       20,      149, 0x82c44bcd
-0,        381,        381,       20,      150, 0x55c24eb5
-0,        401,        401,       20,      156, 0xf71d4f33
-0,        421,        421,       20,      153, 0x9b6c4ae5
-0,        441,        441,       20,      156, 0x75954e51
-0,        461,        461,       20,      155, 0x28ff4ff3
-0,        481,        481,       20,      153, 0xc4424969
-0,        501,        501,       20,      154, 0xfbf94cc8
-0,        521,        521,       20,      155, 0x52c549af
-0,        541,        541,       20,      150, 0x6f1e4b7a
-0,        561,        561,       20,      158, 0xabb45566
-0,        581,        581,       20,      157, 0xe61d4a99
-0,        601,        601,       20,      159, 0xf45d4fac
-0,        621,        621,       20,      159, 0xcd0553a5
-0,        641,        641,       20,      156, 0xdb244e63
-0,        661,        661,       20,      154, 0x78654c52
-0,        681,        681,       20,      154, 0x9f804cc8
-0,        701,        701,       20,      150, 0x1fdf4c80
-0,        721,        721,       20,      155, 0x1adc4f89
-0,        741,        741,       20,      155, 0x4b53511c
-0,        761,        761,       20,      151, 0x8ff2546d
-0,        781,        781,       20,      158, 0xb7e34f1b
-0,        801,        801,       20,      154, 0x4d98474b
-0,        821,        821,       20,      154, 0x14924ea8
-0,        841,        841,       20,      153, 0x8d4752bf
-0,        861,        861,       20,      149, 0x74785066
-0,        881,        881,       20,      151, 0x36c94a4c
-0,        901,        901,       20,      155, 0x82904f3b
-0,        921,        921,       20,      154, 0xd76b4a45
-0,        941,        941,       20,      159, 0x9fec548d
-0,        961,        961,       20,      154, 0x9a084dcd
-0,        981,        981,       20,      155, 0x90a54ac8
-0,       1001,       1001,       20,      324, 0x8e34a2f5
-0,       1021,       1021,       20,      268, 0x10f37203, S=1,       10
+0,         -7,         -7,       20,      320, 0x58b9a88d
+0,         14,         14,       20,      159, 0x6c9c4b4c
+0,         34,         34,       20,      148, 0x0caf4b5d
+0,         54,         54,       20,      139, 0xc5624226
+0,         74,         74,       20,      146, 0x633c4937
+0,         94,         94,       20,      153, 0x3d0b4f93
+0,        114,        114,       20,      158, 0xe5c55641
+0,        134,        134,       20,      156, 0xf2fd50ef
+0,        154,        154,       20,      158, 0x93b15410
+0,        174,        174,       20,      157, 0xb6f74f5f
+0,        194,        194,       20,      159, 0x9aff4957
+0,        214,        214,       20,      153, 0xfc5f4aba
+0,        234,        234,       20,      158, 0x01e44f70
+0,        254,        254,       20,      153, 0x227149cf
+0,        274,        274,       20,      155, 0x312f4cf6
+0,        294,        294,       20,      155, 0xafc54bae
+0,        314,        314,       20,      151, 0x7b4252b3
+0,        334,        334,       20,      155, 0x29074a75
+0,        354,        354,       20,      149, 0x82c44bcd
+0,        374,        374,       20,      150, 0x55c24eb5
+0,        394,        394,       20,      156, 0xf71d4f33
+0,        414,        414,       20,      153, 0x9b6c4ae5
+0,        434,        434,       20,      156, 0x75954e51
+0,        454,        454,       20,      155, 0x28ff4ff3
+0,        474,        474,       20,      153, 0xc4424969
+0,        494,        494,       20,      154, 0xfbf94cc8
+0,        514,        514,       20,      155, 0x52c549af
+0,        534,        534,       20,      150, 0x6f1e4b7a
+0,        554,        554,       20,      158, 0xabb45566
+0,        574,        574,       20,      157, 0xe61d4a99
+0,        594,        594,       20,      159, 0xf45d4fac
+0,        614,        614,       20,      159, 0xcd0553a5
+0,        634,        634,       20,      156, 0xdb244e63
+0,        654,        654,       20,      154, 0x78654c52
+0,        674,        674,       20,      154, 0x9f804cc8
+0,        694,        694,       20,      150, 0x1fdf4c80
+0,        714,        714,       20,      155, 0x1adc4f89
+0,        734,        734,       20,      155, 0x4b53511c
+0,        754,        754,       20,      151, 0x8ff2546d
+0,        774,        774,       20,      158, 0xb7e34f1b
+0,        794,        794,       20,      154, 0x4d98474b
+0,        814,        814,       20,      154, 0x14924ea8
+0,        834,        834,       20,      153, 0x8d4752bf
+0,        854,        854,       20,      149, 0x74785066
+0,        874,        874,       20,      151, 0x36c94a4c
+0,        894,        894,       20,      155, 0x82904f3b
+0,        914,        914,       20,      154, 0xd76b4a45
+0,        934,        934,       20,      159, 0x9fec548d
+0,        954,        954,       20,      154, 0x9a084dcd
+0,        974,        974,       20,      155, 0x90a54ac8
+0,        994,        994,       20,      324, 0x8e34a2f5
+0,       1014,       1014,       20,      268, 0x10f37203, S=1,       10
 [PACKET]
 codec_type=audio
 stream_index=0
-pts=0
-pts_time=0.000000
-dts=0
-dts_time=0.000000
+pts=-7
+pts_time=-0.007000
+dts=-7
+dts_time=-0.007000
 duration=20
 duration_time=0.020000
 size=320
@@ -74,10 +74,10 @@ flags=K_
 [PACKET]
 codec_type=audio
 stream_index=0
-pts=21
-pts_time=0.021000
-dts=21
-dts_time=0.021000
+pts=14
+pts_time=0.014000
+dts=14
+dts_time=0.014000
 duration=20
 duration_time=0.020000
 size=159
@@ -87,10 +87,10 @@ flags=K_
 [PACKET]
 codec_type=audio
 stream_index=0
-pts=41
-pts_time=0.041000
-dts=41
-dts_time=0.041000
+pts=34
+pts_time=0.034000
+dts=34
+dts_time=0.034000
 duration=20
 duration_time=0.020000
 size=148
-- 
2.34.1

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

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

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [FFmpeg-devel] [PATCH 8/8] avformat/matroskaenc: Write CodecDelay for codecs != Opus
  2022-09-01 20:38 [FFmpeg-devel] [PATCH 1/8] fftools/ffprobe: Report initial and trailing padding Andreas Rheinhardt
                   ` (5 preceding siblings ...)
  2022-09-01 21:24 ` [FFmpeg-devel] [PATCH 7/8] avformat/matroskaenc: Use " Andreas Rheinhardt
@ 2022-09-01 21:24 ` Andreas Rheinhardt
  2022-09-04 22:52 ` [FFmpeg-devel] [PATCH 1/8] fftools/ffprobe: Report initial and trailing padding Andreas Rheinhardt
  7 siblings, 0 replies; 11+ messages in thread
From: Andreas Rheinhardt @ 2022-09-01 21:24 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: Andreas Rheinhardt

The field is not specific to Opus.
The mp2fixed encoder signals initial_padding and is used
by both the matroska-encoding-delay test as well as
the lavf-mkv tests which necessitated several FATE ref changes.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
 libavformat/matroskaenc.c              |  2 +-
 tests/ref/fate/matroska-encoding-delay | 81 +++++++++++++++-----------
 tests/ref/lavf/mkv                     |  4 +-
 tests/ref/lavf/mkv_attachment          |  4 +-
 tests/ref/seek/lavf-mkv                | 44 +++++++-------
 5 files changed, 74 insertions(+), 61 deletions(-)

diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
index 97dcff5607..ed1ad5039d 100644
--- a/libavformat/matroskaenc.c
+++ b/libavformat/matroskaenc.c
@@ -1828,7 +1828,7 @@ static int mkv_write_track(AVFormatContext *s, MatroskaMuxContext *mkv,
         break;
 
     case AVMEDIA_TYPE_AUDIO:
-        if (par->initial_padding && par->codec_id == AV_CODEC_ID_OPUS) {
+        if (par->initial_padding) {
             int64_t codecdelay = av_rescale_q(par->initial_padding,
                                               (AVRational){ 1, par->sample_rate },
                                               (AVRational){ 1, 1000000000 });
diff --git a/tests/ref/fate/matroska-encoding-delay b/tests/ref/fate/matroska-encoding-delay
index fb7909fe29..8dd3bf59e2 100644
--- a/tests/ref/fate/matroska-encoding-delay
+++ b/tests/ref/fate/matroska-encoding-delay
@@ -1,5 +1,5 @@
-df0524cac5393212ee103c1d1221f4b3 *tests/data/fate/matroska-encoding-delay.matroska
-961215 tests/data/fate/matroska-encoding-delay.matroska
+b933b7b94de55ae029369312d48d8649 *tests/data/fate/matroska-encoding-delay.matroska
+961221 tests/data/fate/matroska-encoding-delay.matroska
 #extradata 0:       22, 0x32ea0490
 #tb 0: 1/1000
 #media_type 0: video
@@ -11,67 +11,80 @@ df0524cac5393212ee103c1d1221f4b3 *tests/data/fate/matroska-encoding-delay.matros
 #codec_id 1: mp2
 #sample_rate 1: 48000
 #channel_layout_name 1: stereo
-1,          0,          0,       24,     1152, 0x724077b8
-0,         10,         10,       40,   237628, 0xeff25579, S=1,       40
-1,         24,         24,       24,     1152, 0x80625572
-1,         48,         48,       24,     1152, 0x7d7f4dce
-0,         50,         50,       40,   238066, 0xb2265f41
-1,         72,         72,       24,     1152, 0xa6725739
-0,         90,         90,       40,   237723, 0x00d7cd24
-1,         96,         96,       24,     1152, 0xc9e85398
-1,        120,        120,       24,     1152, 0xda1287d3
-0,        130,        130,       40,   238290, 0xbe18b18f
-1,        144,        144,       24,     1152, 0x1c9a6102
+1,        -10,        -10,       24,     1152, 0x724077b8
+0,          0,          0,       40,   237628, 0xeff25579, S=1,       40
+1,         14,         14,       24,     1152, 0x80625572
+1,         38,         38,       24,     1152, 0x7d7f4dce
+0,         40,         40,       40,   238066, 0xb2265f41
+1,         62,         62,       24,     1152, 0xa6725739
+0,         80,         80,       40,   237723, 0x00d7cd24
+1,         86,         86,       24,     1152, 0xc9e85398
+1,        110,        110,       24,     1152, 0xda1287d3
+0,        120,        120,       40,   238290, 0xbe18b18f
+1,        134,        134,       24,     1152, 0x1c9a6102
 [PACKET]
 codec_type=audio
 stream_index=1
-pts=0
-pts_time=0.000000
-dts=0
-dts_time=0.000000
+pts=-10
+pts_time=-0.010000
+dts=-10
+dts_time=-0.010000
 duration=24
 duration_time=0.024000
 size=1152
-pos=1232
+pos=1238
 flags=K_
 [/PACKET]
 [PACKET]
 codec_type=video
 stream_index=0
-pts=10
-pts_time=0.010000
-dts=10
-dts_time=0.010000
+pts=0
+pts_time=0.000000
+dts=0
+dts_time=0.000000
 duration=40
 duration_time=0.040000
 size=237628
-pos=2392
+pos=2398
 flags=K_
 [/PACKET]
 [PACKET]
 codec_type=audio
 stream_index=1
-pts=24
-pts_time=0.024000
-dts=24
-dts_time=0.024000
+pts=14
+pts_time=0.014000
+dts=14
+dts_time=0.014000
 duration=24
 duration_time=0.024000
 size=1152
-pos=240027
+pos=240033
 flags=K_
 [/PACKET]
 [PACKET]
 codec_type=audio
 stream_index=1
-pts=48
-pts_time=0.048000
-dts=48
-dts_time=0.048000
+pts=38
+pts_time=0.038000
+dts=38
+dts_time=0.038000
 duration=24
 duration_time=0.024000
 size=1152
-pos=241202
+pos=241208
+flags=K_
+[/PACKET]
+[PACKET]
+codec_type=video
+stream_index=0
+pts=40
+pts_time=0.040000
+dts=40
+dts_time=0.040000
+duration=40
+duration_time=0.040000
+size=238066
+pos=242368
 flags=K_
 [/PACKET]
 [STREAM]
@@ -81,5 +94,5 @@ codec_name=mpeg2video
 [/STREAM]
 [STREAM]
 codec_name=mp2
-initial_padding=0
+initial_padding=481
 [/STREAM]
diff --git a/tests/ref/lavf/mkv b/tests/ref/lavf/mkv
index d9497a0a64..d54c44a647 100644
--- a/tests/ref/lavf/mkv
+++ b/tests/ref/lavf/mkv
@@ -1,3 +1,3 @@
-17e637fc06015fea86428840418ffea2 *tests/data/lavf/lavf.mkv
-320403 tests/data/lavf/lavf.mkv
+0934e35639b6735c1e26595e8f47ba70 *tests/data/lavf/lavf.mkv
+320409 tests/data/lavf/lavf.mkv
 tests/data/lavf/lavf.mkv CRC=0xec6c3c68
diff --git a/tests/ref/lavf/mkv_attachment b/tests/ref/lavf/mkv_attachment
index a8cc075bf1..ad96424098 100644
--- a/tests/ref/lavf/mkv_attachment
+++ b/tests/ref/lavf/mkv_attachment
@@ -1,3 +1,3 @@
-3855fb336711517b32b0ec41e8505b4d *tests/data/lavf/lavf.mkv_attachment
-472553 tests/data/lavf/lavf.mkv_attachment
+d2708709bdd6817d9cb2b475fdfa903f *tests/data/lavf/lavf.mkv_attachment
+472559 tests/data/lavf/lavf.mkv_attachment
 tests/data/lavf/lavf.mkv_attachment CRC=0xec6c3c68
diff --git a/tests/ref/seek/lavf-mkv b/tests/ref/seek/lavf-mkv
index 6b64367802..8ac0354164 100644
--- a/tests/ref/seek/lavf-mkv
+++ b/tests/ref/seek/lavf-mkv
@@ -1,48 +1,48 @@
-ret: 0         st: 1 flags:1 dts: 0.000000 pts: 0.000000 pos:    651 size:   208
+ret: 0         st: 1 flags:1 dts:-0.011000 pts:-0.011000 pos:    657 size:   208
 ret: 0         st:-1 flags:0  ts:-1.000000
-ret: 0         st: 0 flags:1 dts: 0.011000 pts: 0.011000 pos:    867 size: 27837
+ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:    873 size: 27837
 ret: 0         st:-1 flags:1  ts: 1.894167
-ret: 0         st: 0 flags:1 dts: 0.971000 pts: 0.971000 pos: 292283 size: 27834
+ret: 0         st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 292289 size: 27834
 ret: 0         st: 0 flags:0  ts: 0.788000
-ret: 0         st: 0 flags:1 dts: 0.971000 pts: 0.971000 pos: 292283 size: 27834
+ret: 0         st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 292289 size: 27834
 ret: 0         st: 0 flags:1  ts:-0.317000
-ret: 0         st: 0 flags:1 dts: 0.011000 pts: 0.011000 pos:    867 size: 27837
+ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:    873 size: 27837
 ret:-1         st: 1 flags:0  ts: 2.577000
 ret: 0         st: 1 flags:1  ts: 1.471000
-ret: 0         st: 1 flags:1 dts: 0.993000 pts: 0.993000 pos: 320124 size:   209
+ret: 0         st: 1 flags:1 dts: 0.982000 pts: 0.982000 pos: 320130 size:   209
 ret: 0         st:-1 flags:0  ts: 0.365002
-ret: 0         st: 0 flags:1 dts: 0.491000 pts: 0.491000 pos: 146835 size: 27925
+ret: 0         st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 146841 size: 27925
 ret: 0         st:-1 flags:1  ts:-0.740831
-ret: 0         st: 0 flags:1 dts: 0.011000 pts: 0.011000 pos:    867 size: 27837
+ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:    873 size: 27837
 ret:-1         st: 0 flags:0  ts: 2.153000
 ret: 0         st: 0 flags:1  ts: 1.048000
-ret: 0         st: 0 flags:1 dts: 0.971000 pts: 0.971000 pos: 292283 size: 27834
+ret: 0         st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 292289 size: 27834
 ret: 0         st: 1 flags:0  ts:-0.058000
-ret: 0         st: 1 flags:1 dts: 0.000000 pts: 0.000000 pos:    651 size:   208
+ret: 0         st: 1 flags:1 dts:-0.011000 pts:-0.011000 pos:    657 size:   208
 ret: 0         st: 1 flags:1  ts: 2.836000
-ret: 0         st: 1 flags:1 dts: 0.993000 pts: 0.993000 pos: 320124 size:   209
+ret: 0         st: 1 flags:1 dts: 0.982000 pts: 0.982000 pos: 320130 size:   209
 ret:-1         st:-1 flags:0  ts: 1.730004
 ret: 0         st:-1 flags:1  ts: 0.624171
-ret: 0         st: 0 flags:1 dts: 0.491000 pts: 0.491000 pos: 146835 size: 27925
+ret: 0         st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 146841 size: 27925
 ret: 0         st: 0 flags:0  ts:-0.482000
-ret: 0         st: 0 flags:1 dts: 0.011000 pts: 0.011000 pos:    867 size: 27837
+ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:    873 size: 27837
 ret: 0         st: 0 flags:1  ts: 2.413000
-ret: 0         st: 0 flags:1 dts: 0.971000 pts: 0.971000 pos: 292283 size: 27834
+ret: 0         st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 292289 size: 27834
 ret:-1         st: 1 flags:0  ts: 1.307000
 ret: 0         st: 1 flags:1  ts: 0.201000
-ret: 0         st: 1 flags:1 dts: 0.000000 pts: 0.000000 pos:    651 size:   208
+ret: 0         st: 1 flags:1 dts:-0.011000 pts:-0.011000 pos:    657 size:   208
 ret: 0         st:-1 flags:0  ts:-0.904994
-ret: 0         st: 0 flags:1 dts: 0.011000 pts: 0.011000 pos:    867 size: 27837
+ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:    873 size: 27837
 ret: 0         st:-1 flags:1  ts: 1.989173
-ret: 0         st: 0 flags:1 dts: 0.971000 pts: 0.971000 pos: 292283 size: 27834
+ret: 0         st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 292289 size: 27834
 ret: 0         st: 0 flags:0  ts: 0.883000
-ret: 0         st: 0 flags:1 dts: 0.971000 pts: 0.971000 pos: 292283 size: 27834
+ret: 0         st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 292289 size: 27834
 ret: 0         st: 0 flags:1  ts:-0.222000
-ret: 0         st: 0 flags:1 dts: 0.011000 pts: 0.011000 pos:    867 size: 27837
+ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:    873 size: 27837
 ret:-1         st: 1 flags:0  ts: 2.672000
 ret: 0         st: 1 flags:1  ts: 1.566000
-ret: 0         st: 1 flags:1 dts: 0.993000 pts: 0.993000 pos: 320124 size:   209
+ret: 0         st: 1 flags:1 dts: 0.982000 pts: 0.982000 pos: 320130 size:   209
 ret: 0         st:-1 flags:0  ts: 0.460008
-ret: 0         st: 0 flags:1 dts: 0.491000 pts: 0.491000 pos: 146835 size: 27925
+ret: 0         st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 146841 size: 27925
 ret: 0         st:-1 flags:1  ts:-0.645825
-ret: 0         st: 0 flags:1 dts: 0.011000 pts: 0.011000 pos:    867 size: 27837
+ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:    873 size: 27837
-- 
2.34.1

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

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

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [FFmpeg-devel] [PATCH 1/8] fftools/ffprobe: Report initial and trailing padding
  2022-09-01 20:38 [FFmpeg-devel] [PATCH 1/8] fftools/ffprobe: Report initial and trailing padding Andreas Rheinhardt
                   ` (6 preceding siblings ...)
  2022-09-01 21:24 ` [FFmpeg-devel] [PATCH 8/8] avformat/matroskaenc: Write CodecDelay for codecs != Opus Andreas Rheinhardt
@ 2022-09-04 22:52 ` Andreas Rheinhardt
  2022-09-06  7:55   ` Anton Khirnov
  7 siblings, 1 reply; 11+ messages in thread
From: Andreas Rheinhardt @ 2022-09-04 22:52 UTC (permalink / raw)
  To: ffmpeg-devel

Andreas Rheinhardt:
> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
> ---
> trailing_padding seems to be unused and could actually be deprecated.
> 

Will apply this patchset tomorrow unless there are objections. Notice
that I really like to have a second opinion on whether trailing_padding
should be printed at all.

>  doc/ffprobe.xsd                                     | 2 ++
>  fftools/ffprobe.c                                   | 3 +++
>  tests/ref/fate/concat-demuxer-extended-lavf-mxf     | 2 +-
>  tests/ref/fate/concat-demuxer-extended-lavf-mxf_d10 | 2 +-
>  tests/ref/fate/concat-demuxer-simple1-lavf-mxf      | 2 +-
>  tests/ref/fate/concat-demuxer-simple1-lavf-mxf_d10  | 2 +-
>  tests/ref/fate/concat-demuxer-simple2-lavf-ts       | 2 +-
>  tests/ref/fate/ffprobe_compact                      | 2 +-
>  tests/ref/fate/ffprobe_csv                          | 2 +-
>  tests/ref/fate/ffprobe_default                      | 2 ++
>  tests/ref/fate/ffprobe_flat                         | 2 ++
>  tests/ref/fate/ffprobe_ini                          | 2 ++
>  tests/ref/fate/ffprobe_json                         | 2 ++
>  tests/ref/fate/ffprobe_xml                          | 2 +-
>  tests/ref/fate/flv-demux                            | 2 +-
>  tests/ref/fate/gapless-mp3-side-data                | 2 +-
>  tests/ref/fate/mxf-probe-applehdr10                 | 4 ++++
>  tests/ref/fate/mxf-probe-d10                        | 2 ++
>  tests/ref/fate/mxf-probe-dv25                       | 4 ++++
>  tests/ref/fate/oggopus-demux                        | 2 +-
>  tests/ref/fate/ts-demux                             | 4 ++--
>  tests/ref/fate/ts-opus-demux                        | 2 +-
>  22 files changed, 37 insertions(+), 14 deletions(-)
> 
> diff --git a/doc/ffprobe.xsd b/doc/ffprobe.xsd
> index 6e678a9970..6052a5eff4 100644
> --- a/doc/ffprobe.xsd
> +++ b/doc/ffprobe.xsd
> @@ -246,6 +246,8 @@
>        <xsd:attribute name="channels"         type="xsd:int"/>
>        <xsd:attribute name="channel_layout"   type="xsd:string"/>
>        <xsd:attribute name="bits_per_sample"  type="xsd:int"/>
> +      <xsd:attribute name="initial_padding"  type="xsd:int"/>
> +      <xsd:attribute name="trailing_padding" type="xsd:int"/>
>  
>        <xsd:attribute name="id"               type="xsd:string"/>
>        <xsd:attribute name="r_frame_rate"     type="xsd:string" use="required"/>
> diff --git a/fftools/ffprobe.c b/fftools/ffprobe.c
> index 3344a06409..9eb20fa4cd 100644
> --- a/fftools/ffprobe.c
> +++ b/fftools/ffprobe.c
> @@ -3044,6 +3044,9 @@ static int show_stream(WriterContext *w, AVFormatContext *fmt_ctx, int stream_id
>          }
>  
>          print_int("bits_per_sample", av_get_bits_per_sample(par->codec_id));
> +
> +        print_int("initial_padding",  par->initial_padding);
> +        print_int("trailing_padding", par->trailing_padding);
>          break;
>  
>      case AVMEDIA_TYPE_SUBTITLE:
> diff --git a/tests/ref/fate/concat-demuxer-extended-lavf-mxf b/tests/ref/fate/concat-demuxer-extended-lavf-mxf
> index 543c7d6a8c..973ce5d4a4 100644
> --- a/tests/ref/fate/concat-demuxer-extended-lavf-mxf
> +++ b/tests/ref/fate/concat-demuxer-extended-lavf-mxf
> @@ -1 +1 @@
> -d367d7f6df7292cbf454c6d07fca9b04 *tests/data/fate/concat-demuxer-extended-lavf-mxf.ffprobe
> +3fa8632676f0e40c42be38b842794afc *tests/data/fate/concat-demuxer-extended-lavf-mxf.ffprobe
> diff --git a/tests/ref/fate/concat-demuxer-extended-lavf-mxf_d10 b/tests/ref/fate/concat-demuxer-extended-lavf-mxf_d10
> index 57b22848b9..905ae46343 100644
> --- a/tests/ref/fate/concat-demuxer-extended-lavf-mxf_d10
> +++ b/tests/ref/fate/concat-demuxer-extended-lavf-mxf_d10
> @@ -1 +1 @@
> -1fac6962d4c5f1070d0d2db5ab7d86aa *tests/data/fate/concat-demuxer-extended-lavf-mxf_d10.ffprobe
> +f88c5d6b16ec3ffd5d35b64a031489be *tests/data/fate/concat-demuxer-extended-lavf-mxf_d10.ffprobe
> diff --git a/tests/ref/fate/concat-demuxer-simple1-lavf-mxf b/tests/ref/fate/concat-demuxer-simple1-lavf-mxf
> index dcc98e9bdb..c227fa534c 100644
> --- a/tests/ref/fate/concat-demuxer-simple1-lavf-mxf
> +++ b/tests/ref/fate/concat-demuxer-simple1-lavf-mxf
> @@ -100,4 +100,4 @@ video|0|33|1.320000|33|1.320000|1|0.040000|12362|195072|__|1|Strings Metadata
>  audio|1|65280|1.360000|65280|1.360000|1920|0.040000|3840|207872|K_|1|Strings Metadata
>  video|0|37|1.480000|34|1.360000|1|0.040000|24786|212480|K_|1|Strings Metadata
>  0|mpeg2video|4|video|[0][0][0][0]|0x0000|352|288|0|0|0|0|1|1:1|11:9|yuv420p|8|tv|unknown|unknown|unknown|left|progressive|1|N/A|25/1|25/1|1/25|N/A|N/A|N/A|N/A|N/A|N/A|N/A|N/A|N/A|51|22|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0x060A2B340101010501010D001300000000000000000000000000000000000001|CPB properties|0|0|0|49152|-1
> -1|pcm_s16le|unknown|audio|[0][0][0][0]|0x0000|s16|48000|1|unknown|16|N/A|0/0|0/0|1/48000|0|0.000000|N/A|N/A|768000|N/A|N/A|N/A|N/A|50|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0x060A2B340101010501010D001300000000000000000000000000000000000001
> +1|pcm_s16le|unknown|audio|[0][0][0][0]|0x0000|s16|48000|1|unknown|16|0|0|N/A|0/0|0/0|1/48000|0|0.000000|N/A|N/A|768000|N/A|N/A|N/A|N/A|50|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0x060A2B340101010501010D001300000000000000000000000000000000000001
> diff --git a/tests/ref/fate/concat-demuxer-simple1-lavf-mxf_d10 b/tests/ref/fate/concat-demuxer-simple1-lavf-mxf_d10
> index 8937724ed1..f26e3c2e1b 100644
> --- a/tests/ref/fate/concat-demuxer-simple1-lavf-mxf_d10
> +++ b/tests/ref/fate/concat-demuxer-simple1-lavf-mxf_d10
> @@ -69,4 +69,4 @@ audio|1|63360|1.320000|63360|1.320000|1920|0.040000|7680|1861632|K_|1|Strings Me
>  video|0|34|1.360000|34|1.360000|1|0.040000|150000|1924096|K_|1|Strings Metadata
>  audio|1|65280|1.360000|65280|1.360000|1920|0.040000|7680|2074624|K_|1|Strings Metadata
>  0|mpeg2video|0|video|[0][0][0][0]|0x0000|720|608|0|0|0|0|0|1:1|45:38|yuv422p|5|tv|unknown|unknown|unknown|topleft|tb|1|N/A|25/1|25/1|1/25|0|0.000000|N/A|N/A|30000000|N/A|N/A|N/A|N/A|35|22|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0x060A2B340101010501010D001300000000000000000000000000000000000001|CPB properties|30000000|0|0|1212416|-1
> -1|pcm_s16le|unknown|audio|[0][0][0][0]|0x0000|s16|48000|2|unknown|16|N/A|0/0|0/0|1/48000|0|0.000000|N/A|N/A|1536000|N/A|N/A|N/A|N/A|35|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0x060A2B340101010501010D001300000000000000000000000000000000000001
> +1|pcm_s16le|unknown|audio|[0][0][0][0]|0x0000|s16|48000|2|unknown|16|0|0|N/A|0/0|0/0|1/48000|0|0.000000|N/A|N/A|1536000|N/A|N/A|N/A|N/A|35|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0x060A2B340101010501010D001300000000000000000000000000000000000001
> diff --git a/tests/ref/fate/concat-demuxer-simple2-lavf-ts b/tests/ref/fate/concat-demuxer-simple2-lavf-ts
> index 9603ca21d0..5d03e5cd50 100644
> --- a/tests/ref/fate/concat-demuxer-simple2-lavf-ts
> +++ b/tests/ref/fate/concat-demuxer-simple2-lavf-ts
> @@ -211,5 +211,5 @@ video|1|171982|1.910911|168382|1.870911|3600|0.040000|17440|206988|__|MPEGTS Str
>  
>  video|1|175582|1.950911|171982|1.910911|3600|0.040000|15019|224848|__|MPEGTS Stream ID|224
>  
> -0|mp2|unknown|audio|[3][0][0][0]|0x0003|s16p|44100|1|mono|0|N/A|0/0|0/0|1/90000|0|0.000000|N/A|N/A|64000|N/A|N/A|N/A|N/A|89|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|this is stream 0
> +0|mp2|unknown|audio|[3][0][0][0]|0x0003|s16p|44100|1|mono|0|0|0|N/A|0/0|0/0|1/90000|0|0.000000|N/A|N/A|64000|N/A|N/A|N/A|N/A|89|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|this is stream 0
>  1|mpeg2video|4|video|[2][0][0][0]|0x0002|352|288|0|0|0|0|1|1:1|11:9|yuv420p|8|tv|unknown|unknown|unknown|left|progressive|1|N/A|25/1|25/1|1/90000|N/A|N/A|N/A|N/A|N/A|N/A|N/A|N/A|N/A|60|22|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|this is stream 1|CPB properties|0|0|0|49152|-1
> diff --git a/tests/ref/fate/ffprobe_compact b/tests/ref/fate/ffprobe_compact
> index 5374bfca03..4f7cc1e09d 100644
> --- a/tests/ref/fate/ffprobe_compact
> +++ b/tests/ref/fate/ffprobe_compact
> @@ -26,7 +26,7 @@ packet|codec_type=video|stream_index=1|pts=6144|pts_time=0.120000|dts=6144|dts_t
>  frame|media_type=video|stream_index=1|key_frame=1|pts=6144|pts_time=0.120000|pkt_dts=6144|pkt_dts_time=0.120000|best_effort_timestamp=6144|best_effort_timestamp_time=0.120000|pkt_duration=2048|pkt_duration_time=0.040000|duration=2048|duration_time=0.040000|pkt_pos=793142|pkt_size=230400|width=320|height=240|pix_fmt=rgb24|sample_aspect_ratio=1:1|pict_type=I|coded_picture_number=0|display_picture_number=0|interlaced_frame=0|top_field_first=0|repeat_pict=0|color_range=unknown|color_space=unknown|color_primaries=unknown|color_transfer=unknown|chroma_location=unspecified
>  packet|codec_type=video|stream_index=2|pts=6144|pts_time=0.120000|dts=6144|dts_time=0.120000|duration=2048|duration_time=0.040000|size=30000|pos=1023566|flags=K_
>  frame|media_type=video|stream_index=2|key_frame=1|pts=6144|pts_time=0.120000|pkt_dts=6144|pkt_dts_time=0.120000|best_effort_timestamp=6144|best_effort_timestamp_time=0.120000|pkt_duration=2048|pkt_duration_time=0.040000|duration=2048|duration_time=0.040000|pkt_pos=1023566|pkt_size=30000|width=100|height=100|pix_fmt=rgb24|sample_aspect_ratio=1:1|pict_type=I|coded_picture_number=0|display_picture_number=0|interlaced_frame=0|top_field_first=0|repeat_pict=0|color_range=unknown|color_space=unknown|color_primaries=unknown|color_transfer=unknown|chroma_location=unspecified
> -stream|index=0|codec_name=pcm_s16le|profile=unknown|codec_type=audio|codec_tag_string=PSD[16]|codec_tag=0x10445350|sample_fmt=s16|sample_rate=44100|channels=1|channel_layout=unknown|bits_per_sample=16|id=N/A|r_frame_rate=0/0|avg_frame_rate=0/0|time_base=1/44100|start_pts=0|start_time=0.000000|duration_ts=N/A|duration=N/A|bit_rate=705600|max_bit_rate=N/A|bits_per_raw_sample=N/A|nb_frames=N/A|nb_read_frames=6|nb_read_packets=6|disposition:default=0|disposition:dub=0|disposition:original=0|disposition:comment=0|disposition:lyrics=0|disposition:karaoke=0|disposition:forced=0|disposition:hearing_impaired=0|disposition:visual_impaired=0|disposition:clean_effects=0|disposition:attached_pic=0|disposition:timed_thumbnails=0|disposition:captions=0|disposition:descriptions=0|disposition:metadata=0|disposition:dependent=0|disposition:still_image=0|tag:E=mc²|tag:encoder=Lavc pcm_s16le
> +stream|index=0|codec_name=pcm_s16le|profile=unknown|codec_type=audio|codec_tag_string=PSD[16]|codec_tag=0x10445350|sample_fmt=s16|sample_rate=44100|channels=1|channel_layout=unknown|bits_per_sample=16|initial_padding=0|trailing_padding=0|id=N/A|r_frame_rate=0/0|avg_frame_rate=0/0|time_base=1/44100|start_pts=0|start_time=0.000000|duration_ts=N/A|duration=N/A|bit_rate=705600|max_bit_rate=N/A|bits_per_raw_sample=N/A|nb_frames=N/A|nb_read_frames=6|nb_read_packets=6|disposition:default=0|disposition:dub=0|disposition:original=0|disposition:comment=0|disposition:lyrics=0|disposition:karaoke=0|disposition:forced=0|disposition:hearing_impaired=0|disposition:visual_impaired=0|disposition:clean_effects=0|disposition:attached_pic=0|disposition:timed_thumbnails=0|disposition:captions=0|disposition:descriptions=0|disposition:metadata=0|disposition:dependent=0|disposition:still_image=0|tag:E=mc²|tag:encoder=Lavc pcm_s16le
>  stream|index=1|codec_name=rawvideo|profile=unknown|codec_type=video|codec_tag_string=RGB[24]|codec_tag=0x18424752|width=320|height=240|coded_width=320|coded_height=240|closed_captions=0|film_grain=0|has_b_frames=0|sample_aspect_ratio=1:1|display_aspect_ratio=4:3|pix_fmt=rgb24|level=-99|color_range=unknown|color_space=unknown|color_transfer=unknown|color_primaries=unknown|chroma_location=unspecified|field_order=unknown|refs=1|id=N/A|r_frame_rate=25/1|avg_frame_rate=25/1|time_base=1/51200|start_pts=0|start_time=0.000000|duration_ts=N/A|duration=N/A|bit_rate=N/A|max_bit_rate=N/A|bits_per_raw_sample=N/A|nb_frames=N/A|nb_read_frames=4|nb_read_packets=4|disposition:default=1|disposition:dub=0|disposition:original=0|disposition:comment=0|disposition:lyrics=0|disposition:karaoke=0|disposition:forced=0|disposition:hearing_impaired=0|disposition:visual_impaired=0|disposition:clean_effects=0|disposition:attached_pic=0|disposition:timed_thumbnails=0|disposition:captions=0|disposition:descriptions=0|disposition:metadata=0|disposition:dependent=0|disposition:still_image=0|tag:title=foobar|tag:duration_ts=field-and-tags-conflict-attempt|tag:encoder=Lavc rawvideo
>  stream|index=2|codec_name=rawvideo|profile=unknown|codec_type=video|codec_tag_string=RGB[24]|codec_tag=0x18424752|width=100|height=100|coded_width=100|coded_height=100|closed_captions=0|film_grain=0|has_b_frames=0|sample_aspect_ratio=1:1|display_aspect_ratio=1:1|pix_fmt=rgb24|level=-99|color_range=unknown|color_space=unknown|color_transfer=unknown|color_primaries=unknown|chroma_location=unspecified|field_order=unknown|refs=1|id=N/A|r_frame_rate=25/1|avg_frame_rate=25/1|time_base=1/51200|start_pts=0|start_time=0.000000|duration_ts=N/A|duration=N/A|bit_rate=N/A|max_bit_rate=N/A|bits_per_raw_sample=N/A|nb_frames=N/A|nb_read_frames=4|nb_read_packets=4|disposition:default=0|disposition:dub=0|disposition:original=0|disposition:comment=0|disposition:lyrics=0|disposition:karaoke=0|disposition:forced=0|disposition:hearing_impaired=0|disposition:visual_impaired=0|disposition:clean_effects=0|disposition:attached_pic=0|disposition:timed_thumbnails=0|disposition:captions=0|disposition:descriptions=0|disposition:metadata=0|disposition:dependent=0|disposition:still_image=0|tag:encoder=Lavc rawvideo
>  format|filename=tests/data/ffprobe-test.nut|nb_streams=3|nb_programs=0|format_name=nut|start_time=0.000000|duration=0.120000|size=1053646|bit_rate=70243066|probe_score=100|tag:title=ffprobe test file|tag:comment='A comment with CSV, XML & JSON special chars': <tag value="x">|tag:comment2=I ♥ Üñîçød€
> diff --git a/tests/ref/fate/ffprobe_csv b/tests/ref/fate/ffprobe_csv
> index 7af4db7bc0..22a997c55f 100644
> --- a/tests/ref/fate/ffprobe_csv
> +++ b/tests/ref/fate/ffprobe_csv
> @@ -26,7 +26,7 @@ packet,video,1,6144,0.120000,6144,0.120000,2048,0.040000,230400,793142,K_
>  frame,video,1,1,6144,0.120000,6144,0.120000,6144,0.120000,2048,0.040000,2048,0.040000,793142,230400,320,240,rgb24,1:1,I,0,0,0,0,0,unknown,unknown,unknown,unknown,unspecified
>  packet,video,2,6144,0.120000,6144,0.120000,2048,0.040000,30000,1023566,K_
>  frame,video,2,1,6144,0.120000,6144,0.120000,6144,0.120000,2048,0.040000,2048,0.040000,1023566,30000,100,100,rgb24,1:1,I,0,0,0,0,0,unknown,unknown,unknown,unknown,unspecified
> -stream,0,pcm_s16le,unknown,audio,PSD[16],0x10445350,s16,44100,1,unknown,16,N/A,0/0,0/0,1/44100,0,0.000000,N/A,N/A,705600,N/A,N/A,N/A,6,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,mc²,Lavc pcm_s16le
> +stream,0,pcm_s16le,unknown,audio,PSD[16],0x10445350,s16,44100,1,unknown,16,0,0,N/A,0/0,0/0,1/44100,0,0.000000,N/A,N/A,705600,N/A,N/A,N/A,6,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,mc²,Lavc pcm_s16le
>  stream,1,rawvideo,unknown,video,RGB[24],0x18424752,320,240,320,240,0,0,0,1:1,4:3,rgb24,-99,unknown,unknown,unknown,unknown,unspecified,unknown,1,N/A,25/1,25/1,1/51200,0,0.000000,N/A,N/A,N/A,N/A,N/A,N/A,4,4,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,foobar,field-and-tags-conflict-attempt,Lavc rawvideo
>  stream,2,rawvideo,unknown,video,RGB[24],0x18424752,100,100,100,100,0,0,0,1:1,1:1,rgb24,-99,unknown,unknown,unknown,unknown,unspecified,unknown,1,N/A,25/1,25/1,1/51200,0,0.000000,N/A,N/A,N/A,N/A,N/A,N/A,4,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,Lavc rawvideo
>  format,tests/data/ffprobe-test.nut,3,0,nut,0.000000,0.120000,1053646,70243066,100,ffprobe test file,"'A comment with CSV, XML & JSON special chars': <tag value=""x"">",I ♥ Üñîçød€
> diff --git a/tests/ref/fate/ffprobe_default b/tests/ref/fate/ffprobe_default
> index f296fc0dc2..6541b8950f 100644
> --- a/tests/ref/fate/ffprobe_default
> +++ b/tests/ref/fate/ffprobe_default
> @@ -574,6 +574,8 @@ sample_rate=44100
>  channels=1
>  channel_layout=unknown
>  bits_per_sample=16
> +initial_padding=0
> +trailing_padding=0
>  id=N/A
>  r_frame_rate=0/0
>  avg_frame_rate=0/0
> diff --git a/tests/ref/fate/ffprobe_flat b/tests/ref/fate/ffprobe_flat
> index 655c0fe836..d72166c361 100644
> --- a/tests/ref/fate/ffprobe_flat
> +++ b/tests/ref/fate/ffprobe_flat
> @@ -517,6 +517,8 @@ streams.stream.0.sample_rate="44100"
>  streams.stream.0.channels=1
>  streams.stream.0.channel_layout="unknown"
>  streams.stream.0.bits_per_sample=16
> +streams.stream.0.initial_padding=0
> +streams.stream.0.trailing_padding=0
>  streams.stream.0.id="N/A"
>  streams.stream.0.r_frame_rate="0/0"
>  streams.stream.0.avg_frame_rate="0/0"
> diff --git a/tests/ref/fate/ffprobe_ini b/tests/ref/fate/ffprobe_ini
> index 58f508faa6..2c299fc51a 100644
> --- a/tests/ref/fate/ffprobe_ini
> +++ b/tests/ref/fate/ffprobe_ini
> @@ -576,6 +576,8 @@ sample_rate=44100
>  channels=1
>  channel_layout=unknown
>  bits_per_sample=16
> +initial_padding=0
> +trailing_padding=0
>  id=N/A
>  r_frame_rate=0/0
>  avg_frame_rate=0/0
> diff --git a/tests/ref/fate/ffprobe_json b/tests/ref/fate/ffprobe_json
> index 2e8b39f126..2e17195e69 100644
> --- a/tests/ref/fate/ffprobe_json
> +++ b/tests/ref/fate/ffprobe_json
> @@ -558,6 +558,8 @@
>              "sample_rate": "44100",
>              "channels": 1,
>              "bits_per_sample": 16,
> +            "initial_padding": 0,
> +            "trailing_padding": 0,
>              "r_frame_rate": "0/0",
>              "avg_frame_rate": "0/0",
>              "time_base": "1/44100",
> diff --git a/tests/ref/fate/ffprobe_xml b/tests/ref/fate/ffprobe_xml
> index e5152655b9..0cad5b8842 100644
> --- a/tests/ref/fate/ffprobe_xml
> +++ b/tests/ref/fate/ffprobe_xml
> @@ -32,7 +32,7 @@
>      </packets_and_frames>
>  
>      <streams>
> -        <stream index="0" codec_name="pcm_s16le" codec_type="audio" codec_tag_string="PSD[16]" codec_tag="0x10445350" sample_fmt="s16" sample_rate="44100" channels="1" bits_per_sample="16" r_frame_rate="0/0" avg_frame_rate="0/0" time_base="1/44100" start_pts="0" start_time="0.000000" bit_rate="705600" nb_read_frames="6" nb_read_packets="6">
> +        <stream index="0" codec_name="pcm_s16le" codec_type="audio" codec_tag_string="PSD[16]" codec_tag="0x10445350" sample_fmt="s16" sample_rate="44100" channels="1" bits_per_sample="16" initial_padding="0" trailing_padding="0" r_frame_rate="0/0" avg_frame_rate="0/0" time_base="1/44100" start_pts="0" start_time="0.000000" bit_rate="705600" nb_read_frames="6" nb_read_packets="6">
>              <disposition default="0" dub="0" original="0" comment="0" lyrics="0" karaoke="0" forced="0" hearing_impaired="0" visual_impaired="0" clean_effects="0" attached_pic="0" timed_thumbnails="0" captions="0" descriptions="0" metadata="0" dependent="0" still_image="0"/>
>              <tag key="E" value="mc²"/>
>              <tag key="encoder" value="Lavc pcm_s16le"/>
> diff --git a/tests/ref/fate/flv-demux b/tests/ref/fate/flv-demux
> index a7c98d3d76..fc315cec54 100644
> --- a/tests/ref/fate/flv-demux
> +++ b/tests/ref/fate/flv-demux
> @@ -604,5 +604,5 @@ packet|codec_type=video|stream_index=0|pts=11645|pts_time=11.645000|dts=11645|dt
>  packet|codec_type=audio|stream_index=1|pts=11656|pts_time=11.656000|dts=11656|dts_time=11.656000|duration=46|duration_time=0.046000|size=346|pos=510431|flags=K_|data_hash=CRC32:4e6b44cb
>  packet|codec_type=video|stream_index=0|pts=11678|pts_time=11.678000|dts=11678|dts_time=11.678000|duration=33|duration_time=0.033000|size=1190|pos=510794|flags=__|data_hash=CRC32:a0206c90
>  stream|index=0|codec_name=h264|profile=77|codec_type=video|codec_tag_string=[0][0][0][0]|codec_tag=0x0000|width=426|height=240|coded_width=426|coded_height=240|closed_captions=0|film_grain=0|has_b_frames=1|sample_aspect_ratio=1:1|display_aspect_ratio=71:40|pix_fmt=yuv420p|level=21|color_range=unknown|color_space=unknown|color_transfer=unknown|color_primaries=unknown|chroma_location=left|field_order=progressive|refs=1|is_avc=true|nal_length_size=4|id=N/A|r_frame_rate=30000/1001|avg_frame_rate=30/1|time_base=1/1000|start_pts=0|start_time=0.000000|duration_ts=N/A|duration=N/A|bit_rate=393929|max_bit_rate=N/A|bits_per_raw_sample=8|nb_frames=N/A|nb_read_frames=N/A|nb_read_packets=351|extradata_size=39|extradata_hash=CRC32:07b85ca9|disposition:default=0|disposition:dub=0|disposition:original=0|disposition:comment=0|disposition:lyrics=0|disposition:karaoke=0|disposition:forced=0|disposition:hearing_impaired=0|disposition:visual_impaired=0|disposition:clean_effects=0|disposition:attached_pic=0|disposition:timed_thumbnails=0|disposition:captions=0|disposition:descriptions=0|disposition:metadata=0|disposition:dependent=0|disposition:still_image=0
> -stream|index=1|codec_name=aac|profile=1|codec_type=audio|codec_tag_string=[0][0][0][0]|codec_tag=0x0000|sample_fmt=fltp|sample_rate=22050|channels=2|channel_layout=stereo|bits_per_sample=0|id=N/A|r_frame_rate=0/0|avg_frame_rate=0/0|time_base=1/1000|start_pts=0|start_time=0.000000|duration_ts=N/A|duration=N/A|bit_rate=67874|max_bit_rate=N/A|bits_per_raw_sample=N/A|nb_frames=N/A|nb_read_frames=N/A|nb_read_packets=252|extradata_size=2|extradata_hash=CRC32:d039c029|disposition:default=0|disposition:dub=0|disposition:original=0|disposition:comment=0|disposition:lyrics=0|disposition:karaoke=0|disposition:forced=0|disposition:hearing_impaired=0|disposition:visual_impaired=0|disposition:clean_effects=0|disposition:attached_pic=0|disposition:timed_thumbnails=0|disposition:captions=0|disposition:descriptions=0|disposition:metadata=0|disposition:dependent=0|disposition:still_image=0
> +stream|index=1|codec_name=aac|profile=1|codec_type=audio|codec_tag_string=[0][0][0][0]|codec_tag=0x0000|sample_fmt=fltp|sample_rate=22050|channels=2|channel_layout=stereo|bits_per_sample=0|initial_padding=0|trailing_padding=0|id=N/A|r_frame_rate=0/0|avg_frame_rate=0/0|time_base=1/1000|start_pts=0|start_time=0.000000|duration_ts=N/A|duration=N/A|bit_rate=67874|max_bit_rate=N/A|bits_per_raw_sample=N/A|nb_frames=N/A|nb_read_frames=N/A|nb_read_packets=252|extradata_size=2|extradata_hash=CRC32:d039c029|disposition:default=0|disposition:dub=0|disposition:original=0|disposition:comment=0|disposition:lyrics=0|disposition:karaoke=0|disposition:forced=0|disposition:hearing_impaired=0|disposition:visual_impaired=0|disposition:clean_effects=0|disposition:attached_pic=0|disposition:timed_thumbnails=0|disposition:captions=0|disposition:descriptions=0|disposition:metadata=0|disposition:dependent=0|disposition:still_image=0
>  format|filename=Enigma_Principles_of_Lust-part.flv|nb_streams=2|nb_programs=0|format_name=flv|start_time=0.000000|duration=210.209999|size=512000|bit_rate=19485|probe_score=100|tag:hasKeyframes=true|tag:hasMetadata=true|tag:datasize=11970544|tag:hasVideo=true|tag:canSeekToEnd=false|tag:lasttimestamp=210|tag:lastkeyframetimestamp=210|tag:audiosize=1791332|tag:hasAudio=true|tag:audiodelay=0|tag:videosize=10176110|tag:metadatadate=2011-02-27T11:00:33.125000Z|tag:metadatacreator=inlet media FLVTool2 v1.0.6 - http://www.inlet-media.de/flvtool2|tag:hasCuePoints=false
> diff --git a/tests/ref/fate/gapless-mp3-side-data b/tests/ref/fate/gapless-mp3-side-data
> index 59907f8ca4..6579b980aa 100644
> --- a/tests/ref/fate/gapless-mp3-side-data
> +++ b/tests/ref/fate/gapless-mp3-side-data
> @@ -596,5 +596,5 @@ packet|codec_type=audio|stream_index=0|pts=218603520|pts_time=15.490612|dts=2186
>  |data_hash=CRC32:d5fb5f9c
>  packet|codec_type=audio|stream_index=0|pts=218972160|pts_time=15.516735|dts=218972160|dts_time=15.516735|duration=368640|duration_time=0.026122|size=418|pos=249718|flags=K_|side_data|side_data_type=Skip Samples|skip_samples=0|discard_padding=1152|skip_reason=0|discard_reason=0
>  |data_hash=CRC32:3789f3cf
> -stream|index=0|codec_name=mp3|profile=unknown|codec_type=audio|codec_tag_string=[0][0][0][0]|codec_tag=0x0000|sample_fmt=fltp|sample_rate=44100|channels=2|channel_layout=stereo|bits_per_sample=0|id=N/A|r_frame_rate=0/0|avg_frame_rate=0/0|time_base=1/14112000|start_pts=353600|start_time=0.025057|duration_ts=219340800|duration=15.542857|bit_rate=128000|max_bit_rate=N/A|bits_per_raw_sample=N/A|nb_frames=N/A|nb_read_frames=N/A|nb_read_packets=595|disposition:default=0|disposition:dub=0|disposition:original=0|disposition:comment=0|disposition:lyrics=0|disposition:karaoke=0|disposition:forced=0|disposition:hearing_impaired=0|disposition:visual_impaired=0|disposition:clean_effects=0|disposition:attached_pic=0|disposition:timed_thumbnails=0|disposition:captions=0|disposition:descriptions=0|disposition:metadata=0|disposition:dependent=0|disposition:still_image=0|tag:encoder=LAME3.93
> +stream|index=0|codec_name=mp3|profile=unknown|codec_type=audio|codec_tag_string=[0][0][0][0]|codec_tag=0x0000|sample_fmt=fltp|sample_rate=44100|channels=2|channel_layout=stereo|bits_per_sample=0|initial_padding=0|trailing_padding=0|id=N/A|r_frame_rate=0/0|avg_frame_rate=0/0|time_base=1/14112000|start_pts=353600|start_time=0.025057|duration_ts=219340800|duration=15.542857|bit_rate=128000|max_bit_rate=N/A|bits_per_raw_sample=N/A|nb_frames=N/A|nb_read_frames=N/A|nb_read_packets=595|disposition:default=0|disposition:dub=0|disposition:original=0|disposition:comment=0|disposition:lyrics=0|disposition:karaoke=0|disposition:forced=0|disposition:hearing_impaired=0|disposition:visual_impaired=0|disposition:clean_effects=0|disposition:attached_pic=0|disposition:timed_thumbnails=0|disposition:captions=0|disposition:descriptions=0|disposition:metadata=0|disposition:dependent=0|disposition:still_image=0|tag:encoder=LAME3.93 
>  format|filename=gapless.mp3|nb_streams=1|nb_programs=0|format_name=mp3|start_time=0.025057|duration=15.542857|size=250264|bit_rate=128812|probe_score=51|tag:title=test
> diff --git a/tests/ref/fate/mxf-probe-applehdr10 b/tests/ref/fate/mxf-probe-applehdr10
> index 90eefad6ad..e0803239ba 100644
> --- a/tests/ref/fate/mxf-probe-applehdr10
> +++ b/tests/ref/fate/mxf-probe-applehdr10
> @@ -86,6 +86,8 @@ sample_rate=48000
>  channels=1
>  channel_layout=unknown
>  bits_per_sample=24
> +initial_padding=0
> +trailing_padding=0
>  id=N/A
>  r_frame_rate=0/0
>  avg_frame_rate=0/0
> @@ -131,6 +133,8 @@ sample_rate=48000
>  channels=1
>  channel_layout=unknown
>  bits_per_sample=24
> +initial_padding=0
> +trailing_padding=0
>  id=N/A
>  r_frame_rate=0/0
>  avg_frame_rate=0/0
> diff --git a/tests/ref/fate/mxf-probe-d10 b/tests/ref/fate/mxf-probe-d10
> index b2692c6513..2897a3a821 100644
> --- a/tests/ref/fate/mxf-probe-d10
> +++ b/tests/ref/fate/mxf-probe-d10
> @@ -77,6 +77,8 @@ sample_rate=48000
>  channels=8
>  channel_layout=unknown
>  bits_per_sample=16
> +initial_padding=0
> +trailing_padding=0
>  id=N/A
>  r_frame_rate=0/0
>  avg_frame_rate=0/0
> diff --git a/tests/ref/fate/mxf-probe-dv25 b/tests/ref/fate/mxf-probe-dv25
> index 67a510fc5c..7408d4fd60 100644
> --- a/tests/ref/fate/mxf-probe-dv25
> +++ b/tests/ref/fate/mxf-probe-dv25
> @@ -68,6 +68,8 @@ sample_rate=48000
>  channels=1
>  channel_layout=unknown
>  bits_per_sample=16
> +initial_padding=0
> +trailing_padding=0
>  id=N/A
>  r_frame_rate=0/0
>  avg_frame_rate=0/0
> @@ -113,6 +115,8 @@ sample_rate=48000
>  channels=1
>  channel_layout=unknown
>  bits_per_sample=16
> +initial_padding=0
> +trailing_padding=0
>  id=N/A
>  r_frame_rate=0/0
>  avg_frame_rate=0/0
> diff --git a/tests/ref/fate/oggopus-demux b/tests/ref/fate/oggopus-demux
> index 7ea5dfe8a0..ce375bc037 100644
> --- a/tests/ref/fate/oggopus-demux
> +++ b/tests/ref/fate/oggopus-demux
> @@ -41,5 +41,5 @@ packet|codec_type=audio|stream_index=0|pts=36124|pts_time=0.752583|dts=36124|dts
>  packet|codec_type=audio|stream_index=0|pts=37084|pts_time=0.772583|dts=37084|dts_time=0.772583|duration=960|duration_time=0.020000|size=217|pos=841|flags=K_|data_hash=CRC32:06797ece
>  packet|codec_type=audio|stream_index=0|pts=38044|pts_time=0.792583|dts=38044|dts_time=0.792583|duration=356|duration_time=0.007417|size=359|pos=841|flags=K_|side_data|side_data_type=Skip Samples|skip_samples=0|discard_padding=604|skip_reason=0|discard_reason=0
>  |data_hash=CRC32:01ca3f8f
> -stream|index=0|codec_name=opus|profile=unknown|codec_type=audio|codec_tag_string=[0][0][0][0]|codec_tag=0x0000|sample_fmt=fltp|sample_rate=48000|channels=2|channel_layout=stereo|bits_per_sample=0|id=N/A|r_frame_rate=0/0|avg_frame_rate=0/0|time_base=1/48000|start_pts=0|start_time=0.000000|duration_ts=38756|duration=0.807417|bit_rate=N/A|max_bit_rate=N/A|bits_per_raw_sample=N/A|nb_frames=N/A|nb_read_frames=N/A|nb_read_packets=41|extradata_size=19|extradata_hash=CRC32:58ba5ff3|disposition:default=0|disposition:dub=0|disposition:original=0|disposition:comment=0|disposition:lyrics=0|disposition:karaoke=0|disposition:forced=0|disposition:hearing_impaired=0|disposition:visual_impaired=0|disposition:clean_effects=0|disposition:attached_pic=0|disposition:timed_thumbnails=0|disposition:captions=0|disposition:descriptions=0|disposition:metadata=0|disposition:dependent=0|disposition:still_image=0|tag:ENCODER=opusenc from opus-tools 0.1.9|tag:ENCODER_OPTIONS=--discard-comments
> +stream|index=0|codec_name=opus|profile=unknown|codec_type=audio|codec_tag_string=[0][0][0][0]|codec_tag=0x0000|sample_fmt=fltp|sample_rate=48000|channels=2|channel_layout=stereo|bits_per_sample=0|initial_padding=356|trailing_padding=0|id=N/A|r_frame_rate=0/0|avg_frame_rate=0/0|time_base=1/48000|start_pts=0|start_time=0.000000|duration_ts=38756|duration=0.807417|bit_rate=N/A|max_bit_rate=N/A|bits_per_raw_sample=N/A|nb_frames=N/A|nb_read_frames=N/A|nb_read_packets=41|extradata_size=19|extradata_hash=CRC32:58ba5ff3|disposition:default=0|disposition:dub=0|disposition:original=0|disposition:comment=0|disposition:lyrics=0|disposition:karaoke=0|disposition:forced=0|disposition:hearing_impaired=0|disposition:visual_impaired=0|disposition:clean_effects=0|disposition:attached_pic=0|disposition:timed_thumbnails=0|disposition:captions=0|disposition:descriptions=0|disposition:metadata=0|disposition:dependent=0|disposition:still_image=0|tag:ENCODER=opusenc from opus-tools 0.1.9|tag:ENCODER_OPTIONS=--discard-comments
>  format|filename=intro-partial.opus|nb_streams=1|nb_programs=0|format_name=ogg|start_time=0.000000|duration=0.807417|size=10250|bit_rate=101558|probe_score=100
> diff --git a/tests/ref/fate/ts-demux b/tests/ref/fate/ts-demux
> index a90c65ce1c..e6c35a990f 100644
> --- a/tests/ref/fate/ts-demux
> +++ b/tests/ref/fate/ts-demux
> @@ -42,6 +42,6 @@ packet|codec_type=video|stream_index=0|pts=3912686363|pts_time=43474.292922|dts=
>  packet|codec_type=audio|stream_index=1|pts=3912644825|pts_time=43473.831389|dts=3912644825|dts_time=43473.831389|duration=2880|duration_time=0.032000|size=906|pos=474888|flags=K_|data_hash=CRC32:0893d398
>  packet|codec_type=audio|stream_index=2|pts=3912645580|pts_time=43473.839778|dts=3912645580|dts_time=43473.839778|duration=2880|duration_time=0.032000|size=354|pos=491808|flags=K_|data_hash=CRC32:f5963fa6
>  stream|index=0|codec_name=mpeg2video|profile=4|codec_type=video|codec_tag_string=[2][0][0][0]|codec_tag=0x0002|width=1280|height=720|coded_width=0|coded_height=0|closed_captions=0|film_grain=0|has_b_frames=1|sample_aspect_ratio=1:1|display_aspect_ratio=16:9|pix_fmt=yuv420p|level=4|color_range=tv|color_space=unknown|color_transfer=unknown|color_primaries=unknown|chroma_location=left|field_order=progressive|refs=1|id=0x31|r_frame_rate=60000/1001|avg_frame_rate=60000/1001|time_base=1/90000|start_pts=3912669846|start_time=43474.109400|duration_ts=19519|duration=0.216878|bit_rate=15000000|max_bit_rate=N/A|bits_per_raw_sample=N/A|nb_frames=N/A|nb_read_frames=N/A|nb_read_packets=15|extradata_size=150|extradata_hash=CRC32:53134fa8|disposition:default=0|disposition:dub=0|disposition:original=0|disposition:comment=0|disposition:lyrics=0|disposition:karaoke=0|disposition:forced=0|disposition:hearing_impaired=0|disposition:visual_impaired=0|disposition:clean_effects=0|disposition:attached_pic=0|disposition:timed_thumbnails=0|disposition:captions=0|disposition:descriptions=0|disposition:metadata=0|disposition:dependent=0|disposition:still_image=0|side_data|side_data_type=CPB properties|max_bitrate=15000000|min_bitrate=0|avg_bitrate=0|buffer_size=9781248|vbv_delay=-1
> -stream|index=1|codec_name=ac3|profile=unknown|codec_type=audio|codec_tag_string=[4][0][0][0]|codec_tag=0x0004|sample_fmt=fltp|sample_rate=48000|channels=6|channel_layout=5.1(side)|bits_per_sample=0|id=0x34|r_frame_rate=0/0|avg_frame_rate=0/0|time_base=1/90000|start_pts=3912633305|start_time=43473.703389|duration_ts=14400|duration=0.160000|bit_rate=384000|max_bit_rate=N/A|bits_per_raw_sample=N/A|nb_frames=N/A|nb_read_frames=N/A|nb_read_packets=5|disposition:default=0|disposition:dub=0|disposition:original=0|disposition:comment=0|disposition:lyrics=0|disposition:karaoke=0|disposition:forced=0|disposition:hearing_impaired=0|disposition:visual_impaired=0|disposition:clean_effects=0|disposition:attached_pic=0|disposition:timed_thumbnails=0|disposition:captions=0|disposition:descriptions=0|disposition:metadata=0|disposition:dependent=0|disposition:still_image=0|tag:language=eng
> -stream|index=2|codec_name=ac3|profile=unknown|codec_type=audio|codec_tag_string=[4][0][0][0]|codec_tag=0x0004|sample_fmt=fltp|sample_rate=48000|channels=2|channel_layout=stereo|bits_per_sample=0|id=0x35|r_frame_rate=0/0|avg_frame_rate=0/0|time_base=1/90000|start_pts=3912634060|start_time=43473.711778|duration_ts=14400|duration=0.160000|bit_rate=192000|max_bit_rate=N/A|bits_per_raw_sample=N/A|nb_frames=N/A|nb_read_frames=N/A|nb_read_packets=5|disposition:default=0|disposition:dub=0|disposition:original=0|disposition:comment=0|disposition:lyrics=0|disposition:karaoke=0|disposition:forced=0|disposition:hearing_impaired=0|disposition:visual_impaired=0|disposition:clean_effects=0|disposition:attached_pic=0|disposition:timed_thumbnails=0|disposition:captions=0|disposition:descriptions=0|disposition:metadata=0|disposition:dependent=0|disposition:still_image=0|tag:language=es
> +stream|index=1|codec_name=ac3|profile=unknown|codec_type=audio|codec_tag_string=[4][0][0][0]|codec_tag=0x0004|sample_fmt=fltp|sample_rate=48000|channels=6|channel_layout=5.1(side)|bits_per_sample=0|initial_padding=0|trailing_padding=0|id=0x34|r_frame_rate=0/0|avg_frame_rate=0/0|time_base=1/90000|start_pts=3912633305|start_time=43473.703389|duration_ts=14400|duration=0.160000|bit_rate=384000|max_bit_rate=N/A|bits_per_raw_sample=N/A|nb_frames=N/A|nb_read_frames=N/A|nb_read_packets=5|disposition:default=0|disposition:dub=0|disposition:original=0|disposition:comment=0|disposition:lyrics=0|disposition:karaoke=0|disposition:forced=0|disposition:hearing_impaired=0|disposition:visual_impaired=0|disposition:clean_effects=0|disposition:attached_pic=0|disposition:timed_thumbnails=0|disposition:captions=0|disposition:descriptions=0|disposition:metadata=0|disposition:dependent=0|disposition:still_image=0|tag:language=eng
> +stream|index=2|codec_name=ac3|profile=unknown|codec_type=audio|codec_tag_string=[4][0][0][0]|codec_tag=0x0004|sample_fmt=fltp|sample_rate=48000|channels=2|channel_layout=stereo|bits_per_sample=0|initial_padding=0|trailing_padding=0|id=0x35|r_frame_rate=0/0|avg_frame_rate=0/0|time_base=1/90000|start_pts=3912634060|start_time=43473.711778|duration_ts=14400|duration=0.160000|bit_rate=192000|max_bit_rate=N/A|bits_per_raw_sample=N/A|nb_frames=N/A|nb_read_frames=N/A|nb_read_packets=5|disposition:default=0|disposition:dub=0|disposition:original=0|disposition:comment=0|disposition:lyrics=0|disposition:karaoke=0|disposition:forced=0|disposition:hearing_impaired=0|disposition:visual_impaired=0|disposition:clean_effects=0|disposition:attached_pic=0|disposition:timed_thumbnails=0|disposition:captions=0|disposition:descriptions=0|disposition:metadata=0|disposition:dependent=0|disposition:still_image=0|tag:language=es
>  format|filename=mp3ac325-4864-small.ts|nb_streams=3|nb_programs=1|format_name=mpegts|start_time=43473.703389|duration=0.622889|size=512000|bit_rate=6575810|probe_score=50
> diff --git a/tests/ref/fate/ts-opus-demux b/tests/ref/fate/ts-opus-demux
> index ba6059a019..193d94889a 100644
> --- a/tests/ref/fate/ts-opus-demux
> +++ b/tests/ref/fate/ts-opus-demux
> @@ -1022,5 +1022,5 @@ packet|codec_type=audio|stream_index=0|pts=918000|pts_time=10.200000|dts=918000|
>  |data_hash=CRC32:75113c11
>  packet|codec_type=audio|stream_index=0|pts=919800|pts_time=10.220000|dts=919800|dts_time=10.220000|duration=1800|duration_time=0.020000|size=759|pos=510984|flags=K_|side_data|side_data_type=MPEGTS Stream ID|id=189
>  |data_hash=CRC32:59fc266f
> -stream|index=0|codec_name=opus|profile=unknown|codec_type=audio|codec_tag_string=Opus|codec_tag=0x7375704f|sample_fmt=fltp|sample_rate=48000|channels=8|channel_layout=7.1|bits_per_sample=0|id=0x44|r_frame_rate=0/0|avg_frame_rate=0/0|time_base=1/90000|start_pts=0|start_time=0.000000|duration_ts=919800|duration=10.220000|bit_rate=N/A|max_bit_rate=N/A|bits_per_raw_sample=N/A|nb_frames=N/A|nb_read_frames=N/A|nb_read_packets=512|extradata_size=29|extradata_hash=CRC32:6d6089a7|disposition:default=0|disposition:dub=0|disposition:original=0|disposition:comment=0|disposition:lyrics=0|disposition:karaoke=0|disposition:forced=0|disposition:hearing_impaired=0|disposition:visual_impaired=0|disposition:clean_effects=0|disposition:attached_pic=0|disposition:timed_thumbnails=0|disposition:captions=0|disposition:descriptions=0|disposition:metadata=0|disposition:dependent=0|disposition:still_image=0
> +stream|index=0|codec_name=opus|profile=unknown|codec_type=audio|codec_tag_string=Opus|codec_tag=0x7375704f|sample_fmt=fltp|sample_rate=48000|channels=8|channel_layout=7.1|bits_per_sample=0|initial_padding=0|trailing_padding=0|id=0x44|r_frame_rate=0/0|avg_frame_rate=0/0|time_base=1/90000|start_pts=0|start_time=0.000000|duration_ts=919800|duration=10.220000|bit_rate=N/A|max_bit_rate=N/A|bits_per_raw_sample=N/A|nb_frames=N/A|nb_read_frames=N/A|nb_read_packets=512|extradata_size=29|extradata_hash=CRC32:6d6089a7|disposition:default=0|disposition:dub=0|disposition:original=0|disposition:comment=0|disposition:lyrics=0|disposition:karaoke=0|disposition:forced=0|disposition:hearing_impaired=0|disposition:visual_impaired=0|disposition:clean_effects=0|disposition:attached_pic=0|disposition:timed_thumbnails=0|disposition:captions=0|disposition:descriptions=0|disposition:metadata=0|disposition:dependent=0|disposition:still_image=0
>  format|filename=test-8-7.1.opus-small.ts|nb_streams=1|nb_programs=1|format_name=mpegts|start_time=0.000000|duration=10.220000|size=512000|bit_rate=400782|probe_score=50

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

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

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [FFmpeg-devel] [PATCH 1/8] fftools/ffprobe: Report initial and trailing padding
@ 2022-09-06  7:55   ` Anton Khirnov
  2022-09-06  9:31     ` Andreas Rheinhardt
  0 siblings, 1 reply; 11+ messages in thread
From: Anton Khirnov @ 2022-09-06  7:55 UTC (permalink / raw)
  To: FFmpeg development discussions and patches

Quoting Andreas Rheinhardt (2022-09-05 00:52:23)
> Andreas Rheinhardt:
> > Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
> > ---
> > trailing_padding seems to be unused and could actually be deprecated.
> > 
> 
> Will apply this patchset tomorrow unless there are objections. Notice
> that I really like to have a second opinion on whether trailing_padding
> should be printed at all.

Do we have another mechanism for signalling that the last frame was
padded?

-- 
Anton Khirnov
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [FFmpeg-devel] [PATCH 1/8] fftools/ffprobe: Report initial and trailing padding
  2022-09-06  7:55   ` Anton Khirnov
@ 2022-09-06  9:31     ` Andreas Rheinhardt
  0 siblings, 0 replies; 11+ messages in thread
From: Andreas Rheinhardt @ 2022-09-06  9:31 UTC (permalink / raw)
  To: ffmpeg-devel

Anton Khirnov:
> Quoting Andreas Rheinhardt (2022-09-05 00:52:23)
>> Andreas Rheinhardt:
>>> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
>>> ---
>>> trailing_padding seems to be unused and could actually be deprecated.
>>>
>>
>> Will apply this patchset tomorrow unless there are objections. Notice
>> that I really like to have a second opinion on whether trailing_padding
>> should be printed at all.
> 
> Do we have another mechanism for signalling that the last frame was
> padded?
> 

AV_PKT_DATA_SKIP_SAMPLES of course. It is even supported by a few
(de)muxers, contrary to trailing_padding.
(Btw: I applied this patch with initial_padding, but without
trailing_padding.)

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

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

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2022-09-06  9:31 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-01 20:38 [FFmpeg-devel] [PATCH 1/8] fftools/ffprobe: Report initial and trailing padding Andreas Rheinhardt
2022-09-01 21:23 ` [FFmpeg-devel] [PATCH 2/8] fate/matroska: Add tests for muxing with initial_padding Andreas Rheinhardt
2022-09-01 21:23 ` [FFmpeg-devel] [PATCH 3/8] avformat/matroskaenc: Only write DiscardPadding if nonzero Andreas Rheinhardt
2022-09-01 21:23 ` [FFmpeg-devel] [PATCH 4/8] avformat/matroskaenc: Don't override samplerate for CodecDelay Andreas Rheinhardt
2022-09-01 21:24 ` [FFmpeg-devel] [PATCH 5/8] avformat/matroskaenc: Actually apply timestamp offset for Opus Andreas Rheinhardt
2022-09-01 21:24 ` [FFmpeg-devel] [PATCH 6/8] avformat/mux: Allow muxers to set custom min timestamp Andreas Rheinhardt
2022-09-01 21:24 ` [FFmpeg-devel] [PATCH 7/8] avformat/matroskaenc: Use " Andreas Rheinhardt
2022-09-01 21:24 ` [FFmpeg-devel] [PATCH 8/8] avformat/matroskaenc: Write CodecDelay for codecs != Opus Andreas Rheinhardt
2022-09-04 22:52 ` [FFmpeg-devel] [PATCH 1/8] fftools/ffprobe: Report initial and trailing padding Andreas Rheinhardt
2022-09-06  7:55   ` Anton Khirnov
2022-09-06  9:31     ` Andreas Rheinhardt

Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
		ffmpegdev@gitmailbox.com
	public-inbox-index ffmpegdev

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git