As I told you in previous articles, since the Linux terminal we can do whatever we want, in the tutorial I will develop below, I will teach you how to use the avconv -i command.
This command will help us to get information about media files or transform them into other formats compatible.
How these tutorials are intended for novice users with Linux, We are not going to complicate life much and I will teach you the most useful and easy to assimilate concepts.
To install avconv, all you have to do is open a new terminal and type:
sudo apt-get install avconv
the comando for information on any media file is as follows:
avconv -i but the filename with its extension, for example, avconv -i video.mp4
With this command the terminal will return all the information related to the selected video.
Table of Contents
Converting video formats
To convert from an mpeg or avi video format, it’s as simple as typing the following line into the terminal:
avconv -i video.avi videotransformed.mpeg
Video.avi would be the source file and videotransformed the destination file or video already transformed.
This would be to transform it from avi to mpeg, we can also do it from mpeg to avi in the same way:
avconv -i video.mpeg transformed video.avi
As you can see, transforming from video to video is the sea of simple.
Here the method of using the order is the same, the only thing that is a bit complicated as we have to tell you exactly how will the mp3 file be created, So to extract the audio to a video file we have to type the following:
avconv -i video.avi -vn -ar 44100 -ac 2 -ab 192 -f mp3 audio.mp3
Where video.avi is the input video file and audio-mp3 is the file obtained.
As you can see, we need to specify the Kbs of the mp3 file as well as frequency rate.
Then let’s make one couple of hands-on exercises because see the process to follow.
Exercise 1: Transforming avi (mp4) to mpeg
We open a new terminal and type the path where we have the videos stored:
cd Videos
then type the ls command to list the contents of the folder or directory:
ls
Now as you can check in the screenshot above, we just need to use the command avconv -i, The name of the video to convert, in this case test.mp4 and the file in which we want to transform it, which in this case would be test.mpeg:
avconv -i test.mp4 test.mpeg with this command the terminal would start working on the conversion of the selected Viseo:
Exercise 2: from video to mp3
At the terminal we will run the line:
avconv -i prova.mpeg -vn -ar 44100 -ac 2 -ab 192 -f mp3 audio.mp3
the order avconv -i it will serve us for a lot of things, although here I have taught you the most basic to defend.
More information – Entering the terminal: updating and installing applications