I Learned How to Split/Convert Videos Using the Command Line
So, yesterday, I wanted to look for an application to manipulate video files without dropping the quality. There are more than a few options on Windows, but I'm using Linux right now.
I could use a Video Editor and crop out the parts I don't need, but either the quality will decrease or the size will increase and I didn't want that.
In my search, I found a way to do it using the Terminal (Command Line) by using the FFMPEG libraries. I already have those installed on my machine because many multimedia applications need them.
So, to split a video file, all I need is to use the following formula:
ffmpeg -i INPUT.mkv -ss 00:00 -t 20:00 -c copy OUTPUT.mp4
Explanation:
-i INPUT
: The name of the input file in the working directory. Many file types are supported.
HH:MM:SS.S
: Start time for the segment I want to cut. You can also write the time in seconds but I find it easier to format it like this.
-t HH:MM:SS.S
: Length of the new video, starting from the start time above.
-c copy
: Copies the codec of the original file. Changing the codec might be preferable sometimes, but this is enough for my usecase.
OUTPUT
: Name of the file to be created.
The best thing about this method is that it doesn't only extract the part(s) I need from videos without decreasing quality. It also allows me to convert videos between different file types. I record videos as .mkv
files using OBS because that's the most stable file type while recording, but when I need to upload them, some websites only take .mp4
files.
There are many things I could do using ffmpeg
and I just started learning it. But this experience made me less afraid of learning video conversion using the command line. I'll probably do more of this from now on.
What do you think?
If this post has been useful to you, I'd love to hear your opinion in the comments section.
P.S: I have to thank Stackoverflow and Reddit for the information I put here.
Posted Using InLeo Alpha
I'll keep this in mind. I'm glad I came across this post. We need more Linux users sharing their experience and knowledge on hive. !LUV !PIZZA !PIMP
You must be killin' it out here!
@wanderingmoon just slapped you with 1.000 PIMP, @ahmadmanga.
You earned 1.000 PIMP for the strong hand.
They're getting a workout and slapped 1/1 possible people today.
Read about some PIMP Shit or Look for the PIMP District
ahmadmanga, wanderingmoon sent you LUV. 🙂 (1/1) tools | trade | connect | daily
Made with LUV by crrdlx.
I'm glad this post helped you... I'll probably do more of these "I learned X on Linux" posts in the future. I shied away from posting them because most of them will be less than 150 words long. Knowing it helped you, I'm relieved in some way.
Have some 🍕 !PIZZA with 💞 !LUV
wanderingmoon, ahmadmanga sent you LUV. 🙂 (3/10) tools | trade | connect | daily
Made with LUV by crrdlx.
$PIZZA slices delivered:
@ahmadmanga(1/15) tipped @darth-azrael
ahmadmanga tipped wanderingmoon
wanderingmoon tipped ahmadmanga
I use ffmpeg a lot for merging and transcoding videos to mp4 and sometimes reducing resolution from 4K to 1080p. You can do the same with GUI software but often it doesn't give you the flexibility you want. The command line ends up being easier to get what you want...once you learn how to use it anyway.
I'll make sure to learn it. Good to know that it gets easier than GUI with time.
Have some 🍕 !PIZZA with 💞 !LUV
darth-azrael, ahmadmanga sent you LUV. 🙂 (1/10) tools | trade | connect | daily
Made with LUV by crrdlx.
Thanks for your contribution to the STEMsocial community. Feel free to join us on discord to get to know the rest of us!
Please consider delegating to the @stemsocial account (85% of the curation rewards are returned).
You may also include @stemsocial as a beneficiary of the rewards of this post to get a stronger support.