fftools/ffprobe: require explicit selection for program streams

Shared stream entries implicitly enable programs as well as stream groups.
Require explicit selection for the program streams subtree too, avoiding
duplicate streams in MPEG-TS output and empty program sections in JSON.

Keep explicit program selection and stream field filtering working. Add
tests for -show_programs and program_stream, and update the MOV and MPEG-TS
references affected by the removal of implicit program output.

Signed-off-by: cuptu <cuptu@qq.com>
This commit is contained in:
cuptu authored and James Almer committed 2026-09-18 16:56:21 +00:00
1 parent 802ac3f6b8
commit 88f7fd9ec5
14 files changed
+41 -82

No files matched your search

+6 -5
View File
@@ -196,11 +196,12 @@ sections:
stream_tags=title
@end example
Selecting @code{stream} or @code{streams} does not by itself enable stream
group output. To also show streams within groups, use
@code{-show_stream_groups} or select their unique section name, for example
@code{-show_entries stream_group_stream=index}. The shared names still
select fields within stream groups when group output is enabled.
Selecting @code{stream} or @code{streams} does not by itself enable program or
stream group output. To also show streams within programs or groups, use
@code{-show_programs}, @code{-show_stream_groups}, or select their unique
section name, for example @code{-show_entries program_stream=index} or
@code{-show_entries stream_group_stream=index}. The shared names still select
fields within programs and stream groups when their output is enabled.
@item -show_packets
Show information about each packet contained in the input multimedia
+3 -2
View File
@@ -3349,8 +3349,9 @@ static inline int check_section_show_entries(int section_id, int require_explici
{
const EntrySelection *selection = &selected_entries[section_id];
/* Selecting a shared stream section must not implicitly enable groups. */
if (section_id == SECTION_ID_STREAM_GROUP_STREAMS)
/* A shared stream section must not implicitly enable programs or groups. */
if (section_id == SECTION_ID_PROGRAM_STREAMS ||
section_id == SECTION_ID_STREAM_GROUP_STREAMS)
require_explicit = 1;
if ((!require_explicit || selection->explicitly_selected) &&
+10
View File
@@ -9,6 +9,16 @@ FATE_MPEGTS_PROBE-$(call DEMDEC, MPEGTS, HEVC, LOAS_DEMUXER) += fate-mpegts-prob
fate-mpegts-probe-latm: SRC = $(TARGET_SAMPLES)/mpegts/loewe.ts
fate-mpegts-probe-latm: CMD = run $(PROBE_CODEC_NAME_COMMAND) -i "$(SRC)"
FATE_MPEGTS_PROBE-$(call DEMDEC, MPEGTS, HEVC, LOAS_DEMUXER) += fate-mpegts-probe-show-program
fate-mpegts-probe-show-program: SRC = $(TARGET_SAMPLES)/mpegts/loewe.ts
fate-mpegts-probe-show-program: CMD = run $(PROBE_CODEC_NAME_COMMAND) -show_programs \
-show_entries program=:program_tags=:program_stream_disposition=:program_stream_tags=:stream=codec_name -i "$(SRC)"
FATE_MPEGTS_PROBE-$(call DEMDEC, MPEGTS, HEVC, LOAS_DEMUXER) += fate-mpegts-probe-program-stream
fate-mpegts-probe-program-stream: SRC = $(TARGET_SAMPLES)/mpegts/loewe.ts
fate-mpegts-probe-program-stream: CMD = run ffprobe$(PROGSSUF)$(EXESUF) -v 0 -bitexact \
-select_streams p:769:v:0 -show_entries program_stream=codec_name -i "$(SRC)"
FATE_MPEGTS_PROBE-$(call DEMDEC, MPEGTS, HEVC, LOAS_DEMUXER) += fate-mpegts-probe-program
fate-mpegts-probe-program: SRC = $(TARGET_SAMPLES)/mpegts/loewe.ts
@@ -17,9 +17,6 @@
0, 4608, 4608, 1536, 690, 0xa2714bf3
1, 4608, 4608, 1536, 626, 0x09f4382f
{
"programs": [
],
"streams": [
{
"index": 0,
-3
View File
@@ -19,9 +19,6 @@
"pos": "44",
"flags": "K__"
}
],
"programs": [
],
"streams": [
{
-3
View File
@@ -20,9 +20,6 @@ cbd2c7ff864a663b0d893deac5a0caec *tests/data/fate/mov-mp4-ttml-stpp.mp4
"pos": "44",
"flags": "K__"
}
],
"programs": [
],
"streams": [
{
@@ -34,18 +34,6 @@
0, 75000, 81000, 3000, 175, 0x17244a4e, F=0x0, S=1, MPEGTS Stream ID, 1, 0x00e000e0
0, 78000, 78000, 3000, 131, 0x1c0d2a8a, F=0x0, S=1, MPEGTS Stream ID, 1, 0x00e000e0
0, 81000, 84000, 3000, 391, 0xe4e0b1f6, F=0x0, S=1, MPEGTS Stream ID, 1, 0x00e000e0
[PROGRAM]
[STREAM]
index=0
codec_name=h264
id=0x100
[/STREAM]
[STREAM]
index=1
codec_name=lcevc
id=0x101
[/STREAM]
[/PROGRAM]
[STREAM_GROUP]
index=0
id=0xce
@@ -34,18 +34,6 @@
0, 75000, 75000, 3000, 139, 0xb0f93bbf, F=0x0, S=1, MPEGTS Stream ID, 1, 0x00e000e0
0, 78000, 78000, 3000, 103, 0x303b27b7, F=0x0, S=1, MPEGTS Stream ID, 1, 0x00e000e0
0, 81000, 84000, 3000, 136, 0x1f1a3853, F=0x0, S=1, MPEGTS Stream ID, 1, 0x00e000e0
[PROGRAM]
[STREAM]
index=0
codec_name=hevc
id=0x100
[/STREAM]
[STREAM]
index=1
codec_name=lcevc
id=0x101
[/STREAM]
[/PROGRAM]
[STREAM_GROUP]
index=0
id=0xce
@@ -34,18 +34,6 @@
0, 72000, 75000, 3000, 169, 0xa24f49ea, F=0x0, S=1, MPEGTS Stream ID, 1, 0x00e000e0
0, 75000, 81000, 3000, 64, 0xa66c143b, F=0x0, S=1, MPEGTS Stream ID, 1, 0x00e000e0
0, 78000, 84000, 3000, 184, 0xc61e46d9, F=0x0, S=1, MPEGTS Stream ID, 1, 0x00e000e0
[PROGRAM]
[STREAM]
index=0
codec_name=vvc
id=0x100
[/STREAM]
[STREAM]
index=1
codec_name=lcevc
id=0x101
[/STREAM]
[/PROGRAM]
[STREAM_GROUP]
index=0
id=0xce
-8
View File
@@ -1,11 +1,3 @@
[PROGRAM]
[STREAM]
codec_name=hevc
[/STREAM]
[STREAM]
codec_name=aac_latm
[/STREAM]
[/PROGRAM]
[STREAM]
codec_name=hevc
[/STREAM]
-17
View File
@@ -1,20 +1,3 @@
[PROGRAM]
[STREAM]
codec_name=ac3
[/STREAM]
[STREAM]
codec_name=ac3
[/STREAM]
[STREAM]
codec_name=ac3
[/STREAM]
[STREAM]
codec_name=mpeg2video
[/STREAM]
[STREAM]
codec_name=scte_35
[/STREAM]
[/PROGRAM]
[STREAM]
codec_name=ac3
[/STREAM]
-5
View File
@@ -1,8 +1,3 @@
[PROGRAM]
[STREAM]
codec_name=hevc
[/STREAM]
[/PROGRAM]
[STREAM]
codec_name=hevc
[/STREAM]
@@ -0,0 +1,5 @@
[PROGRAM]
[STREAM]
codec_name=hevc
[/STREAM]
[/PROGRAM]
+17
View File
@@ -0,0 +1,17 @@
[PROGRAM]
[STREAM]
codec_name=hevc
[/STREAM]
[STREAM]
codec_name=aac_latm
[/STREAM]
[/PROGRAM]
[STREAM]
codec_name=hevc
[/STREAM]
[STREAM]
codec_name=aac_latm
[/STREAM]
[STREAM]
codec_name=epg
[/STREAM]