[FFmpeg-user] Number of channels

Liam Condron-Farnos 23liam at googlemail.com
Tue Mar 5 21:54:04 CET 2013


>> I'm looking to display just the audio file channel info, not the rest of the data. Is this possible?
>Look for the grep command. It's à filter

I would recommend using ffprobe. To show information about the first
audio stream in a file:

ffprobe input.file -show_streams -select_streams a:0

As Henk wrote, you could use grep to find the information you wanted,
this is easier with ffprobe since it outputs a single key=value pair
per line. To find the number of audio channels (on Linux / OSX / other
Unix-like):

ffprobe input.file -show_streams -select_streams a:0 | grep 'channels='

or, to strip out the 'channels=' and get only the number of channels,
you could use sed instead:

ffprobe input.file -show_streams -select_streams a:0 | sed -n
'/channels=/s/channels=//p'


More information about the ffmpeg-user mailing list