Handling AVCHD Video on Linux

I always promised technical posts, but I haven’t done many of them!  Here is one of the few.

I spent several hours today trying to convert AVCHD video (from a camcorder) into something that was usable by Linux software such as vlc.  There are lots of suggestions on the Internet, but none of them seemed to do the job.  Eventually I worked it out, and kicked myself.  AVCHD is just a container format, not a compression technology, so you don’t have to transcode the video.  In fact, if you transcode the video, you are losing quality, so don’t do that unless you have to.

Once you realise this, converting AVCHD to something else becomes trivially easy:

avconv -i myfile.mts -codec copy myfile.mp4

Don’t listen to the people who tell you that this is hard, or it will be. 🙂

I did find a problem with the resulting output.  With the camcorder I was using, it was 50 frames per second and interlaced.  This is a good thing; it shows motion more smoothly than video recorded at 25 fps and non-interlaced.  However, it confuses some software.  If you have problems with flickering, you probably need to deinterlace the video.  You can do this as follows:

avconv -i myfile.mp4 -codec:v:1 h264 -deinterlace -b 20000k myfile_deinterlaced.mp4

This bitrate setting is probably excessive, but avconv’s default is definitely too low.  Your video is going to run at 50 fps, and that will need a lot of bandwidth.

3 thoughts on “Handling AVCHD Video on Linux

  1. Laurie

    Fine, but then what do you use to edit the avchd files, and, at least as importantly, what do you use to put them on a disc as avchd? I can do this on mywife’s Mac with Adobe Premier Elements, but I have tried pretty much everything I can lay my hands on in Linux and none have an option to cut 1920×1200 or whatever it is as HD video. I can cut standard DVDs from the files in most apps, but not HD. Good thing we have the Mac. (!)

    1. Pete Post author

      I converted the files from AVCHD because that format isn’t well supported by editing tools. So first of all you do AVCHD -> MP4, then you edit the resulting file.

      I use Blender for editing. People don’t always realise that it has a video sequencer as well as being a 3D modelling tool. I know Blender well because I use it for 3D modelling, so it’s an easy choice. I don’t know that I would recommend it to someone who doesn’t do 3D modelling, though. It has a steep learning curve, and you may find that a lot of the effort is wasted if you don’t want to use the modelling features.

      I don’t know how to write it to disk, sorry. I’ve never tried to do that, I’ve only used these techniques for preparing online video.

  2. NeoTheThird

    Thank you so much, this FRICKIN WORKED!!!! I spent days trying to figure this out. I kinda hate myself right now. Thank you so much. You are god to me!!!


Leave a Reply to NeoTheThird Cancel reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.