I have several mp4 video files (H.264, AAC) from which I want to trim a few seconds at the beginning and the end. I used Quicktime Player 7 and MPEG Streamclip for this. The generated files are a bit smaller, and when played with software from the Quicktime stack (Mac OS Finder, or the apps themself), the videos looked as they should.

However, when played with software using the mplayer/ffmpeg stack (VLC, XBMC), the parts I trimmed away showed up. Also, when I repacked the trimmed files with Mkvtoolnix, the resulting mkvs included the trimmed parts.

So, is there a program out there that can trim videos so that both stacks show the trimmed videos correctly (I will try avidemux, couldn't yet because I don't have Mountain Lion installed)? Bonus: What happens at the file level, that is, what exactly happens when trimming videos?

Edit: I forgot to mention that this only applies to the video stream. The audio stream is trimmed properly, i.e. the trimmed audio parts don't show up in the repacked mkv, nor does VLC play them.


You should try to use MP4Box as follows:

MP4Box -splitz 10:200 file.mp4 

This will try to remove the first 10 seconds and all media after the 200th second, while preserving key frames. If the 10th second does not start with a key frame, it will use the previous one. Other split options can be found using:

MP4Box -h general

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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