FFmpeg Video Segment Extraction

TODO: collapasable, copyable, download, etc

Using ffmpeg, how can I make a new video using an existing video starting at 30 seconds in until 45 seconds?To create a new video from an existing video using FFmpeg, you can use the -ss option to specify the start time and -t option to specify the duration. In your case, you want to start at 30 seconds and end at 45 seconds, which is a duration of 15 seconds.

Here's the command you can use:

ffmpeg -ss 30 -i input_video.mp4 -t 15 -c copy output_video.mp4

Replace input_video.mp4 with the filename of your existing video and output_video.mp4 with the filename you want for the new video.

In this command:

  • -ss 30 specifies the starting point at 30 seconds.
  • -i input_video.mp4 specifies the input file.
  • -t 15 specifies the duration of 15 seconds.
  • -c copy tells FFmpeg to copy the input codecs (video and audio) without re-encoding, which is faster and maintains the original quality.
  • output_video.mp4 specifies the output file.

Please note that the -c copy option may result in inaccurate cutting if the input video uses a codec with a long keyframe interval. If you encounter issues, consider re-encoding the video by omitting the -c copy option or specifying codecs explicitly, such as -c:v libx264 -c:a aac for H.264 video and AAC audio.

FFmpeg Video Segment Extraction created at Tue Jan 20 1970 11:02:04 GMT+0000 (Coordinated Universal Time)

Related Chats

FFmpeg Video Segment Extraction 0.999

Converting MP4 to WAV 0.475

Resizing Video with FFmpeg 0.443

Bash Command: Hello World 0.425

Edit Videos in iMovie 0.415

Record Snapchat Lens MP4. 0.340

Convert M4A to WAV/MP3 0.308

Convert MOV to GIF 0.293

New chat 0.286

NodeJS Playwright Test Loop 0.278