ffprobe <input> -show_entries format=nb_streams -v 0 -of csv=p=0 or ffprobe <input> -show_entries format=nb_streams -v 0 -of compact=p=0:nk=1
NOTE: This can be filtered for only video or audio streams by adding -select_streams v or -select_streams a, respectively.