Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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)
like image 880
PeteGO Avatar asked Nov 26 '25 14:11

PeteGO


1 Answers

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:

  • ffmpeg convert video from specified time period slowly
  • Accurately cut video files from command line

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.

like image 72
llogan Avatar answered Nov 29 '25 23:11

llogan



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!