[FFmpeg-user] FFprobe scripting question

Adam Klobukowski adamklobukowski at gmail.com
Fri Jun 15 10:29:05 CEST 2012

2012/6/15 Rodney Baker <rodney.baker at iinet.net.au>:
> Hi all. Is there an easy way to use FFprobe in a script to get just the size
> or bitrate of a video stream? I have a video conversion script using FFmpeg
> and I want to make a decision on encoding bitrate based on whether or not the
> original stream is a HD (1440x1080) or SD (720x576) stream (as recorded from a
> dvb-t card).
> I know I could probably do it using something like
> ffprobe -show_streams 2>/dev/null  |  grep 'width'
> and then strip off the "width=" string but I was kind of hoping there might be
> an easier way to do it.

I had the same problem, and found mplayer much easier for this task.

My code (bash):

TEST=`mplayer -msglevel identify=6 -frames 0 "$NAME" 2>&1 | grep -e
BITRATE=$(trim `echo "$TEST" | cut -d= -f2`)

Semper Fidelis

Adam Klobukowski
adamklobukowski at gmail.com

More information about the ffmpeg-user mailing list