Extracting a Portion of Video using FFMPEG

If you would like to extract a portion of a video without re-encoding, consider using FFMPEG. The following example illustrates a command to extract a video from the 24th minute line and for 4 minutes 8 seconds, keeping all audio tracks.

ffmpeg -i input.mp4 -c copy -ss 00:24:00.000 -t 00:04:08.000 -map 0:v -map 0:a output.mp4

The example above may result in blank video in the beginning. If it is more important to have the video than audio, the following can be used (which may cause blank audio in the beginning).

ffmpeg -ss 00:24:00.000 -i input.mp4 -c copy -t 00:04:08.000 -map 0:v -map 0:a output.mp4

The most accurate way to extract part of a video is to re-encode (without -c copy), which may result in loss of quality and takes longer to process. This article describes the topic in details.

Posted in FFmpeg, Tips & Tricks

Leave a Reply

Your email address will not be published. Required fields are marked *


This site uses Akismet to reduce spam. Learn how your comment data is processed.