[FFmpeg-user] FFprobe scripting question

Clément Bœsch ubitux at gmail.com
Sat Jun 16 15:04:28 CEST 2012

On Sat, Jun 16, 2012 at 11:48:38AM +0930, Rodney Baker wrote:
> On Sat, 16 Jun 2012 08:33:11 Stefano Sabatini wrote:
> > -show_streams -print_format default=nk=1:nw=1 | sed -n 9p
> Thanks Adam, Clement and Stefano. This produces the required result (but I 
> still need to redirect stderr to /dev/null to get just the numeric answer that 
> I'm looking for).
> A slight modification to sed -n 8,9p prints both horizontal and vertical 
> pixels which is even better. :-)

This is not reliable if we add entries.

> Now I just need to learn how to do arrays in bash (or learn another 
> programming language other than Visual Basic) so I can do something useful 
> with the rest of the output that I'm currently throwing away. :-)

If you're scripting with bash I would suggest something like this:

% ./ffprobe -v 0 INPUT -show_streams -of flat=s=_:h=0 | grep -E '(width|height)'

And eval that output, so you can directly access the information with
$stream_0_width and $stream_0_height.

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/20120616/c83bf7ce/attachment.asc>

More information about the ffmpeg-user mailing list