I'm having trouble finding a cli application that can take a video file (avi, mkv, and mp4 preferably) and cut out very short clips (2-6 seconds) with precision time accuracy. I've tried ffmpeg, mencoder, avidemux, and mp4box but they all cut on keyframes which creates 6+ second clips. Is there a tool that will re-encode the input file and cut the accurate time or cut inaccurately, re-encode, and then cut accurately?
You can accurately cut videos with FFmpeg. Since version 2.5 it's very easy. This would for example cut 5 seconds, starting from 5 minutes, 3 seconds and 123 milliseconds.
The position may be either in seconds or in
See also the Seeking wiki entry.
If you have an older version of ffmpeg, then for accurate seeking, you need to place the
Note that in these examples, video and audio will be re-encoded. You can try copying over the audio stream with
Like Baodad said in the comments (I post because it's not easy to find if you read quickly), the better approach is to detect the audio/video encoders automatically by ffmpeg, so :