Beefy Boxes and Bandwidth Generously Provided by pair Networks BBQ
Don't ask to ask, just ask
 
PerlMonks  

Re: Get size and bitrate of video with perl and ffmpeg

by aitap (Chaplain)
on Aug 04, 2012 at 14:38 UTC ( #985437=note: print w/ replies, xml ) Need Help??


in reply to Get size and bitrate of video with perl and ffmpeg

Also, running subprocesseses using list context is safer in case of some special characters in the file name: open(FILE,"-|",qw(ffprobe -i),$file).
Unfortunately, it will be necessary to use some special tricks to hide the STDERR, for example, (untested; written for ugly avconv output)

use IPC::Run 'run'; my $file = $ARGV[0] || die; my $line; run [ qw(ffprobe -show_streams),$file ], '&>', \$line || die "$!\n"; my ($width,$height); for (split /\n/,$line) { $width = $1 if /width=(\d+)/; $height = $1 if /height=(\d+)/; # ... $_ eq '[/STREAM]' && defined $width && defined $height && print "$ +{width}x${height}\n" && last }
Sorry if my advice was wrong.


Comment on Re: Get size and bitrate of video with perl and ffmpeg
Select or Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://985437]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (7)
As of 2014-04-18 01:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    April first is:







    Results (460 votes), past polls