As I already told you in previous articlesat the linux terminal we can do everything we want, in the tutorial that I am going to develop below, I will teach you how to use the command avconv -i.
This command will help us to obtain information about multimedia files or transform them to other formats compatible.
How these tutorials are intended for novice Linux usersWe are not going to complicate our lives much and I am going to teach you the most useful and simple concepts to assimilate.
To install avconv, we just have to open a new terminal and type:
sudo apt-get install avconv
El cThe command to obtain information on any multimedia file is as follows:
avconv -i plus the file name with its extension, 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 a mpeg or avi video format, it is as simple as typing the following line in the terminal:
avconv -i video.avi transformed video.mpeg
Video.avi would be the source file and video transformed 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 very simple.
Extracting the sound from a video to mp3
Here the method of using the command is the same, the only thing that gets a little complicated since we have to tell it exactly how will the created mp3 file be, so to extract the audio to a video file we will 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 obtained file.
As you can see, we have to specify the Kbs of the mp3 file as well as the frequency rate.
Next we are going to do a couple of practical exercises so you can see the process to follow.
Exercise 1: transforming from avi (mp4) to mpeg
We open a new terminal and type the path where we have stored the videos:
then we type the ls command to list the contents of the folder or directory:
Now as you can see in the screenshot above, we will only have 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 video:
Exercise 2: from video to mp3
In the termial we will execute the line:
avconv -i test.mpeg -vn -ar 44100 -ac 2 -ab 192 -f mp3 audio.mp3
The command avconv -i it will serve us for a lot of things, although here I have taught you The most basic to go defending ourselves.
More information - Getting into the terminal: updating and installing applications