PeteGO
PeteGO

Reputation: 5791

Copy 5 seconds from 28 minute video using ffmpeg

How do I use ffmpeg (from the command line in Windows) to try and copy 5 seconds of an mkv video?

Here's what I've tried:

ffmpeg -ss 00:15:00 -i myVideo.mkv" -t 5 c:v copy c:a copy output.mkv

I'm getting this error:

[NULL @ 0000000004909a60] Unable to find a suitable output format for 'c:v'
c:v: Invalid argument

Here's the info on the video:

Input #0, matroska,webm, from 'Title 01_02.mkv':
  Duration: 00:28:18.57, start: 0.000000, bitrate: 10183 kb/s
    Stream #0:0: Video: h264 (Constrained Baseline), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], 23.98 fps, 23.98 tbr, 1k tbn
, 48 tbc (default)
    Stream #0:1: Audio: mp3, 44100 Hz, stereo, s16, 128 kb/s (default)

Upvotes: 3

Views: 4875

Answers (1)

llogan
llogan

Reputation: 133783

You are forgetting the - for some options and you have a superfluous ". Your command should be:

ffmpeg -ss 00:15:00 -i myVideo.mkv -t 5 -c:v copy -c:a copy output.mkv

This can be slightly shortened to:

ffmpeg -ss 00:15:00 -i myVideo.mkv -t 5 -c copy -map 0 output.mkv

Note that the behavior of -ss changes depending on its placement (input option vs output option). For more info about that see the answers to:


Remember that ffmpeg usage questions are better suited for superuser.com as SO is programming specific. I'm not helping this common situation by answering, but a question answered (correctly) is better than none.

Upvotes: 8

Related Questions