[Gllug] Command line tool to find video dimensions?
Nix
nix at esperi.org.uk
Sat Jun 2 17:40:42 UTC 2007
On 2 Jun 2007, Tethys spake thusly:
>
> Nix writes:
>
>>> if [ $# -eq 0 ]; then
>>
>>[[ ]] preferred.
>
> Why? Looks like two unnecessary extra characters to me...
It's just a good habit to get into, because in many non-bash shells [[
]] is internal while [ ] is not, so [[ ]] is *dramatically* faster.
>>> output=$(mplayer -identify -vo null -ao null -frames 0 "$file" 2>&1)
>>
>>Quote that!
>
> What for? The output of $(command) preserves whitespace without quoting.
... hm, so it does. I'm not sure what I was confusing it with...
> Besides, you could always just use sed instead:
Yes :)))
> sed -rn -e '/^ID_VIDEO_(WIDTH|HEIGHT)/ {s/.*=//;N;s/\n.*=/x/p;h}' \
> -e '$ {g;s/^$/unknown size/;T;p}'
This sort of sed is probably a criminal offence :)
--
`On a scale of one to ten of usefulness, BBC BASIC was several points ahead
of the competition, scoring a relatively respectable zero.' --- Peter Corlett
--
Gllug mailing list - Gllug at gllug.org.uk
http://lists.gllug.org.uk/mailman/listinfo/gllug
More information about the GLLUG
mailing list