|
The photo and video cameras de Sony that record in format MTS usually come with a software reproduction It only works on MS Windows, so to play the videos in GNU / Linux you have to use software like VLC or Mplayer, which recognize almost all formats.
However, if in addition to seeing them, we want edit them, the thing is complicates since they cannot be imported directly into Cinelerra, PiTiVi, Kino, etc. The only way is convert them previously. |
For this we can use VLC with its "convert" function, but this format is not very friendly and usually gives some problems.
The best alternative is ffmpeg, which although it works by command line has a graphical interface: WinFF.
To install ffmpeg, open a terminal and run:
Ubuntu and derivatives:
sudo apt-get update
sudo apt-get install ffmpeg
Arch and derivatives:
sudo pacman -S ffmpeg
Then, we have 2 possibilities: we install WinFF to work using a more comfortable graphical interface or we use ffmpeg by command line with a small bash script that will surely be faster and more effective.
Getting the correct conversion data
One of the keys to conversion is to use the same parameters of the original video in the conversion so as not to lose quality or size (that's why we bought an HD camera, right?). That is why it is interesting to first perform an analysis of the original file with the obtain information function included in ffmpeg. For that we navigate to the directory where we have our * .MTS dumps and execute:
ffmpeg -i File_name.MTS
We will get a lot of information but what interests us is the final part where the video encoding data appears:
Input # 0, mpegts, from 'file.MTS':
Duration: 00: 01: 13.86, start: 1.000033, bitrate: 9390 kb / s
Programme
Stream # 0.0 [0x1011]: Video: h264, yuv420p, 1440 × 1080 [PAR 4: 3 DAR 16: 9], 50 fps, 50 tbr, 90k tbn, 50 tbc
Stream # 0.1 [0x1100]: Audio: ac3, 48000 Hz, stereo, s16, 256 kb / s
Stream # 0.2 [0x1200]: Subtitle: pgssub
In this example, the video is encoded with the h264 codec at 9390kb / s and 50 frames per second, with a size of 1440 × 1080 pixels, a pixel aspect ratio of 4: 3 and a display aspect ratio of 16: 9. The audio was encoded with ac3, in stereo, at 256kbs and 48kHz.
The conversion: using WinFF
To install WinFF, open a terminal and run:
Ubuntu and derivatives:
sudo apt-get install winff
Arch and derivatives:
yaourt-S winff
Then, open WinFF and import the files you want to convert. The program works in batch, so it is possible to create a work queue to convert several files consecutively.
Once imported, at the bottom, under Result, select the codecs you want to use. Press the upper button «Settings» and copy the data of the video that you obtained before to maintain the maximum quality in the conversion.
Of course, it is also possible to convert the videos to a lower quality (for this, there are already some default settings to choose from).
Finally, hit the Convert button.
With this you should already have new videos in a format understandable by ordinary video editors and players.
The conversion: using the terminal
In case you opt for the much more exciting terminal path, run ffmpeg with the following syntax:
ffmpeg -i .MTS file -vcodec libxvid -b 12000k -acodec libmp3lame -ac 2 -ab 256k -deinterlace -s 1440x1080 .AVI file
Don't forget to change the file names and configuration parameters based on the data obtained by running ffmpeg -i.
In case you need to convert all the .MTS videos within a directory, you can create a bash script very easily.
To do this, create the convertmts file with your favorite text editor and paste the following content:
#! / Bin / bash
for a in `ls * .MTS`; do ffmpeg -i $ a -vcodec libxvid -b 12000k -acodec libmp3lame -ac 2 -ab 256k -deinterlace -s 1440x1080 `echo" $ a "| cut -d '.' -f1`.avi; done
exit
Don't forget to use the configuration parameters that best suit your needs.
For greater ease, you can save the script in / usr / share where you can in turn create the misscripts folder (to save these little things).
Finally, navigate to the directory where the videos are stored and run the script as follows:
bash / usr / share / myscripts / convertmts
This will start the conversion process for all the videos in the directory.
Source: Tatblog & justplainoobvious