PDA

View Full Version : shell command for video resolution



I_Failed_C++
October 23rd, 2006, 03:44 PM
Hi all. I need a shell command to output the resolution of a video file for use in a script but I'm at a loss. Can anyone help me.
Thanks

duff
October 23rd, 2006, 04:12 PM
# xdpyinfo | grep '^ dimension' | awk '{print $2}'

I_Failed_C++
October 23rd, 2006, 07:46 PM
I'm a relative noob but it look like this code will query a display server? What I'm wanting to do is query a file.
Thanks.

toojays
October 24th, 2006, 12:46 PM
I don't know of a tool which does this, but I know some programs use mplayer to create thumbnails of video files. If you could use mplayer to output a single frame at the resolution of the video, you could then use a tool like identify (from ImageMagick) to get the dimensions of the frame.

If all your videos are in a single format, you may be able to use another tool, but if you have to deal with videos in arbitrary formats, you will need to use a movie player somewhere.