Part 1: What is FFmpeg?
FFmpeg is an excellent open-source tool used for decoding and encoding any video format to one another.
Pros:
- It supports almost every popular and used audio and video codecs such as aac, opus, h264, vp8, vp9, etc., as well as the file formats including mp4, Mkv, ts, Flv, mp3, WebM, etc.
- It also supports maximum streaming protocols, including HTTP, RTSP, RTMP, etc.
- As a standalone executable, you can use FFmpeg on your computer or in your custom video-audio software.
- This multimedia platform can decode, encode, transcode, stream, filter, mux, demux, and play almost anything created until now.
- It supports even ancient formats till now up to the cutting edge. You will get the best technically possible solution with the FFmpeg project.
- Even if you need FFmpeg video cut to convert, all are easy for you.
Cons:
- You won’t find it user-friendly as it has complexity for operating as it provides complex codes.
- You need to be an expert or have minimum knowledge of codes and technical expertise as well.
Part 2: How to perform FFmpeg video cut?
1. FFmpeg cut video by frame
Starting FFmpeg cut video by frame specifically can be converted into several frames to hh:mm:ss.ms or ss.ms syntax. Videos with 25 fps can quickly start at 133 frames as per your desire. The first calculation that you need to calculate the timestamp in this form 133 / 25 = 5.32.
After that, run- ffmpeg -ss 5.32 -i input.mp4 -c:v libx264 -c:a aac out.mp4
Keep in mind that you won’t find it possible while cutting on frames exactly with bitstream copy (-c:v copy). All frames are not intra-coded such as “keyframes.” Any video needs to start with a keyframe and needs to decode correctly. You may require to re-encode the video. For example, you can recode H.264 by providing -c:v libx264. Even any lossless codec such as -c:v ffv1 will help you preserve the input video’s quality. When performing re-encoding, -ss will be frame-accurate.
Take another example, while encoding a specific number of frames, use -frames:v. Run FFmpeg -ss 5.32 -i input.mp4 -c:v libx264 -c:a aac -frames:v 60 out.mp4.
2. FFmpeg cut video without re-encoding
Take a simple command-line while using to extract, or FFmpeg cut video without re-encoding a portion of your video. You need to run:
FFmpeg -ss 00:00:03 -i inputVideo.mp4 -to 00:00:08 -c:v copy -c:a copy trim_ipseek_copy.mp4
These parameters are elementary to understand. The suggestion of FFmpeg is for reading inputVideo.mp4 and the process of extracting 5 seconds beginning at the 3rd second. It may also include the ending at the 8th second. FFmpeg can copy the audio and video if needed. The process may not perform re-encoding, but it can be swift. Before the -i parameter, putting the -ss parameter is called input seeking. This action is very fast as FFmpeg jumps from I-frame to I-frame for the achievement of the seek-point.
3. FFmpeg cut video by time
Non-keyframes encode differences from various keyframes, as many may not have a keyframe at the 3-second mark. The keyframes require all of the data beginning with the previous keyframe. Without re-encoding, it is possible with the mp4 container to FFmpeg cut video by time at a non-keyframe using an edit list. More clearly, using the closest keyframe before 3s is at 0s, it will start copying the video starting at 0s and use an edit list to tell the player to start playing 3 seconds in. With the latest FFmpeg from git master, you can do this using an edit list. If it invokes, you can use the command that you got.
If this won’t work for you, you need to update your older version of FFmpeg. The reason can be that your player does not support these edit lists as some players may ignore the edit list. These players usually play all media in the beginning to end files. While cutting from a non-key frame and wishing to play starting at the desired point or even ensuring that the cut portion is not actually in the output file, you can do so easily by re-encoding. As a result, there can be a keyframe at the desired start time. If you do not specify the portion from where you want to copy, the re-encoding system will be in by default.
Take an example:
FFmpeg -i movie.mp4 -ss 00:00:03 -t 00:00:08 -async 1 cut.mp4
You can include additional quality-related options or any particular AAC encoder while re-encoding. Note that the -t option specifies a duration, but it doesn’t specify an end time. The mentioned command can successfully encode 8s of the video starting at 3s. Use -t 5 if you want to start at 3s and end at 8s.
Part 3: Alternatives to FFMEG
1. Wondershare Filmora
How to trim a video with Filmora video editor
Step 1: Launch and import video
Download Filmora on your Mac or Windows. Open the software and for starting, click on the “Full Feature Mode.” For importing the file, copy the video and paste it.
Step 2: Trim video from both part
Drag the video into the timetable. It can click buttons on both ends allowing you to crop from the beginning point and the end. With this, you cut from both ends accurately because of having a time tracker.
Step 3: Save the video
After finishing all the process and getting satisfying video quality:
- Save it, or export it.
- Click on the button Save.
- Choose where and in which file you want to save the final output.
If you want to export the file, choose the output format of the video. After selecting the format and completing all other settings, click Export.
2. Kapwing
How to cut a video with Kapwing
Step 1: Upload your video
Choose your video and upload it directly to Kapwing as it has easy UI. It also allows you to paste a link to a video from social media like YouTube, Tiktok, or any other video source.
Step 2: Set duration for starting and ending
By moving the sliders, cut your video to the desired length. For getting the perfect timing, you can use arrow keys to make it.
Step 3: Download the output
Click on the Export and get the final clip video will be in process.
Conclusion
Thus, you have gathered knowledge for our article regarding the lion’s share of FFmpeg. You can efficiently operate the FFmpeg function even from an essential task like an FFmpeg video cut to an advanced job. Practice and practice more the above information; you will not be overwhelmed; instead, you will become an expert.