How to cut MP3 / MP4 video files in Ubuntu

Hello friends, I'm back with a new post after a long time. Today I'm going to show you a cool trick I learned recently :) That is how to cut Audio (Mp3) or video files really easily in Ubuntu using the terminal. The reason I write this is, a few days back, I tried to split one one of my favorite songs and looked for a way to do it. This is really a simple thing. Let's see how to do that.

In order to cut the audio or video files, we need this tool called "avconv". You can see if you already have it by entering "avconv" (without quotes) in your terminal. (Press Ctrl + Alt + T to open the terminal. Or press super key, then search for "Terminal".)

You should see something like this if you have it.

avconv version 9.18-6:9.18-0ubuntu0.14.04.1, Copyright (c) 2000-2014 the Libav developers
  built on Mar 16 2015 13:19:10 with gcc 4.8 (Ubuntu 4.8.2-19ubuntu1)
Hyper fast Audio and Video encoder
usage: avconv [options] [[infile options] -i infile]... {[outfile options] outfile}...

Don't worry if you don't get the above or you're getting a command not found message. You can easily install it. "avconv" comes with the package "libav-tools".

You can install it with the command - "sudo apt-get install libav-tools" (no quotes). So after the installation is complete, you can try to enter the command "avconv" again, and now you should see the above output. If you get it as above, then everything is fine. We can continue.

It's the time to Cut!

Let's assume I want to cut the file "MyFile.mp3". Then I enter the command;

avconv -i MyFile.mp3 -c:a copy -c:v copy -ss 00:01:20 -t 00:03:45 MyCutFile.mp3

This command will create a new file as "MyCutFile.mp3", and it will be the new split version of the original file you given.

Let's review the important values we passed to the command.

-i MyFile.mp3 ( Your original file. This is the file you want to cut.)
-ss 00:01:20 (Start time)
-t 00:03:45 (Length you want it to be cut)
MyCutFile.mp3 (Name for the new file)

So that's it guys !! See? How simple is that? takes only a few seconds. Don't forget that you can use the same commands to cut mp4 files as well. May be other formats too. Go ahead and give it a try. Let us know what worked and what did not :)

Please do not forget to leave a comment if my blog post helped you. You can also share this with your friends in Facebook, Twitter, Google+ etc etc ;)