This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
ffprobe [2020-12-16 18:10:47] mi [List audio tracks] |
ffprobe [2023-06-08 15:10:59] (current) mi [Show video format] |
||
---|---|---|---|
Line 2: | Line 2: | ||
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. | 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. | ||
+ | |||
+ | Start with a look at this page: https://trac.ffmpeg.org/wiki/FFprobeTips | ||
===== Show metadata tags===== | ===== Show metadata tags===== | ||
Line 9: | Line 11: | ||
(for ''-print_format'', there is also ''flat'', ''xml'', ''csv'', etc.) | (for ''-print_format'', there is also ''flat'', ''xml'', ''csv'', etc.) | ||
+ | ===== Show video format===== | ||
+ | |||
+ | ffprobe -v warning -select_streams v -show_entries stream=codec_name,height,width,pix_fmt -of csv=p=0 "$in" | ||
+ | |||
+ | ===== Has alpha channel? ===== | ||
+ | |||
+ | https://stackoverflow.com/questions/69029439/a-good-way-to-detect-alpha-channel-in-a-video-using-ffmpeg-ffprobe | ||
+ | |||
+ | <code bash>for f in *.mov; do | ||
+ | pixfmt=$(ffprobe -v 0 -select_streams v:0 -show_entries stream=pix_fmt -of compact=p=0:nk=1 "$f") | ||
+ | alpha=$(ffprobe -v 0 -show_entries pixel_format=name:flags=alpha -of compact=p=0 | grep "$pixfmt|" | grep -oP "(?<=alpha=)\d") | ||
+ | if (( alpha )); then echo "$f : yes, has alpha"; else echo "$f : NO"; fi | ||
+ | done | ||
+ | </code> | ||
===== List audio tracks ===== | ===== List audio tracks ===== | ||
Line 23: | Line 39: | ||
or the "official" way: | or the "official" way: | ||
- | ffprobe -select_streams a -show_entries stream=index -of csv=p=0 "$in" | + | ffprobe -v quiet -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" | + | ffprobe -v quiet -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") ) | + | audio_tracks=( $(ffprobe -v quiet -select_streams a -show_entries stream=index -of csv=p=0 "$in") ) |
===== List subtitles ===== | ===== List subtitles ===== |