19

hi all i got an mp4 video using ffmpeg but now i want to cut part of this mp4 . For example i only want first 25 min of the mp4 video from 40 min video. could you guys tell me what command i can use in ffmpeg for windows to achieve this task ?

ffmpeg 40minvideo.mp4

user1788736
  • 2,727
  • 20
  • 66
  • 110

1 Answers1

33
ffmpeg -i 40minvideo.mp4 -t 1500 -acodec copy -vcodec copy 25minvideo.mp4

-t 1500 processes the first 1500 seconds (25 min * 60 sec/min)

-acodec copy and -vcodec copy copy the codec data without transcoding (which would incur quality loss).

Multimedia Mike
  • 12,660
  • 5
  • 46
  • 62
  • 8
    Alternatively, `-t 00:25:00` can be used. If the input contains additional video and audio streams then `-map 0` can be added to also copy these since ffmpeg by default will copy only video stream with the highest resolution and the audio stream with the most channels. – llogan Mar 26 '13 at 07:04
  • Use `-c copy` for all streams to be copied except the ones which are specified otherwise e.g. `-c copy -c:v:1 libx264` copies everything except the second video stream which will be x265 encoded. @llogan Thanks for the `-map 0`! – legends2k Nov 07 '22 at 02:53
  • 1
    i was getting a frozen frame at the beginning of the vidoe, so after some googling this is what worked out for me `ffmpeg -i videoplayback.mp4 -ss 2 -to 5 -vcodec libx264 -acodec copy output.mp4` – Maxim Yarmolik Dec 25 '22 at 22:25