* [FFmpeg-devel] [PATCH] avformat/mpegts: Add AVFMT_FLAG_ALLOW_CODEC_CHANGES (v2)
@ 2025-06-30 3:55 Pavel Koshevoy
2025-06-30 21:45 ` Scott Theisen
0 siblings, 1 reply; 9+ messages in thread
From: Pavel Koshevoy @ 2025-06-30 3:55 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Pavel Koshevoy
Make midstream AVStream.codecpar updates optional and disabled
by default, so that avformat API clients can enable this feature
explicitly when they add support for midstream codec changes.
---
doc/APIchanges | 3 +++
libavformat/avformat.h | 2 ++
libavformat/mpegts.c | 4 +++-
libavformat/version.h | 4 ++--
tests/ref/fate/ts-demux | 4 ++--
5 files changed, 12 insertions(+), 5 deletions(-)
diff --git a/doc/APIchanges b/doc/APIchanges
index 91710bb27d..43172fbcdd 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -2,6 +2,9 @@ The last version increases of all libraries were on 2025-03-28
API changes, most recent first:
+2025-06-17 - xxxxxxxxxx - lavf 62.2.100 - avformat.h
+ Add AVFMT_FLAG_ALLOW_CODEC_CHANGES flag.
+
2025-05-21 - xxxxxxxxxx - lavu 60.3.100 - avassert.h
Add av_unreachable() and av_assume() macros.
diff --git a/libavformat/avformat.h b/libavformat/avformat.h
index b6c63e2237..2e5232c96d 100644
--- a/libavformat/avformat.h
+++ b/libavformat/avformat.h
@@ -1436,6 +1436,8 @@ typedef struct AVFormatContext {
#define AVFMT_FLAG_FAST_SEEK 0x80000 ///< Enable fast, but inaccurate seeks for some formats
#define AVFMT_FLAG_AUTO_BSF 0x200000 ///< Add bitstream filters as requested by the muxer
+#define AVFMT_FLAG_ALLOW_CODEC_CHANGES 0x400000 ///< Allow AVStream.codecpar to be updated midstream if input changes (e.g. MPEG-TS ES stream_type changes)
+
/**
* Maximum number of bytes read from input in order to determine stream
* properties. Used when reading the global header and in
diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c
index deb69a0548..ed4ff580e5 100644
--- a/libavformat/mpegts.c
+++ b/libavformat/mpegts.c
@@ -2510,7 +2510,9 @@ static void pmt_cb(MpegTSFilter *filter, const uint8_t *section, int section_len
if (!st)
goto out;
- if (pes && pes->stream_type != stream_type)
+ if (pes && (!pes->stream_type ||
+ (pes->stream_type != stream_type &&
+ !!(ts->stream->flags & AVFMT_FLAG_ALLOW_CODEC_CHANGES))))
mpegts_set_stream_info(st, pes, stream_type, prog_reg_desc);
add_pid_to_program(prg, pid);
diff --git a/libavformat/version.h b/libavformat/version.h
index b32ddb3617..904e7f06aa 100644
--- a/libavformat/version.h
+++ b/libavformat/version.h
@@ -31,8 +31,8 @@
#include "version_major.h"
-#define LIBAVFORMAT_VERSION_MINOR 1
-#define LIBAVFORMAT_VERSION_MICRO 101
+#define LIBAVFORMAT_VERSION_MINOR 2
+#define LIBAVFORMAT_VERSION_MICRO 100
#define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \
LIBAVFORMAT_VERSION_MINOR, \
diff --git a/tests/ref/fate/ts-demux b/tests/ref/fate/ts-demux
index d56cc27937..6a830d0d99 100644
--- a/tests/ref/fate/ts-demux
+++ b/tests/ref/fate/ts-demux
@@ -24,6 +24,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|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|ts_id=32776|ts_packetsize=188|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:non_diegetic=0|disposition:captions=0|disposition:descriptions=0|disposition:metadata=0|disposition:dependent=0|disposition:still_image=0|disposition:multilayer=0|side_datum/cpb_properties:side_data_type=CPB properties|side_datum/cpb_properties:max_bitrate=15000000|side_datum/cpb_properties:min_bitrate=0|side_datum/cpb_properties:avg_bitrate=0|side_datum/cpb_properties:buffer_size=9781248|side_datum/cpb_properties:vbv_delay=-1
-stream|index=1|codec_name=ac3|profile=unknown|codec_type=audio|codec_tag_string=[6][0][0][0]|codec_tag=0x0006|sample_fmt=fltp|sample_rate=48000|channels=6|channel_layout=5.1(side)|bits_per_sample=0|initial_padding=0|dmix_mode=0|ltrt_cmixlev=0.000000|ltrt_surmixlev=0.000000|loro_cmixlev=0.000000|loro_surmixlev=0.000000|ts_id=32776|ts_packetsize=188|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:non_diegetic=0|disposition:captions=0|disposition:descriptions=0|disposition:metadata=0|
disposition:dependent=0|disposition:still_image=0|disposition:multilayer=0|tag:language=eng
-stream|index=2|codec_name=ac3|profile=unknown|codec_type=audio|codec_tag_string=[6][0][0][0]|codec_tag=0x0006|sample_fmt=fltp|sample_rate=48000|channels=2|channel_layout=stereo|bits_per_sample=0|initial_padding=0|dmix_mode=0|ltrt_cmixlev=0.000000|ltrt_surmixlev=0.000000|loro_cmixlev=0.000000|loro_surmixlev=0.000000|ts_id=32776|ts_packetsize=188|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:non_diegetic=0|disposition:captions=0|disposition:descriptions=0|disposition:metadata=0|dis
position:dependent=0|disposition:still_image=0|disposition:multilayer=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|dmix_mode=0|ltrt_cmixlev=0.000000|ltrt_surmixlev=0.000000|loro_cmixlev=0.000000|loro_surmixlev=0.000000|ts_id=32776|ts_packetsize=188|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:non_diegetic=0|disposition:captions=0|disposition:descriptions=0|disposition:metadata=0|
disposition:dependent=0|disposition:still_image=0|disposition:multilayer=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|dmix_mode=0|ltrt_cmixlev=0.000000|ltrt_surmixlev=0.000000|loro_cmixlev=0.000000|loro_surmixlev=0.000000|ts_id=32776|ts_packetsize=188|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:non_diegetic=0|disposition:captions=0|disposition:descriptions=0|disposition:metadata=0|dis
position:dependent=0|disposition:still_image=0|disposition:multilayer=0|tag:language=es
format|filename=mp3ac325-4864-small.ts|nb_streams=3|nb_programs=1|nb_stream_groups=0|format_name=mpegts|start_time=43473.703389|duration=0.622889|size=512000|bit_rate=6575810|probe_score=50
--
2.43.0
_______________________________________________
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] 9+ messages in thread
* Re: [FFmpeg-devel] [PATCH] avformat/mpegts: Add AVFMT_FLAG_ALLOW_CODEC_CHANGES (v2)
2025-06-30 3:55 [FFmpeg-devel] [PATCH] avformat/mpegts: Add AVFMT_FLAG_ALLOW_CODEC_CHANGES (v2) Pavel Koshevoy
@ 2025-06-30 21:45 ` Scott Theisen
2025-07-01 1:32 ` Pavel Koshevoy
0 siblings, 1 reply; 9+ messages in thread
From: Scott Theisen @ 2025-06-30 21:45 UTC (permalink / raw)
To: ffmpeg-devel
On 2025/06/29 23:55, Pavel Koshevoy wrote:
> Make midstream AVStream.codecpar updates optional and disabled
> by default, so that avformat API clients can enable this feature
> explicitly when they add support for midstream codec changes.
Is this signaled in any way or is the client expected to check if
codecpar has changed?
I ask because MythTV added checking and a callback for streams changing
between PMT versions, including adding or removing streams.
Thanks,
Scott Theisen
> ---
> doc/APIchanges | 3 +++
> libavformat/avformat.h | 2 ++
> libavformat/mpegts.c | 4 +++-
> libavformat/version.h | 4 ++--
> tests/ref/fate/ts-demux | 4 ++--
> 5 files changed, 12 insertions(+), 5 deletions(-)
>
> diff --git a/doc/APIchanges b/doc/APIchanges
> index 91710bb27d..43172fbcdd 100644
> --- a/doc/APIchanges
> +++ b/doc/APIchanges
> @@ -2,6 +2,9 @@ The last version increases of all libraries were on 2025-03-28
>
> API changes, most recent first:
>
> +2025-06-17 - xxxxxxxxxx - lavf 62.2.100 - avformat.h
> + Add AVFMT_FLAG_ALLOW_CODEC_CHANGES flag.
> +
> 2025-05-21 - xxxxxxxxxx - lavu 60.3.100 - avassert.h
> Add av_unreachable() and av_assume() macros.
>
> diff --git a/libavformat/avformat.h b/libavformat/avformat.h
> index b6c63e2237..2e5232c96d 100644
> --- a/libavformat/avformat.h
> +++ b/libavformat/avformat.h
> @@ -1436,6 +1436,8 @@ typedef struct AVFormatContext {
> #define AVFMT_FLAG_FAST_SEEK 0x80000 ///< Enable fast, but inaccurate seeks for some formats
> #define AVFMT_FLAG_AUTO_BSF 0x200000 ///< Add bitstream filters as requested by the muxer
>
> +#define AVFMT_FLAG_ALLOW_CODEC_CHANGES 0x400000 ///< Allow AVStream.codecpar to be updated midstream if input changes (e.g. MPEG-TS ES stream_type changes)
> +
> /**
> * Maximum number of bytes read from input in order to determine stream
> * properties. Used when reading the global header and in
> diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c
> index deb69a0548..ed4ff580e5 100644
> --- a/libavformat/mpegts.c
> +++ b/libavformat/mpegts.c
> @@ -2510,7 +2510,9 @@ static void pmt_cb(MpegTSFilter *filter, const uint8_t *section, int section_len
> if (!st)
> goto out;
>
> - if (pes && pes->stream_type != stream_type)
> + if (pes && (!pes->stream_type ||
> + (pes->stream_type != stream_type &&
> + !!(ts->stream->flags & AVFMT_FLAG_ALLOW_CODEC_CHANGES))))
> mpegts_set_stream_info(st, pes, stream_type, prog_reg_desc);
>
> add_pid_to_program(prg, pid);
> diff --git a/libavformat/version.h b/libavformat/version.h
> index b32ddb3617..904e7f06aa 100644
> --- a/libavformat/version.h
> +++ b/libavformat/version.h
> @@ -31,8 +31,8 @@
>
> #include "version_major.h"
>
> -#define LIBAVFORMAT_VERSION_MINOR 1
> -#define LIBAVFORMAT_VERSION_MICRO 101
> +#define LIBAVFORMAT_VERSION_MINOR 2
> +#define LIBAVFORMAT_VERSION_MICRO 100
>
> #define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \
> LIBAVFORMAT_VERSION_MINOR, \
> diff --git a/tests/ref/fate/ts-demux b/tests/ref/fate/ts-demux
> index d56cc27937..6a830d0d99 100644
> --- a/tests/ref/fate/ts-demux
> +++ b/tests/ref/fate/ts-demux
> @@ -24,6 +24,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|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|ts_id=32776|ts_packetsize=188|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:non_diegetic=0|disposition:captions=0|disposition:descriptions=0|disposition:metadata=0|disposition:dependent=0|disposition:still_image=0|disposition:multilayer=0|side_datum/cpb_properties:side_data_type=CPB properties|side_datum/cpb_properties:max_bitrate=15000000|side_datum/cpb_properties:min_bitrate=0|side_datum/cpb_properties:avg_bitrate=0|side_datum/cpb_properties:buffer_size=9781248|side_datum/cpb_properties:vbv_delay=-1
> -stream|index=1|codec_name=ac3|profile=unknown|codec_type=audio|codec_tag_string=[6][0][0][0]|codec_tag=0x0006|sample_fmt=fltp|sample_rate=48000|channels=6|channel_layout=5.1(side)|bits_per_sample=0|initial_padding=0|dmix_mode=0|ltrt_cmixlev=0.000000|ltrt_surmixlev=0.000000|loro_cmixlev=0.000000|loro_surmixlev=0.000000|ts_id=32776|ts_packetsize=188|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:non_diegetic=0|disposition:captions=0|disposition:descriptions=0|disposition:metadata=
0|
> disposition:dependent=0|disposition:still_image=0|disposition:multilayer=0|tag:language=eng
> -stream|index=2|codec_name=ac3|profile=unknown|codec_type=audio|codec_tag_string=[6][0][0][0]|codec_tag=0x0006|sample_fmt=fltp|sample_rate=48000|channels=2|channel_layout=stereo|bits_per_sample=0|initial_padding=0|dmix_mode=0|ltrt_cmixlev=0.000000|ltrt_surmixlev=0.000000|loro_cmixlev=0.000000|loro_surmixlev=0.000000|ts_id=32776|ts_packetsize=188|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:non_diegetic=0|disposition:captions=0|disposition:descriptions=0|disposition:metadata=0|d
is
> position:dependent=0|disposition:still_image=0|disposition:multilayer=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|dmix_mode=0|ltrt_cmixlev=0.000000|ltrt_surmixlev=0.000000|loro_cmixlev=0.000000|loro_surmixlev=0.000000|ts_id=32776|ts_packetsize=188|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:non_diegetic=0|disposition:captions=0|disposition:descriptions=0|disposition:metadata=
0|
> disposition:dependent=0|disposition:still_image=0|disposition:multilayer=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|dmix_mode=0|ltrt_cmixlev=0.000000|ltrt_surmixlev=0.000000|loro_cmixlev=0.000000|loro_surmixlev=0.000000|ts_id=32776|ts_packetsize=188|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:non_diegetic=0|disposition:captions=0|disposition:descriptions=0|disposition:metadata=0|d
is
> position:dependent=0|disposition:still_image=0|disposition:multilayer=0|tag:language=es
> format|filename=mp3ac325-4864-small.ts|nb_streams=3|nb_programs=1|nb_stream_groups=0|format_name=mpegts|start_time=43473.703389|duration=0.622889|size=512000|bit_rate=6575810|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] 9+ messages in thread
* Re: [FFmpeg-devel] [PATCH] avformat/mpegts: Add AVFMT_FLAG_ALLOW_CODEC_CHANGES (v2)
2025-06-30 21:45 ` Scott Theisen
@ 2025-07-01 1:32 ` Pavel Koshevoy
2025-07-01 3:46 ` Michael Niedermayer
2025-07-01 14:08 ` Scott Theisen
0 siblings, 2 replies; 9+ messages in thread
From: Pavel Koshevoy @ 2025-07-01 1:32 UTC (permalink / raw)
To: FFmpeg development discussions and patches
On Mon, Jun 30, 2025 at 3:46 PM Scott Theisen <
scott.the.elm-at-gmail.com@ffmpeg.org> wrote:
> On 2025/06/29 23:55, Pavel Koshevoy wrote:
> > Make midstream AVStream.codecpar updates optional and disabled
> > by default, so that avformat API clients can enable this feature
> > explicitly when they add support for midstream codec changes.
>
> Is this signaled in any way or is the client expected to check if
> codecpar has changed?
>
The client is expected to check codecpar for changes ...
I've described it a bit more here
https://ffmpeg.org/pipermail/ffmpeg-devel/2025-June/344921.html
>
> I ask because MythTV added checking and a callback for streams changing
> between PMT versions, including adding or removing streams.
>
>
In my code (outside ffmpeg) I've also added a similar mechanism.
BTW, in mpeg-ts captures that I have the PMT version doesn't always change,
even when there are significant changes in the program structure.
> Thanks,
>
> Scott Theisen
>
> > ---
> > doc/APIchanges | 3 +++
> > libavformat/avformat.h | 2 ++
> > libavformat/mpegts.c | 4 +++-
> > libavformat/version.h | 4 ++--
> > tests/ref/fate/ts-demux | 4 ++--
> > 5 files changed, 12 insertions(+), 5 deletions(-)
> >
> > diff --git a/doc/APIchanges b/doc/APIchanges
> > index 91710bb27d..43172fbcdd 100644
> > --- a/doc/APIchanges
> > +++ b/doc/APIchanges
> > @@ -2,6 +2,9 @@ The last version increases of all libraries were on
> 2025-03-28
> >
> > API changes, most recent first:
> >
> > +2025-06-17 - xxxxxxxxxx - lavf 62.2.100 - avformat.h
> > + Add AVFMT_FLAG_ALLOW_CODEC_CHANGES flag.
> > +
> > 2025-05-21 - xxxxxxxxxx - lavu 60.3.100 - avassert.h
> > Add av_unreachable() and av_assume() macros.
> >
> > diff --git a/libavformat/avformat.h b/libavformat/avformat.h
> > index b6c63e2237..2e5232c96d 100644
> > --- a/libavformat/avformat.h
> > +++ b/libavformat/avformat.h
> > @@ -1436,6 +1436,8 @@ typedef struct AVFormatContext {
> > #define AVFMT_FLAG_FAST_SEEK 0x80000 ///< Enable fast, but
> inaccurate seeks for some formats
> > #define AVFMT_FLAG_AUTO_BSF 0x200000 ///< Add bitstream filters as
> requested by the muxer
> >
> > +#define AVFMT_FLAG_ALLOW_CODEC_CHANGES 0x400000 ///< Allow
> AVStream.codecpar to be updated midstream if input changes (e.g. MPEG-TS ES
> stream_type changes)
> > +
> > /**
> > * Maximum number of bytes read from input in order to determine
> stream
> > * properties. Used when reading the global header and in
> > diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c
> > index deb69a0548..ed4ff580e5 100644
> > --- a/libavformat/mpegts.c
> > +++ b/libavformat/mpegts.c
> > @@ -2510,7 +2510,9 @@ static void pmt_cb(MpegTSFilter *filter, const
> uint8_t *section, int section_len
> > if (!st)
> > goto out;
> >
> > - if (pes && pes->stream_type != stream_type)
> > + if (pes && (!pes->stream_type ||
> > + (pes->stream_type != stream_type &&
> > + !!(ts->stream->flags &
> AVFMT_FLAG_ALLOW_CODEC_CHANGES))))
> > mpegts_set_stream_info(st, pes, stream_type,
> prog_reg_desc);
> >
> > add_pid_to_program(prg, pid);
> > diff --git a/libavformat/version.h b/libavformat/version.h
> > index b32ddb3617..904e7f06aa 100644
> > --- a/libavformat/version.h
> > +++ b/libavformat/version.h
> > @@ -31,8 +31,8 @@
> >
> > #include "version_major.h"
> >
> > -#define LIBAVFORMAT_VERSION_MINOR 1
> > -#define LIBAVFORMAT_VERSION_MICRO 101
> > +#define LIBAVFORMAT_VERSION_MINOR 2
> > +#define LIBAVFORMAT_VERSION_MICRO 100
> >
> > #define LIBAVFORMAT_VERSION_INT
> AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \
> >
> LIBAVFORMAT_VERSION_MINOR, \
> > diff --git a/tests/ref/fate/ts-demux b/tests/ref/fate/ts-demux
> > index d56cc27937..6a830d0d99 100644
> > --- a/tests/ref/fate/ts-demux
> > +++ b/tests/ref/fate/ts-demux
> > @@ -24,6 +24,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|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|ts_id=32776|ts_packetsize=188|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:non_diegetic=0|disposition:captions=0|disposition:descriptions=0|disposition:metadata=0|disposition:dependent=0|disposition:still_image=0|disposition:multilayer=0|side_datum/cpb_properties:side_data_type=CPB
> properties|side_datum/cpb_properties:max_bitrate=15000000|side_datum/cpb_properties:min_bitrate=0|side_datum/cpb_properties:avg_bitrate=0|side_datum/cpb_properties:buffer_size=9781248|side_datum/cpb_properties:vbv_delay=-1
> >
> -stream|index=1|codec_name=ac3|profile=unknown|codec_type=audio|codec_tag_string=[6][0][0][0]|codec_tag=0x0006|sample_fmt=fltp|sample_rate=48000|channels=6|channel_layout=5.1(side)|bits_per_sample=0|initial_padding=0|dmix_mode=0|ltrt_cmixlev=0.000000|ltrt_surmixlev=0.000000|loro_cmixlev=0.000000|loro_surmixlev=0.000000|ts_id=32776|ts_packetsize=188|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:non_diegetic=0|disposition:captions=0|disposition:descriptions=0|disposition:metadata=
> 0|
> >
> disposition:dependent=0|disposition:still_image=0|disposition:multilayer=0|tag:language=eng
> >
> -stream|index=2|codec_name=ac3|profile=unknown|codec_type=audio|codec_tag_string=[6][0][0][0]|codec_tag=0x0006|sample_fmt=fltp|sample_rate=48000|channels=2|channel_layout=stereo|bits_per_sample=0|initial_padding=0|dmix_mode=0|ltrt_cmixlev=0.000000|ltrt_surmixlev=0.000000|loro_cmixlev=0.000000|loro_surmixlev=0.000000|ts_id=32776|ts_packetsize=188|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:non_diegetic=0|disposition:captions=0|disposition:descriptions=0|disposition:metadata=0|d
> is
> >
> position:dependent=0|disposition:still_image=0|disposition:multilayer=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|dmix_mode=0|ltrt_cmixlev=0.000000|ltrt_surmixlev=0.000000|loro_cmixlev=0.000000|loro_surmixlev=0.000000|ts_id=32776|ts_packetsize=188|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:non_diegetic=0|disposition:captions=0|disposition:descriptions=0|disposition:metadata=
> 0|
> >
> disposition:dependent=0|disposition:still_image=0|disposition:multilayer=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|dmix_mode=0|ltrt_cmixlev=0.000000|ltrt_surmixlev=0.000000|loro_cmixlev=0.000000|loro_surmixlev=0.000000|ts_id=32776|ts_packetsize=188|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:non_diegetic=0|disposition:captions=0|disposition:descriptions=0|disposition:metadata=0|d
> is
> >
> position:dependent=0|disposition:still_image=0|disposition:multilayer=0|tag:language=es
> >
> format|filename=mp3ac325-4864-small.ts|nb_streams=3|nb_programs=1|nb_stream_groups=0|format_name=mpegts|start_time=43473.703389|duration=0.622889|size=512000|bit_rate=6575810|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".
>
_______________________________________________
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] 9+ messages in thread
* Re: [FFmpeg-devel] [PATCH] avformat/mpegts: Add AVFMT_FLAG_ALLOW_CODEC_CHANGES (v2)
2025-07-01 1:32 ` Pavel Koshevoy
@ 2025-07-01 3:46 ` Michael Niedermayer
2025-07-01 5:39 ` Pavel Koshevoy
2025-07-01 14:08 ` Scott Theisen
1 sibling, 1 reply; 9+ messages in thread
From: Michael Niedermayer @ 2025-07-01 3:46 UTC (permalink / raw)
To: FFmpeg development discussions and patches
[-- Attachment #1.1: Type: text/plain, Size: 899 bytes --]
On Mon, Jun 30, 2025 at 07:32:36PM -0600, Pavel Koshevoy wrote:
> On Mon, Jun 30, 2025 at 3:46 PM Scott Theisen <
> scott.the.elm-at-gmail.com@ffmpeg.org> wrote:
>
> > On 2025/06/29 23:55, Pavel Koshevoy wrote:
> > > Make midstream AVStream.codecpar updates optional and disabled
> > > by default, so that avformat API clients can enable this feature
> > > explicitly when they add support for midstream codec changes.
> >
> > Is this signaled in any way or is the client expected to check if
> > codecpar has changed?
> >
>
> The client is expected to check codecpar for changes ...
What performance impact does this have ?
also how does this align with AV_PKT_DATA_NEW_EXTRADATA
and AV_PKT_DATA_PARAM_CHANGE ?
thx
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
No snowflake in an avalanche ever feels responsible. -- Voltaire
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]
[-- Attachment #2: Type: text/plain, Size: 251 bytes --]
_______________________________________________
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] 9+ messages in thread
* Re: [FFmpeg-devel] [PATCH] avformat/mpegts: Add AVFMT_FLAG_ALLOW_CODEC_CHANGES (v2)
2025-07-01 3:46 ` Michael Niedermayer
@ 2025-07-01 5:39 ` Pavel Koshevoy
2025-07-01 14:24 ` Scott Theisen
2025-07-03 22:01 ` Michael Niedermayer
0 siblings, 2 replies; 9+ messages in thread
From: Pavel Koshevoy @ 2025-07-01 5:39 UTC (permalink / raw)
To: FFmpeg development discussions and patches
On Mon, Jun 30, 2025, 21:46 Michael Niedermayer <michael@niedermayer.cc>
wrote:
> On Mon, Jun 30, 2025 at 07:32:36PM -0600, Pavel Koshevoy wrote:
> > On Mon, Jun 30, 2025 at 3:46 PM Scott Theisen <
> > scott.the.elm-at-gmail.com@ffmpeg.org> wrote:
> >
> > > On 2025/06/29 23:55, Pavel Koshevoy wrote:
> > > > Make midstream AVStream.codecpar updates optional and disabled
> > > > by default, so that avformat API clients can enable this feature
> > > > explicitly when they add support for midstream codec changes.
> > >
> > > Is this signaled in any way or is the client expected to check if
> > > codecpar has changed?
> > >
> >
> > The client is expected to check codecpar for changes ...
>
> What performance impact does this have ?
>
In my player? None that I cared to measure
> also how does this align with AV_PKT_DATA_NEW_EXTRADATA
> and AV_PKT_DATA_PARAM_CHANGE ?
>
I don't know anything about them.
> thx
>
> [...]
> --
> Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
>
> No snowflake in an avalanche ever feels responsible. -- Voltaire
> _______________________________________________
> 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".
>
_______________________________________________
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] 9+ messages in thread
* Re: [FFmpeg-devel] [PATCH] avformat/mpegts: Add AVFMT_FLAG_ALLOW_CODEC_CHANGES (v2)
2025-07-01 1:32 ` Pavel Koshevoy
2025-07-01 3:46 ` Michael Niedermayer
@ 2025-07-01 14:08 ` Scott Theisen
1 sibling, 0 replies; 9+ messages in thread
From: Scott Theisen @ 2025-07-01 14:08 UTC (permalink / raw)
To: ffmpeg-devel
On 2025/06/30 21:32, Pavel Koshevoy wrote:
> On Mon, Jun 30, 2025 at 3:46 PM Scott Theisen <
> scott.the.elm-at-gmail.com@ffmpeg.org> wrote:
>
>> On 2025/06/29 23:55, Pavel Koshevoy wrote:
>>> Make midstream AVStream.codecpar updates optional and disabled
>>> by default, so that avformat API clients can enable this feature
>>> explicitly when they add support for midstream codec changes.
>> Is this signaled in any way or is the client expected to check if
>> codecpar has changed?
>>
> The client is expected to check codecpar for changes ...
> I've described it a bit more here
> https://ffmpeg.org/pipermail/ffmpeg-devel/2025-June/344921.html
>
>
>
>> I ask because MythTV added checking and a callback for streams changing
>> between PMT versions, including adding or removing streams.
>>
>>
> In my code (outside ffmpeg) I've also added a similar mechanism.
> BTW, in mpeg-ts captures that I have the PMT version doesn't always change,
> even when there are significant changes in the program structure.
If the PMT version_number is not incremented, that doesn't comply with
the standard ("The version number shall be incremented by 1 modulo 32
when a change in the information carried within the section occurs."
ISO/IEC 13818-1:2021 §2.4.4.10 Semantic definition of fields in
transport stream program map section).
Since the CRC would be different, the non-compliant PMT is parsed and
used (see skip_identical() in mpegts.c).
I had tried to just check the version_number (and
current_next_indicator), but the Blu-ray for Rio (2011) has a new PMT
version_number for (I think) every frame, which broke playback of that
Blu-ray in MythTV since the decoder was resetting every frame, so we had
to revert back to comparing the PMT data (ignoring the descriptors).
https://github.com/MythTV/mythtv/commit/616074a0a5f4fa9ad7241e673d6693cbd7b5e310
Regards,
Scott Theisen
_______________________________________________
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] 9+ messages in thread
* Re: [FFmpeg-devel] [PATCH] avformat/mpegts: Add AVFMT_FLAG_ALLOW_CODEC_CHANGES (v2)
2025-07-01 5:39 ` Pavel Koshevoy
@ 2025-07-01 14:24 ` Scott Theisen
2025-07-03 22:01 ` Michael Niedermayer
1 sibling, 0 replies; 9+ messages in thread
From: Scott Theisen @ 2025-07-01 14:24 UTC (permalink / raw)
To: ffmpeg-devel
On 2025/07/01 01:39, Pavel Koshevoy wrote:
> On Mon, Jun 30, 2025, 21:46 Michael Niedermayer<michael@niedermayer.cc>
> wrote:
>
>> On Mon, Jun 30, 2025 at 07:32:36PM -0600, Pavel Koshevoy wrote:
>>> On Mon, Jun 30, 2025 at 3:46 PM Scott Theisen <
>>> scott.the.elm-at-gmail.com@ffmpeg.org> wrote:
>>>
>>>> On 2025/06/29 23:55, Pavel Koshevoy wrote:
>>>>> Make midstream AVStream.codecpar updates optional and disabled
>>>>> by default, so that avformat API clients can enable this feature
>>>>> explicitly when they add support for midstream codec changes.
>>>> Is this signaled in any way or is the client expected to check if
>>>> codecpar has changed?
>>>>
>>> The client is expected to check codecpar for changes ...
>> What performance impact does this have ?
>>
> In my player? None that I cared to measure
MPEG-TS and MPEG-PS can have a new PMT (TS) or PSM (PS) at any time to
do any of the following: modifying current streams, adding new streams,
or removing streams. Therefore, to fully support those containers, you
need to check if the version numbers have changed anyways (or be
notified by a callback).
libavformat/mpeg.c does not use the program_stream_map_version.
Regards,
Scott Theisen
_______________________________________________
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] 9+ messages in thread
* Re: [FFmpeg-devel] [PATCH] avformat/mpegts: Add AVFMT_FLAG_ALLOW_CODEC_CHANGES (v2)
2025-07-01 5:39 ` Pavel Koshevoy
2025-07-01 14:24 ` Scott Theisen
@ 2025-07-03 22:01 ` Michael Niedermayer
2025-07-04 5:30 ` Pavel Koshevoy
1 sibling, 1 reply; 9+ messages in thread
From: Michael Niedermayer @ 2025-07-03 22:01 UTC (permalink / raw)
To: FFmpeg development discussions and patches
[-- Attachment #1.1: Type: text/plain, Size: 1938 bytes --]
Hi Pavel
On Mon, Jun 30, 2025 at 11:39:32PM -0600, Pavel Koshevoy wrote:
> On Mon, Jun 30, 2025, 21:46 Michael Niedermayer <michael@niedermayer.cc>
> wrote:
>
> > On Mon, Jun 30, 2025 at 07:32:36PM -0600, Pavel Koshevoy wrote:
> > > On Mon, Jun 30, 2025 at 3:46 PM Scott Theisen <
> > > scott.the.elm-at-gmail.com@ffmpeg.org> wrote:
> > >
> > > > On 2025/06/29 23:55, Pavel Koshevoy wrote:
> > > > > Make midstream AVStream.codecpar updates optional and disabled
> > > > > by default, so that avformat API clients can enable this feature
> > > > > explicitly when they add support for midstream codec changes.
> > > >
> > > > Is this signaled in any way or is the client expected to check if
> > > > codecpar has changed?
> > > >
> > >
> > > The client is expected to check codecpar for changes ...
> >
> > What performance impact does this have ?
> >
>
> In my player? None that I cared to measure
Your player is not the only user of the libavformat API
and with low latency audio codecs tiny packets could require
thousands of "has anything in this AVStream changed" checks per second
>
>
>
> > also how does this align with AV_PKT_DATA_NEW_EXTRADATA
> > and AV_PKT_DATA_PARAM_CHANGE ?
> >
>
> I don't know anything about them.
you do suggest to make streams change arbitrarily.
Thats a API change, so you should first understand the existing
related APIs
Also teh design of the new API is for all user applications
there needs to be a plan how to support this in ffmpeg and the muxer side
The API is a puzzle piece in this plan. It must fit in, even if
other people work on ffmpeg and the muxers.
Dont you agree with that too ?
thx
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
If a bugfix only changes things apparently unrelated to the bug with no
further explanation, that is a good sign that the bugfix is wrong.
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]
[-- Attachment #2: Type: text/plain, Size: 251 bytes --]
_______________________________________________
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] 9+ messages in thread
* Re: [FFmpeg-devel] [PATCH] avformat/mpegts: Add AVFMT_FLAG_ALLOW_CODEC_CHANGES (v2)
2025-07-03 22:01 ` Michael Niedermayer
@ 2025-07-04 5:30 ` Pavel Koshevoy
0 siblings, 0 replies; 9+ messages in thread
From: Pavel Koshevoy @ 2025-07-04 5:30 UTC (permalink / raw)
To: FFmpeg development discussions and patches
On Thu, Jul 3, 2025, 16:02 Michael Niedermayer <michael@niedermayer.cc>
wrote:
> Hi Pavel
>
> On Mon, Jun 30, 2025 at 11:39:32PM -0600, Pavel Koshevoy wrote:
> > On Mon, Jun 30, 2025, 21:46 Michael Niedermayer <michael@niedermayer.cc>
> > wrote:
> >
> > > On Mon, Jun 30, 2025 at 07:32:36PM -0600, Pavel Koshevoy wrote:
> > > > On Mon, Jun 30, 2025 at 3:46 PM Scott Theisen <
> > > > scott.the.elm-at-gmail.com@ffmpeg.org> wrote:
> > > >
> > > > > On 2025/06/29 23:55, Pavel Koshevoy wrote:
> > > > > > Make midstream AVStream.codecpar updates optional and disabled
> > > > > > by default, so that avformat API clients can enable this feature
> > > > > > explicitly when they add support for midstream codec changes.
> > > > >
> > > > > Is this signaled in any way or is the client expected to check if
> > > > > codecpar has changed?
> > > > >
> > > >
> > > > The client is expected to check codecpar for changes ...
> > >
> > > What performance impact does this have ?
> > >
> >
> > In my player? None that I cared to measure
>
> Your player is not the only user of the libavformat API
> and with low latency audio codecs tiny packets could require
> thousands of "has anything in this AVStream changed" checks per second
>
>
> >
> >
> >
> > > also how does this align with AV_PKT_DATA_NEW_EXTRADATA
> > > and AV_PKT_DATA_PARAM_CHANGE ?
> > >
> >
> > I don't know anything about them.
>
> you do suggest to make streams change arbitrarily.
> Thats a API change, so you should first understand the existing
> related APIs
>
> Also teh design of the new API is for all user applications
>
> there needs to be a plan how to support this in ffmpeg and the muxer side
>
> The API is a puzzle piece in this plan. It must fit in, even if
> other people work on ffmpeg and the muxers.
>
> Dont you agree with that too ?
>
I have fullfilled my obligation to submit my ffmpeg changes back to the
project. If my changes aren't good enough for everyone -- sorry, they are
good enough for me. I don't think I'll be sending any more patches on this
topic. Feel free to revert everything I've committed if that's better for
the project. I'll find some other way to play these out-of-spec files.
Pavel.
>
_______________________________________________
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] 9+ messages in thread
end of thread, other threads:[~2025-07-04 5:31 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-06-30 3:55 [FFmpeg-devel] [PATCH] avformat/mpegts: Add AVFMT_FLAG_ALLOW_CODEC_CHANGES (v2) Pavel Koshevoy
2025-06-30 21:45 ` Scott Theisen
2025-07-01 1:32 ` Pavel Koshevoy
2025-07-01 3:46 ` Michael Niedermayer
2025-07-01 5:39 ` Pavel Koshevoy
2025-07-01 14:24 ` Scott Theisen
2025-07-03 22:01 ` Michael Niedermayer
2025-07-04 5:30 ` Pavel Koshevoy
2025-07-01 14:08 ` Scott Theisen
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