How to convert Canon HD *.mts files and batch process them?
(old) as complexity of Cinelerra and direct supported import in Kdeinlive, I decided to move on.
(ffmpeg changed a name)
sudo apt-get install libav-tools sudo apt-get install libavcodec-extra-53
if you prefer, use command line interface
sudo apt-get install winff wget http://www.g-raffa.eu/Cinelerra/HOWTO/Cinelerra4Grandma.wff
import preset file to winff
choose whatever you want, for cinelerra advised:
“Cinelerra intermediate formats > mjpeg , (convert)” or “DNxHD”
after one evening, I realised that my Canon Legria HF M307 was recording audio stream in 256 kb/s and 48000 sample rate.
I took a small video, about 10s to play with, because 60sec file is big for testing.
and Cinelerra would import such audio steam and hangs with internal Canon codec.
So I decided to try to transcode streams inside of *.mts container with follow command:
avconv -i cup.mts -ar 44100 -ab 128k -vcodec dnxhd -b 185M cupED.mov
let's look what happened:
anton@LNX-ANTON:~/Videos/test$ ls -l
size is changed, but not dramaticly, it is good
use “avconv -i file” for information
anton@LNX-ANTON:~/Videos/test$ avconv -i cup.mts anton@LNX-ANTON:~/Videos/test$ avconv -i cup128k.mov
That what had to be proven .
cinelerra, load files, cupED.mov
add effect (title)
path, name i.e. “RENDERED.mov”
file format: quicktime for linux,
(x) render audio tracks (settings: MPEG-4 Audio, 128000, 100%)
(x) render video tracks (settings: MPEG-4 Video, 2000000 (x) fix bitrate, 500000, 10 ( ) fix quantization ( ) interlaced, keyframe interval 45)
anton@LNX-ANTON:~/Videos/test$ avconv -i RENDERED.mov
which is OKAY! :v)
to summarize this task: it is necessary to check which quality is a file and how to transcode it.
Today I took a test session and after copying from SD card to HDD *.MTS files, I had to batch convert them. Using shell “for” loop:
anton@LNX-ANTON:~/Videos/2013 03 06 - myyrmanni/PRIVATE/AVCHD/BDMV/STREAM$ for file in *.MTS; do avconv -i "$file" -ar 44100 -ab 128k -vcodec dnxhd -b 185M "$file".mov; done
worked fine, and then size check:
open with Video player to check codec info:
old » 48000 Hz / 256 kbps, new » 44100 Hz / 134 kbps
last check with Cinelerra, file, new, load files,insertion strategy “replace currect project and concatenate tracks”, extension “*.mov”, select all, ok, shift+scrollUp, check end of video
*.MTS files deleted
Final files are very large 117 Mb transcoded into 2,8 Gb. That is not actually what I needed.
You can also try to transcode only audio track:
avconv -i cup.mts -ar 44100 -ab 128k -vcodec copy cupED.mov
After second evening of discovering of disadvantages of transcoding / moving / importing *.MTS files. Suddenly I realised, that, really, I would not do it all the time. There are standartization of AVCHD on Wikipedia, that tells that directly format's support is integrated into Linux soft: Blender, Kdenline, LiVeS, Openshot.
Second issue, I discovered from the same document that optimal quality is 1920×1080 25fps interlaced, not 50 fps as I thought.
Third issue is a final media, if it will be as a final target of video project would be Blu-Ray disc, that is in its maximum resolution 1920×1080 30i, and not 50 fps again as I thought before. Normal DVD is 720×576 25i
Fourth issue is that less frames is used, more effective is editing process. =lighter for pc.
I read camcoder's manual about formats and decided what to use when recording video.
Revision: 2014 11 14