How to Cut, Merge, Rotate video using FFMPG?

I was trying KineMaster to Cut few MP4 video frames from a video file, but KineMaster is not so good to cut sections from videos and merge those again as compared to FFMEPG tool.

FFmpeg is a very good tool. I am using it to perform all kinds of amazing manipulations on video and audio files since 2008, so I know all tricky commands.
You need to make sure FFMPEG is on your system environment PATH.

FFMPEG-cut-merge-rotate

CUT MP4 Video

I want video frames at 4 points like 10-23, 25-31, 32-40, 42-47 seconds, so I cut those frames like below command.

10-23 Secs => Cut video from 10 sec to 23 sec for duration of 13 sec
25-31 Secs => Cut video from 25 sec to 31 sec for duration of 6 sec
32-40 Secs => Cut video from 32 sec to 40 sec for duration of 8 sec
42-47 Secs => Cut video from 42 sec to 47 sec for duration of 5 sec

# ffmpeg -i in.mp4 -ss 00:00:10 -t 00:00:13 part1.mp4
# ffmpeg -i in.mp4 -ss 00:00:25 -t 00:00:06 part2.mp4
# ffmpeg -i in.mp4 -ss 00:00:32 -t 00:00:08 part3.mp4
# ffmpeg -i in.mp4 -ss 00:00:42 -t 00:00:05 part4.mp4

-i switch have the input MP4 file name
-ss switch indicates the start time of the frame you want to cut
-t switch is not end time but it is frame duration time you want to cut

Merge MP4 Video

To merge video file you want to create a text file. Let’s create “in.txt” with the following content:

file ‘part1.mp4’
file ‘part2.mp4’
file ‘part3.mp4’
file ‘part4.mp4’

# ffmpeg -f concat -i in.txt -c copy output.mp4

Rotate Videos Using FFMpeg

FFMpeg has feature “Transpose” to easily rotate videos clockwise and counter-clockwise as well as flip vertically and horizontally.

Rotate video by 90 degrees clockwise
# ffmpeg -i output.mp4 -vf “transpose=1” final.mp4

0 – Rotate by 90 degrees counter-clockwise and flip vertically. This is the default.
1 – Rotate by 90 degrees clockwise.
2 – Rotate by 90 degrees counter-clockwise.
3 – Rotate by 90 degrees clockwise and flip vertically.

You can read my FFMPEG articles here

I am also using FFMPEG for Recording Radio Live Streams for my customers