how to trim 1000 videos to 2 sec each, merge

Discussion in 'Digital Video' started by gnychis, Dec 11, 2012.

  1. gnychis macrumors 6502

    May 24, 2009
    It's been a while since I've tried to edit any sort of videos, and I'm new to Mac OS so I'm even less familiar with the software or tools available for it. But I kind of have a "special" request.

    I have somewhere around 1000 videos that I've captured over the past 10 years of my life, some small clips (10 seconds), some longer (20 minutes). I want to do something "simple" like take the first 2 seconds of each video (for simplicity) and then merge them all together.

    Of course, these videos are in all sorts of different formats and resolutions. So I'd like to be able to define the video to be the resolution of the highest resolution video, and just fit the others in with black backgrounds or something.

    If anyone has any suggests on where to even start with this (e.g., trimming) I'd greatly appreciate it. Thanks a bunch!
  2. ppc_michael Guest


    Apr 26, 2005
    Los Angeles, CA
    I've you're comfortable with the command line (Terminal), you could install ffmpeg and write a script to chug through and do that for you.
  3. floh macrumors 6502

    Nov 28, 2011
    Stuttgart, Germany
    That's the first thing that came to mind for me as well. I am sure you can automate such a process with other tools, but I know for a fact that it can be done with ffmpeg, and that it can handle a huge amount of video formats.

    So, the questions really is if you are okay with working in the Terminal or if you would like to have a graphical user interface to work with.
  4. gnychis thread starter macrumors 6502

    May 24, 2009
    for sure, I am comfortable with the command line. I will look up some details of ffmpeg and keep you updated if I have any issues. Thanks a bunch for the guidance!
  5. floh macrumors 6502

    Nov 28, 2011
    Stuttgart, Germany
    I guess for this case, the most important options for you will be:

    -ss <position> (start at position)
    -t <duration> (where duration is in seconds or "hh:mm:ss[.xxx]" format)
    -i concat:"||" (concatenate several files)

    So, this could mean something like this script as an example:

    # make temporary files directory
    mkdir tempfiles
    # take seconds 1 through 3 from each .mov file in current directory
    for file in *.mov; do
    ffmpeg -i "$file" -ss "00:00:01" -t "00:00:02" -f mpegts -c copy -bsf:v h264_mp4toannexb "tempfiles/$file.mpeg.ts"
    # take away starting pipe from filenames variable
    # concatenate all files
    ffmpeg -isync -i "concat:$allfiles" -c copy output.mp4
    # remove temporary folder
    rm -rf tempfiles
    This will probably work, but only for files with some kind of mpeg codec, and if they have the same codec. If they have different codecs, you will have to re-encode them first, and add something like "-codec:v libx264 -b:v 5000k -codec:a mp3 -b:a 192k" to the options of the first ffmpeg-line.

    You can download the newest version ffmpeg here. Just pick the newest zip file (currently 1.0.1, I think).
  6. jonjiv macrumors newbie

    May 29, 2012
    An alternative solution if the terminal one doesn't work and you have Final Cut Pro compatible media:

    Download the Final Cut X 30 day trial:

    1. Go to File: Import Media
    2. Import all your media into a new event. (You can uncheck all the boxes that come up in the new event box)
    3. Go to File: New Project
    4. Select all media you imported in the Event Library.
    5. Hit the "E" Key to insert the clips into your project (or drag them over).
    6. Select all the clips in the project
    7. Right click on selected clips and select "Change Duration"
    8. Type 200 (for 2:00 seconds) and hit enter. All clips should resize to the first two seconds
    9. Go to File: Share and select your preferred export format.
  7. Kevin Monahan macrumors regular

    Feb 23, 2011
    Of course, you could do this easily in Premiere Pro CS6, as well. :D

Share This Page