Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I need all the .mp4 files' dimensions to be printed with the file name. For example:

1_VIDEO.mp4 1204x680
share|improve this question
    
Ok Guys, solved it find * -name '*.mp4' -exec exiftool -directory -fileName -imageSize {$1} \; first install sno.phy.queensu.ca/~phil/exiftool/install.html#OSX "ExifTool" –  pradyumnad Aug 8 '13 at 8:53
1  
Could you then add this as an answer, please. –  Raphael Ahrens Aug 8 '13 at 8:58
    
Please write that up as an answer and accept it so other's know that your issue's been resolved. –  slm Aug 8 '13 at 21:17
    
Related: unix.stackexchange.com/questions/29101/… –  Bernhard Dec 3 '13 at 12:18

4 Answers 4

With exiftool:

$ exiftool -q -p '$FileName $ImageSize' ./*.mp4
foo.mp4 640x480
test.mp4 1280x800
share|improve this answer
    
Ah exiftool. I knew there was a tool, couldn't remember the name. –  slm Aug 8 '13 at 20:40
$ ffmpeg -i 1_VIDEO.mp4 2>&1 | \
      grep -E 'width|height|Input.*from' | \
      paste -sd' ' | \
      awk '{print $5, $8"x"$11}' | \
      sed "s/'\|://g"

Example

$ ffmpeg -i pizzahut_pizzahead_and_steve.flv 2>&1 | \
      grep -E 'width|height|Input.*from' | \
      paste -sd' ' | \
      awk '{print $5, $8"x"$11}' | \
      sed "s/'\|://g"
pizzahut_pizzahead_and_steve.flv 320x240

Breakdown

  1. The first grep

    $ ffmpeg -i pizzahut_pizzahead_and_steve.flv 2>&1 | \
                grep -E 'width|height|Input.*from'
    Input #0, flv, from 'pizzahut_pizzahead_and_steve.flv':
        width           : 320
        height          : 240
    
  2. paste

    This combines the 3 lines of output from the output in #1, into a single line.

    Input #0, flv, from 'pizzahut_pizzahead_and_steve.flv':     width           : 320     height          : 240
    
  3. awk & sed

    The remaining 2 commands cleanup the output from paste and format it so that it looks like this:

    pizzahut_pizzahead_and_steve.flv 320x240
    
share|improve this answer
up vote 1 down vote accepted

Ok Guys, solved it

find . -name '*.mp4' -exec exiftool -directory -fileName -imageSize {} \; 

first install ExifTool.

share|improve this answer

does ls -lA | awk {'print $5, "\t", $9'}

work in osx ?

share|improve this answer
    
No that isn't working.. –  pradyumnad Aug 8 '13 at 8:11
2  
That shows the files size, not the dimensions of the video. –  slm Aug 8 '13 at 8:19
    
wops, sorry! "I need all the .mp4 files' dimensions to be printed" didn't read the example! –  user1293137 Aug 8 '13 at 15:07

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.