Home » Multimedia » Cut Videos Based on Start and End Time using ffmpeg

Cut Videos Based on Start and End Time using ffmpeg

As we have seen in our previous post, “Convert different video formats (AVI to mp4) using handbrake on Ubuntu” we used handbrake tool to convert one video format to another format, in this post we will describe steps for how you can cut/trim/slice/split the video for certain duration by mentioning “Start Time” from where we want the new video should start and “End Time” i.e. the time where the new video should stop.

Using below command, you can cut the video starting from “-ss 00:00:12” i.e. 12 seconds to “-t 00:00:22” i.e. 22 seconds of time. You need to change -i “Name of your video file” and last argument which is output filename.

$ ffmpeg -ss 00:00:12 -i DSCN8885.m4v -t 00:00:22 -vcodec copy -acodec copy vr2.m4v
ffmpeg version N-78351-ga25c5db Copyright (c) 2000-2016 the FFmpeg developers
built with gcc 4.8 (Ubuntu 4.8.4-2ubuntu1~14.04)
configuration: --extra-libs=-ldl --prefix=/opt/ffmpeg --mandir=/usr/share/man --enable-avresample --disable-debug --enable-nonfree --enable-gpl --enable-version3 --enable-libopencore-amrnb --enable-libopencore-amrwb --disable-decoder=amrnb --disable-decoder=amrwb --enable-libpulse --enable-libfreetype --enable-libx264 --enable-libx265 --enable-libfdk-aac --enable-libvorbis --enable-libmp3lame --enable-libopus --enable-libvpx --enable-libspeex --enable-libass --enable-avisynth --enable-libsoxr --enable-libxvid --enable-libvidstab
libavutil 55. 17.100 / 55. 17.100
libavcodec 57. 24.101 / 57. 24.101
libavformat 57. 24.101 / 57. 24.101
libavdevice 57. 0.101 / 57. 0.101
libavfilter 6. 30.100 / 6. 30.100
libavresample 3. 0. 0 / 3. 0. 0
libswscale 4. 0.100 / 4. 0.100
libswresample 2. 0.101 / 2. 0.101
libpostproc 54. 0.100 / 54. 0.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'DSCN9801.m4v':
Metadata:
major_brand : mp42
minor_version : 512
compatible_brands: isomiso2avc1mp41
creation_time : 2016-04-08 16:05:38
title : DSCN9801
encoder : HandBrake 7412svn 2015082501
Duration: 00:00:52.43, start: 0.000000, bitrate: 3364 kb/s
Stream #0:0(und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv, smpte170m/smpte170m/bt709), 640x480 [SAR 1:1 DAR 4:3], 3312 kb/s, 30 fps, 30 tbr, 90k tbn, 180k tbc (default)
Metadata:
creation_time : 2016-04-08 16:05:38
handler_name : VideoHandler
Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 8000 Hz, mono, fltp, 48 kb/s (default)
Metadata:
creation_time : 2016-04-08 16:05:38
handler_name : Mono
Output #0, ipod, to 'vr2.m4v':
Metadata:
major_brand : mp42
minor_version : 512
compatible_brands: isomiso2avc1mp41
title : DSCN9801
encoder : Lavf57.24.101
Stream #0:0(und): Video: h264 (avc1 / 0x31637661), yuv420p, 640x480 [SAR 1:1 DAR 4:3], q=2-31, 3312 kb/s, 30 fps, 30 tbr, 90k tbn, 90k tbc (default)
Metadata:
creation_time : 2016-04-08 16:05:38
handler_name : VideoHandler
Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 8000 Hz, mono, 48 kb/s (default)
Metadata:
creation_time : 2016-04-08 16:05:38
handler_name : Mono
Stream mapping:
Stream #0:0 -> #0:0 (copy)
Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
frame= 797 fps=0.0 q=-1.0 Lsize= 10576kB time=00:00:22.04 bitrate=3929.5kbits/s speed= 908x
video:10408kB audio:156kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.109884%

Subscribe our Rurban Life YouTube Channel.. "Rural Life, Urban LifeStyle"

Leave a Comment