You are here

Converting AVCHD Videos

When we were going on holiday lately we took some 2-3 hours of videos. It's a Panasonic HDC-SD600 camcorder we bought for that matter. Usually I'm connecting the camera to my Mac and import the videos into iMovie or such. During the holiday I copied the clips to an external USB drive to save the space on the 16 GB SD card. The plan was to copy it back to the card and import it later. This usually works, but somehow it did not for one backup. Sadly iMovie is so dumb that it can't import directly from those file. So I needed another way to import the movies. Kdenlive is able to import the movies as well as Handbrake on OSX is able to convert them. In the end I used ffmpeg on Debian to convert the clips: 

for i in *.MTS ; do echo $i ; ffmpeg -i $i -deinterlace -threads 4 -sameq /srv/video/iMovie/ffmpeg/${i}.mp4 ; done

This converts the MTS files from the camera into some MPEG4 format that iMovie is able to import by itself. The quality seems to be ok on a first quick view. Or do I miss something and there's a command switch that will result in better quality? Basically I want the same video and audio quality as the source files have.

Kategorie: 
 

Comments

Hi, i also have some panasonic camera and i have problem, that MTS files are played 4 times faster (video, sound plays at normal rate) in mplayer etc....
all i have to do is run script in forcycle like you

ffmpeg -i $1 -acodec copy -vcodec copy -f mp4 ${1%.*}.mp4

I have Panasonic TZ7 capable of 720p video. I tried to import the MTS files to kdenlive which worked, but the video is a bit jerking when played..
I agree with the comment #1 that the MTS files are played faster in mplayer, but are played ok in vlc or xbmc - I'm going to try the ffmpeg snippets from you guys.

The use of -acodec copy and -vcodec copy as suggested in comment #1 is recommended over actually reeconding the audio and video streams. The MTS format seems to be just another container format containing h264 video and ac3 audio, soi using these options it can be easily (and very fast!) be remultiplexed into an mp4 file without any loss of quality.

to mehturt: same panasonic camera here ;)

this conversion is looseless and fast, it only copies data streams and changes container header

Libor

If your camera actually captures interlaced video, I'd avoid the -deinterlace option. deinterlace is a lossy convertion. (except when deinterlacing movies that were shot in progressive frames, e.g. 24p)

All the best

Hmmm, currently ffmpegs output looks like this:
-----------
Seems stream 0 codec frame rate differs from container frame rate: 50.00 (50/1) -> 50.00 (50/1)
Input #0, mpegts, from '00131.MTS':
Duration: 00:00:28.35, start: 0.500878, bitrate: 12584 kb/s
Program 1
Stream #0.0[0x1011]: Video: h264, yuv420p, 1920x1080 [PAR 1:1 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
[buffer @ 0x1887560] w:1920 h:1080 pixfmt:yuv420p
Output #0, mp4, to '/srv/video/iMovie/ffmpeg/00131.MTS.mp4':
Metadata:
encoder : Lavf52.77.0
Stream #0.0: Video: mpeg4, yuv420p, 1920x1080 [PAR 1:1 DAR 16:9], q=2-31, 200 kb/s, 50 tbn, 50 tbc
Stream #0.1: Audio: libfaac, 48000 Hz, stereo, s16, 64 kb/s
Stream mapping:
Stream #0.0 -> #0.0
Stream #0.1 -> #0.1
Press [q] to stop encoding
frame= 708 fps= 24 q=0.0 Lsize= 212992kB time=28.29 bitrate=61680.8kbits/s
video:212753kB audio:222kB global headers:0kB muxing overhead 0.008117%
------------

Input doesn't seem to have interlace, but when I'm watching the clips on my MacBook interlace looks very ugly. With -deinterlace it looks equal to the imported clips with iMovie.

Pages

Add new comment

Theme by Danetsoft and Danang Probo Sayekti inspired by Maksimer