7

I just want to see how many streams are inside my video file.

I looked at the official documentation and I cannot see what option I can use. Perhaps another command/terminal app can do something similar?

Any ideas how it can be done?

2 Answers 2

15

If you have ffprobe installed:

ffprobe <input> -show_entries format=nb_streams -v 0 -of compact=p=0:nk=1

You can also filter for video or audio streams by adding -select_streams v or -select_streams a, respectively. See the manual for more details.

If you do not have ffprobe, ffmpeg can be used too, but in a slightly less robust way (i.e., this may break if the output format changes or something contains the words "Stream #" in the output):

ffmpeg -i <input> 2>&1 | grep "Stream #" | wc -l
5
  • 2
    More direct is ffprobe input -show_entries format=nb_streams -v 0 -of compact=p=0:nk=1
    – Gyan
    Commented Jun 7, 2017 at 12:38
  • Thanks, post updated, I sometimes forget that there's a format class as well.
    – slhck
    Commented Jun 7, 2017 at 12:58
  • ffprobe.exe -i "vid.mkv" -show_entries format gets the job done, I don't know about all those options you listed.
    – Shayan
    Commented Sep 9, 2019 at 8:25
  • 1
    @Shayan The options I've used ensure that you'll only get one number as output. Your command shows everything.
    – slhck
    Commented Sep 9, 2019 at 9:13
  • For a "smaller" command, we could use another writer: -of csv=p=0 instead of -of compact=p=0:nk=1 Commented Dec 26, 2022 at 23:09
0

To count "number of available streams using ffmpeg'":

ffmpeg.exe -i %input% 2>&1 | find /c "Stream"

Tested in Win 10 CMD

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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