GeorgeKat
GeorgeKat

Reputation: 11

ffprobe returning video stream data twice

I'm trying to return specific values from ffprobe:

ffprobe -v error -select_streams V:0 -show_entries stream=index,width,height,sample_aspect_ratio,display_aspect_ratio:format=duration -of default=noprint_wrappers=1:nokey=1 test.MTS

The stream values in the output are repeated:

0
1920
1080
1:1
16:9
0
1920
1080
1:1
16:9
116.640000

The format value is not repeated. If I strip the printer values to see what's going on:

ffprobe -v error -select_streams V:0 -show_entries stream=index,width,height,sample_aspect_ratio,display_aspect_ratio:format=duration test.MTS

I see a section called [PROGRAM] with stream 0 repeated within it:

[PROGRAM]
[STREAM]
index=0
width=1920
height=1080
sample_aspect_ratio=1:1
display_aspect_ratio=16:9
[/STREAM]
[/PROGRAM]
[STREAM]
index=0
width=1920
height=1080
sample_aspect_ratio=1:1
display_aspect_ratio=16:9
[/STREAM]
[FORMAT]
duration=116.640000
[/FORMAT]

Can someone please help me to return only the video stream 0 values once?

Upvotes: 1

Views: 1721

Answers (1)

aergistal
aergistal

Reputation: 31209

The regular stream doesn't have a unique section name. You can however select just the program streams using -show_entries program_stream or just discard the extra information. See ffprobe -sections

Upvotes: 1

Related Questions