[FFmpeg-user] FFprobe scripting question

Clément Bœsch ubitux at gmail.com
Fri Jun 15 17:47:39 CEST 2012

On Fri, Jun 15, 2012 at 05:05:11PM +0930, Rodney Baker wrote:
> 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.

ffprobe -v 0 -show_streams | grep width

You can also look at the different output formats such as JSON or flat
("-of json"), which might be easier to interface with your app. The
"compact" also makes possible to strip off the keys IIRC. You can also use
eval in your shell to assign the value.

There is a -show_format_entry option, but nothing for streams, you might
want to open a feature request for this.


Clément B.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 490 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-user/attachments/20120615/602e362d/attachment.asc>

More information about the ffmpeg-user mailing list