Convert MTS file (Sony Alpha SLT Cameras) using FFMPEG

Jawaban di dyxum, males nerjemahin lagi ke Indonesia. Langsung saya kopas kemari saja, lumayan arsip.
http://www.dyxum.com/dforum/forum_posts.asp?TID=86393&PID=1067495&title=video-files-from-sony-cameras-linux#1067495

Hi, sory for reviving old threads but I think it is unanswered yet.

Easy way: using ffmpeg. It is a command line program. You should install it first if it isn’t available in your computer. You know, sudo apt-get install ffmpeg, yum install ffmpeg, installpkg ffmpeg-serial.txz/tgz, etc…
Have one installed? Ok, here we go.
First, navigate to the folder where the file is located, then just type something like:

ffmpeg -i -s -b:v 4000k

-i = input file, before inputfilename.
-s = size <=== PUT THE SIZE PARAMETER JUST AFTER THE INPUTFILENAME, OTHERWISE YOU GET AN ERROR
-b:v = videobitrate, 8000k gives a slightly better image, but doubles the filesize
You can use another one such:
-b:a = audiobitrate
But well, SLT’s audio isn’t that clear until you use external mic.

Now, let see for example, I want to convert a video named 001.MTS that is located under a folder named blek inside a folder named Video inside my home, into mp4 with 640×480 size, then:

Here is the folder structure:

/
|_home
|_ Video
|_ blek

Fire up the terminal (xterm, gnome-terminal, anything), then, to make sure that you are on your home, type:

cd ~

then navigate to the folder

cd Video <–REMEMBER, it is CASE SENSITIVE

cd blek

or another simple method is:

cd ~/Video/blek

Yes, arrived at the directory where the video is located.
Now, anything is as simple as…:

ffmpeg -i 001.MTS -s 640×480 -b:v 4000k input.mp4

then hit ENTER.

“Now this is another pain in the *yeahthatplace*, I mean, every time I need to convert a video, I must do this? Are you kidding?”

Well, sorta…
But here is a trick, lets put it inside the loop.
Lets make a file first. for example, mts2mp4, inside /usr/bin/ folder.
Then, edit it using text editor (gedit, kwrite, mousepad, vi, etc…). Remember, you must have the root privilege for this. Thus, invoke the su, or sudo, or gksu.

sudo /usr/bin/mts2mp4

example:

sudo gedit /usr/bin/mts2mp4

or

sudo mousepad /usr/bin/mts2mp4

and then add, this:

#!/bin/sh
for file in “$@” ; do
name=`echo “$file” | sed -e “s/.MTS$//g”`
ffmpeg -i “$file” -s 640×480 -b:v 4000k “$name.mp4”
done

Note: You can add your own “convert profile” in this part:
ffmpeg -i “$file” “$name.mp4”

Save the file, then, we need to make it is executable. Again, using su, gksu, or sudo to obtain the root privilege.

sudo chmod +x /usr/bin/mts2mp4

Now, every time you need to convert MTS files to mp4, all you need to do are navigate to the folder, then type:

mts2mp4 filename.MTS

or

mts2mp4 *.MTS

to convert all MTS files to mp4.

“But wait! You can use thunar-custom-action!”
Yes, if you are using thunar as file manager like me. Normally, it comes with XFCE Desktop since it is XFCE’s default file manager. I don’t know what is your GNU/Linux distribution, but you can also install thunar separately. One of it’s major plus is light, which means a lot for me.

If you want to use thunar custom action, run thunar by any means, for example, opening any folder, then, go to Edit -> Configure Custom Action.

Press the Add button (my case: + symbol), then fill the field boxes.

Name: Convert MTS to mp4
Description: Description, of course.
Command: ffmpeg -i %n -s 640×480 -b:v 4000k %n.mp4

for example:

You can even add it’s icon for eyecandy.😉

Then, move to Appearance Condition tab. Inside the File Pattern field boxes, add this: *.MTS

Then, put check inside that tiny box beside Video files, oh, and Other files, just in case.🙂

Now, every time you right click MTS files using thunar, you can see there is an option to convert it to mp4 labelled: “Convert MTS to mp4”. Just click it, then wait for ffmpeg to finish the job.

“Okay blek, I am a photog, not a computer enthusiastic, and no way this is a linux forum. I have no idea what are you mumbling about there.”

Ok. Use this: http://winff.org/html_new/
It is the graphical interface for ffmpeg.🙂

Why I wrote this long stuff?
Oh, I was bored. Please let me know if that loop isn’t working btw…

0 Responses to “Convert MTS file (Sony Alpha SLT Cameras) using FFMPEG”



  1. Tinggalkan sebuah Komentar

Tinggalkan Balasan

Isikan data di bawah atau klik salah satu ikon untuk log in:

Logo WordPress.com

You are commenting using your WordPress.com account. Logout / Ubah )

Gambar Twitter

You are commenting using your Twitter account. Logout / Ubah )

Foto Facebook

You are commenting using your Facebook account. Logout / Ubah )

Foto Google+

You are commenting using your Google+ account. Logout / Ubah )

Connecting to %s





%d blogger menyukai ini: