User Tools

Site Tools


ffprobe

This is an old revision of the document!


ffprobe

The normal text output of ffprobe goes to stderr, so you usually need to add 2>&1 to parse the output. The alternative is to use the complex ffprobe options to format the output which then goes to stdout.

List audio tracks

ffprobe "$in" 2>&1 | perl -nle '/^\s+Stream #(\d+:\d+): Audio/ && print $1'

with codec and number of channels:

ffprobe "$in" 2>&1 | perl -nle '/^\s+Stream #(\d+:\d+): Audio: (\S+).*(\d+)\s+channels/ && print join("\t", $1, $2, $3)'

or to have the tracks in a Bash array:

audio_tracks=( $(ffprobe "$in" 2>&1 | perl -nle '/^\s+Stream #(\d+:\d+): Audio/ && print $1') )

or the "official" way:

ffprobe -select_streams a -show_entries stream=index -of csv=p=0 "$in"

ffprobe -select_streams a -show_entries stream=index,codec_name,channels -of csv=p=0 "$in"

audio_tracks=( $(ffprobe -select_streams a -show_entries stream=index -of csv=p=0 "$in") )

Timecode

ffprobe -v error -show_entries stream=index,codec_name:stream_tags=timecode -of csv=p=0 "$in"

Other options

  1. sections

Print sections structure and section information, and exit. The output is not meant to be parsed by a machine.

  1. show_data_hash algorithm

Show a hash of payload data, for packets with -show_packets and for codec extradata with -show_streams.

/docs/dokuwiki/data/attic/ffprobe.1569233807.txt.gz · Last modified: 2019-09-23 12:16:47 by mi