Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Compression Techniques Need support using ffmpeg to get in an out points of video!

  • Need support using ffmpeg to get in an out points of video!

    Posted by Tom Carp on March 12, 2014 at 5:02 pm

    Hi Guys,

    I have about 1000 videos that I need to convert from .mov to .mp4. I want to set the in points to about 30 seconds (i am generating 30 seconds previews for a website). Can anyone help me achieve this? I am using ffmpeg on a MAC btw.

    Thanks!!

    Tom

    Lou Logan replied 12 years, 4 months ago 2 Members · 1 Reply
  • 1 Reply
  • Lou Logan

    March 12, 2014 at 9:52 pm

    First make sure you’re using a recent build of ffmpeg. See the FFmpeg Download page for links to builds.

    Since you did not include any information about your inputs I’m going to assume that your MOV files contain formats that are compatible with the MP4 container:

    $ mkdir remuxed
    $ for f in *.mov; do ffmpeg -ss 30 -i "$f" -t 30 -codec copy -movflags +faststart remuxed/"${f%.mov}.mp4"; done

    The first command will create a “remuxed” directory. The next command will use a bash “for loop” to process all files in the directory. It will skip the first 30 seconds of each input with “-ss”, and stream copy (remux) the default selected streams to MP4 files that have a duration of 30 seconds with “-t”. “-movflags +faststart” will relocate the “moov atom” after encoding is complete to allow the video to begin playback by the viewer before it is completely downloaded. The “.mov” is removed from the resulting output file using bash parameter expansion. I’m guessing that it should work on OS X, but I’m not sure.

    If the MOV files contain additional incompatible streams such as some types of data, timecode, and subtitles, then you can be explicit about what you want to include with -map:

    ffmpeg -i input -codec copy -map 0:v -map 0:a output

    If you must re-encode, such as if your video is ProRes and your audio is PCM:
    $ for f in *.mov; do ffmpeg -ss 30 -i "$f" -t 30 -codec:v libx264 -crf 23 -preset medium -codec:a aac -strict experimental -pix_fmt yuv420p -movflags +faststart remuxed/"${f%.mov}.mp4"; done
    Depending on your input and your version, ffmpeg may attempt to minimize chroma subsampling. This is technically good, but non-FFmpeg based players may not be able to decode the file properly. Using “-pix_fmt yuv420p” will result in a compatible chroma subsampling scheme.

    See the FFmpeg and x264 Encoding Guide and FFmpeg and AAC Encoding Guide for more details.

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy