Cipiatone

Q: Copy duration attributes in finder

Hi there,

 

I would like to copy the duration attributes of a list of movie clips from the finder window into an excel doc. At the moment when I copy and paste

the movie clips to excel I copy the file names only, I would also like to copy the duration attributes so I can see a list of movie clip durations.

Can this be done with the finder on another app?

 

Thanks!

G5, Mac OS X (10.5.2), On XP, Vista, OSX and linux

Posted on Feb 22, 2016 3:30 AM

Close

Q: Copy duration attributes in finder

  • All replies
  • Helpful answers

  • by judysings,

    judysings judysings Feb 23, 2016 7:53 AM in response to Cipiatone
    Community Specialists
    Feb 23, 2016 7:53 AM in response to Cipiatone

    Hi Cipiatone,

    If you are working with iMove or Final Cut Pro X, you could look at your clips in "list view" and copy / paste the information into another document.  Otherwise, just taking screenshot of the Finder window would give you a copy of the information you need.

    How to take a screenshot on your Mac

     

    Take care,

  • by Tony T1,

    Tony T1 Tony T1 Feb 23, 2016 8:03 AM in response to Cipiatone
    Level 6 (9,249 points)
    Mac OS X
    Feb 23, 2016 8:03 AM in response to Cipiatone

    This Automator Workflow will copy the Duration in seconds to your clipboard

     

    Screen Shot 2016-02-23 at 11.02.03 AM.png

     

    mdls -name kMDItemDurationSeconds -raw  "$1" | pbcopy

  • by Tony T1,

    Tony T1 Tony T1 Feb 23, 2016 8:46 AM in response to Tony T1
    Level 6 (9,249 points)
    Mac OS X
    Feb 23, 2016 8:46 AM in response to Tony T1

    If you also want to copy the name of the file with the duration (in seconds):

     

        mdls -name kMDItemFSName -name kMDItemDurationSeconds -raw "$1" | xargs -0 printf "%s \t" | pbcopy

     

    To convert the duration in seconds to: hh:mm:ss, divide by 86400 and then ⌘1 and Format as Time-> hh:mm:ss


  • by Tony T1,

    Tony T1 Tony T1 Feb 23, 2016 8:52 AM in response to Tony T1
    Level 6 (9,249 points)
    Mac OS X
    Feb 23, 2016 8:52 AM in response to Tony T1

    And to have this work as a 'right-click', select in Finder, when you open Automator, select "Service" instead of Workflow.

  • by Tony T1,

    Tony T1 Tony T1 Feb 23, 2016 9:37 AM in response to Cipiatone
    Level 6 (9,249 points)
    Mac OS X
    Feb 23, 2016 9:37 AM in response to Cipiatone

    Expanding on the above Automator Workflow, this Automator Service will allow multiple movie files to be selected in Finder, then right-clicking and selecting the Service name will copy the Filename and Duration (in seconds) to the clipboard.   Then after pasting into Excel, convert the duration in seconds to: hh:mm:ss, by dividing by 86400 and then ⌘1 and Format as Time-> hh:mm:ss


    Screen Shot 2016-02-23 at 12.33.30 PM.png


    TMPFILE=$(mktemp -t temp)

    for f in "$@"

    do

      mdls -name kMDItemFSName -name kMDItemDurationSeconds -raw "$f" >> $TMPFILE

      echo >> $TMPFILE

    done

    cat $TMPFILE | xargs -0 printf "%s \t" | pbcopy

    rm $TMPFILE

  • by Tony T1,

    Tony T1 Tony T1 Feb 23, 2016 11:35 AM in response to Tony T1
    Level 6 (9,249 points)
    Mac OS X
    Feb 23, 2016 11:35 AM in response to Tony T1

    A little bit of an improvement.

    This will add the divide duration in seconds by 86400 to the clipboard, so that all that will be needed is to Format the cell as HH:MM:ss in Excel:

     

    TMPFILE=$(mktemp -t temp)

    for f in "$@"

    do

         echo -n $( mdls -name kMDItemFSName -raw "$f" )$'\t'  >> $TMPFILE

         echo "=$( mdls -name kMDItemDurationSeconds -raw "$f" )/86400"$'\t' >> $TMPFILE

    done

    cat $TMPFILE | pbcopy

    rm $TMPFILE