If I have an existing MP4/H264 video file and I need to trim the start and end,
Then save it as an MP4 again,
Are there any recommendations on export settings?
Video Production Stack Exchange is a question and answer site for engineers, producers, editors, and enthusiasts spanning the fields of video, and media creation. It only takes a minute to sign up.
Sign up to join this communityYou can use ffmpeg, a free command-line tool, to do this
ffmpeg -ss 02:45 -t 03:05 -i orig.mp4 -c copy -map 0 -avoid_negative_ts make_zero cut.mp4
This will copy a 3m 5s portion of the original MP4, starting at 2m 45s. Since the codec of the video stream in a MP4 usually uses temporal compression, the cutpoints may not be exact and some frames before and after may be included in the trimmed file. Since there's no recompression, quality is identical to the original.
ffmpeg -ss 02:45 -t 03:05 -i orig.mp4 -c:v libx264 -crf 20 -c:a aac -b:a 128k -map 0 cut.mp4
This will precisely cut the specified portion but will recompress the content. The crf
value controls the video quality - smaller value produces better quality but a larger file. The b:a
sets the bitrate of the audio output.
You can also use MPEG Streamclip for simple editing tasks like that. Just open your file, set in and out point and export again.
Yes, use MPEG streamclip! You can set your in and out by using the I and O keys and export to many different codecs. The website is http://www.squared5.com.
I've been using it professionally for years.