1

So I have the following video example

    Stream #0:0(jpn): Video: h264 (High 10), yuv420p10le(progressive), 1920x1036 [SAR 1:1 DAR 480:259], 23.98 fps, 23.98 tbr, 1k tbn, 47.95 tbc (default)
    Stream #0:1(eng): Audio: ac3, 48000 Hz, 5.0(side), fltp, 640 kb/s (default)
    Stream #0:2(jpn): Audio: ac3, 48000 Hz, 5.0(side), fltp, 640 kb/s
    Stream #0:3(eng): Subtitle: ass (default)
    Metadata:
      title           : English Signs & Songs
    Stream #0:4(eng): Subtitle: ass
    Metadata:
      title           : English Subtitles
    Stream #0:5: Attachment: ttf
    Metadata:
      filename        : PutoInsanity.ttf
      mimetype        : application/x-truetype-font

I want to use ffprobe to count the amount of video streams and audio streams, which in this case should give me 1 and 2 resp. How can this be achieved?

1

No such built-in feature that I am aware of, but you can use additional tools to process the output:

ffprobe -v error -show_entries stream=codec_type input.mkv | grep "codec_type=audio" | wc -w
ffprobe -v error -show_entries stream=codec_type input.mkv | grep "codec_type=video" | wc -w

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.