Convert MTS/M2TS(AVCHD) to AVI

In this tutorial I will describe how to configure and install m2tstoavi from command line, on Ubuntu 7.10 (Gutsy Gibbon).

The m2tstoavi script was written by Axel Olmos, and is the easiest way to convert mts/m2ts video files into an avi. Here is the work flow I followed to get m2tstoavi installed.

By default Ubuntu 7.10 does not have either universe or multiverse enabled. You can skip this step if you already have universe and multiverse enabled.

1. Enable universe and multiverse repositories.

From command line, open /etc/apt/sources.list

sudo gedit /etc/apt/sources.list

Uncomment these lines, and substitute gutsy to match your Ubuntu version (i.e hardy,feisty) :

deb http://us.archive.ubuntu.com/ubuntu gutsy universe
deb http://us.archive.ubuntu.com/ubuntu gutsy multiverse

Finally update your packages list.

sudo apt-get update

2. Install the packages required by the m2tstoavi script.

Grab all the dependent packages, with this command:

sudo apt-get install mplayer ffmpeg a52dec mencoder x264 faad faac libfaad2-0 libfaad2-dev subversion csh build-essential

3. Download

Obtain the m2tstoavi script from here. Or use wget to download it from command-line.

wget http://www.olmosconsulting.com/m2ts.tar.gz

Untar the file, and cd into the directory

tar zxvf m2ts.tar.gz
cd m2ts

4. Configure

The download script needs to be configured with the current version of H.264/AVC reference software.

sudo gedit download

Modify the following line, to current version of #H.264/AVC

set version=15.1

5. Install

Now start the installation script

sudo ./install

6. Using the m2tstoavi script.

Here is how to use the default conversion method. This method has a large hard drive overhead and requires approximately 4 GB / min.

m2tstoavi sample.mts

7. Recommended Method

I recommend using the alternative script, m2tstoavi.fifo. This script uses named pipes, and that reduces the amount of free space required.

First change the file’s permissions to make it executable.

sudo chmod 744 m2tstoavi.fifo

If you don’t want to type “./” before the command, move the script into your path

sudo cp m2tstoavi.fifo /usr/local/bin

Wesley thanks for the great post and helping us get through this on Ubuntu! I have a question though if you have a second? My question is what does all this converting do to the quality of the video? And does Ubuntu just recognize and mount the camera that is hooked up via usb like an hdrux1! Any help would be much appreciated thanks.

I’m not sure if the quality is affected by the conversion process. I will look into this for you.

With my HDR-SR7, I have to press the “computer” option on the [USB SELECT] screen. Then Ubuntu mounts it automatically, and puts an icon on the desktop.

This works great for me. You don’t happen to know how I could easily de-interlace the video from my Canon HG10 do you? Thanks!

Cool, I just needed to modify the ffmpeg command to add -deinterlace and -aspect 16:9

I followed all the steps you described, but when I try to use the m2tstoavi.fifo command it gives me “command not found”. What could be the problem? The installation was completed successfully I think, or at least it didn’t give me any error messages.
thanks

Another problem: I’ve just finished converting a MTS file into avi but all images are distorted and colors are changed. If I watch directly from the camera, instead, the video is perfect. Should I use a program or a particular configuration?
thanks again

If it says “command not found”, I suspect the m2tstoavi.fifo is not in your path. If you goto the directory where m2tstoavi is installed, you should be able to type ./m2tstoavi.fifo and it should work.

For your second question. Do you have a NTSC or PAL video camera(HDR-SR7 or HDR SR7E). You can locate the model on the bottom of the camera.

Hi. Sorry, but i’m a linux newbie, I’m stuck at the part where you have to ./path/install but it says that i don’t have the permission to do so. Can anyone help me?

% ./m2ts/install
./m2ts/install: Permission denied.

If it is a permissions problem then change the permissions of the folder with:
% sudo chmod 777 m2ts

Be careful with 777 because it gives everyone on that machine access to the folder.
For more information on changing file permissions check this site. Linux Permissions

Then
% sudo ./m2ts/install

Hi! This script works fine :)
Thank you
The only problem is sound :(
I have no sound after converting
My camera is SR5E

New problem!
Sound is working now (after installing some codecs)
But resulting avi is strange and can be played only by mplayer :(
when I try to play it by Kaffeine or other movie-player, time-slider starts jumping back and forward
and sound starts to work asynchronously with picture :( (speed of picture is not constant)

In response to Roberto’s comment regarding the “command not found” message with the m2tstoavi.fifo command… I had the same problem. I seem to have fixed it my changing the permission on it to 744, and opening it with “./m2tstoavi.fifo ________.mts”. In other words, for me it seems that the command required a “./” prior to the text whereas the normal command did not. Hope this helps…

To all with the “command not found” problem: Just copy the m2tstoavi.fifo script into your /usr/local/bin folder, just like the other scripts:

sudo chmod 744 m2tstoavi.fifo
sudo cp m2tstoavi.fifo /usr/local/bin

The script is then in your path and you can omit the ./ before the command.

Thank you Peter for your insight into the “command not found” problem”. I have added the steps you have mentioned to the how to.

After installing I view the samplevideo.avi file and it is 2 seconds of black. Are there some codec’s I am missing?

Chris, after you used the install script, did the samplevideo automatically play on your screen?

What program did you use to view the video?

My setup is a headless linux box running Ubuntu 7.10 server. I have to pull the samplevideo off to view. I’ve been able to get the video to convert, but there is no audio when I copy the resulting AVI to a Windows XP box. Thanks for your help.

@Chris

My suggestion would be to try and view through VLC. By default the video is converted into mpeg4, and the audio is AC3, inside an AVI container.

Please let me know if this helps.

Greetings. Thanks for putting this together. I ran through the instructions and got the sample video converted at the end of the install but am having problems running the script using my files. When I try to execute the script I get:

/usr/local/bin/m2tstoavi.fifo: line 1: #!/bin/csh: No such file or directory
/usr/local/bin/m2tstoavi.fifo: line 11: syntax error near unexpected token `(’
/usr/local/bin/m2tstoavi.fifo: line 11: ` set files=($*)’

here’s the file itself:
#!/bin/csh

#The scripts and instructions in this package are free to use and
#redistribute AT YOUR OWN RISK!! Standard disclaimers apply.
#NO WARRANTY!

if ( $#argv == “0″ ) then
echo usage: $0 filename.m2ts …
exit
else
set files=($*)
endif

I do have a csh file in the bin folder (a link to executable actually), but I can’t create a folder due to that link being there.

If anyone has any suggestions I’d be much obliged.

Thanks!

Ok, finally got the script to run again by deleting the first line of script and retyping it but now I get the following problem:

Cannot open Annex B ByteStream file ‘bits0001.mpv’

Any suggestions?

Thanks!

@retlaw

I think I found the problem, please confirm. The problem was step 5 needs to be ran as root, with sudo.

Hi, when I try to run “m2tstoavi.fifo 00000.mts” in my video folder it says: “using: xporthdmv: Command not found.”
Both m2toavi and -fifo do the same. I’m using ubuntu 8.04 and commands should be installed properly. Am I missing this “xporthdmv” -part? Thx a lot!

@Lauri

I suspect that you are missing xporthdmv.

To verify if xportdmv is installed, run this from command line

which xporthdmv

If xporthdmv is installed it will output something like this:

/usr/local/bin/xporthdmv

great nothing shows and after some searching i can not find how to rectify the situation

Hello. I’m having a tough time getting this to work properly. I’m using Ubuntu 64 bit with the following error:

petah@desky:/media/SataTwo/Camcorder/BDMV/STREAM$ m2tstoavi.fifo *
using:
/usr/local/bin/xporthdmv
/usr/local/bin/ldecod
/usr/bin/ffmpeg
/usr/local/bin/m2tstoavi.fifo Starting.

xporthdmv -hn 00000.MTS 1 1 1
Unsupported Option: n
Cannot open video output file
mkfifo: cannot create fifo `/tmp/00000.yuv’: File exists
ldecod -i bits0001.mpv -o /tmp/00000.yuv
[1] 7107
ffmpeg -r 29.97 -s 1440×1080 -vcodec mpeg4 -sameq -i /tmp/00000.yuv -acodec copy -i /tmp/00000.ac3 -b 15000k 00000.avi
FFmpeg version SVN-rUNKNOWN, Copyright (c) 2000-2007 Fabrice Bellard, et al.
configuration: –enable-gpl –enable-pp –enable-swscaler –enable-pthreads –enable-libvorbis –enable-libtheora –enable-libogg –enable-libgsm –enable-dc1394 –disable-debug –enable-shared –prefix=/usr
libavutil version: 1d.49.3.0
libavcodec version: 1d.51.38.0
libavformat version: 1d.51.10.0
built on Mar 12 2008 15:36:03, gcc: 4.2.3 (Ubuntu 4.2.3-2ubuntu4)
—————————– JM 14.0 (FRExt) —————————–
Decoder config file : (null)
————————————————————————–
Input H.264 bitstream : bits0001.mpv
Output decoded YUV : /tmp/00000.yuv
Output status file : log.dec
Input reference file : test_rec.yuv does not exist
SNR values are not available
————————————————————————–
POC must = frame# or field# for SNRs to be correct
————————————————————————–
Frame POC Pic# QP SnrY SnrU SnrV Y:U:V Time(ms)
————————————————————————–
Cannot open Annex B ByteStream file ‘bits0001.mpv’

If anyone has any suggestions I’d be extremely grateful

@Petah

Thanks for posting all the required details.

Try running Step 5 as root, that should fix the problem

Wes,

Thank you very much! I got it to run.

I reinstalled and followed the tutorial exactly and as long as I execute the m2tstoavi.fifo from the m2ts folder that I unzipped it works great. If I change into the folder the files are in I still get the above error, which is still a huge help. Now I just have to figure out how to change the output folder since the videos are on a separate hard drive, and the drive with the m2ts folder (aka the location that runs the file properly is on aa smaller drive. I guess I can whole swap the folder to my larger drive.

Thanks again for the help. You’ve let me move to my new build computer free from the monolithic beast of vista!

Wes,

Disregard my problem running it in the media location folder. Looks like my second disk is a read only environment. Time for some google work.

Thanks again!

Petah

I am glad to here that you were able to free yourself from the monolithic beast of vista.

Let me know if you need a hand getting your second drive mounted with read/write.

Wes,

Appreciate it. All good to go. Had a dual install with OS X so I had to disable Journaling which in turn allowed me more than read permission on the disk. I’m currently chewing through the conversions. Now I just have to pick which editing software I’m going to use. What’s your recommendation?

Thanks!

Wes,

I, too, get the “xporthdmv: Command not found.” error when I try to invoke m2tstoavi script. I’m running Hardy with the latest patches.

I did notice that the compiler script threw the following errors when I ran it. I executed it as su:

Run the compile script to compile the software.
The ./configure script has ended.

Starting ./compile script.
xport.c:5:19: error: stdio.h: No such file or directory
xport.c:6:20: error: stdlib.h: No such file or directory
xport.c:7:20: error: string.h: No such file or directory
xport.c:29: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token
xport.c: In function 'main':
...

cp: cannot stat `bin/ldecod.exe’: No such file or directory
chmod: cannot access `../xporthdmv’: No such file or directory
chmod: cannot access `../ldecod’: No such file or directory

Thanks!
Fraize

@Fraize

It seems that your Ubuntu does not have the ability to compile programs. In order to compile anything in Ubuntu, you need a package called build-essential.

sudo apt-get install build-essential

Hi Wes,

thanks for your tutorial. Unfortunately I’m not able to install it.
Already step 2 fails on my machine (UbuntuStudio 8.04).

> ’sudo apt-get install mplayer ffmpeg a52dec mencoder x264 faad faac libfaad2-0 libfaad2-dev subversion csh’

leads to the first error:

Paket a52dec ist ein virtuelles Paket, das bereitgestellt wird von:
liba52-0.7.4-dev 0.7.4-11ubuntu1
Sie sollten eines explizit zum Installieren auswählen.
E: Paket a52dec hat keinen Installationskandidaten

Description is unfortunately in german. It says said a52dec does not posses a installation candidate !?

If I replaced ‘a52dec’ by ‘liba52-0.7.4-dev’ it leads to the next error:

‘Die folgenden Pakete haben nichterfüllte Abhängigkeiten:
libfaad2-dev: Hängt ab: libfaad2-0 (= 2.0.0+cvs20040908+mp4v2+bmp-0ubuntu5) aber 2.6.1-2 soll installiert werden
E: Kaputte Pakete’

It says that ‘libfaad2-dev: depends libfaad2-0 (= 2.0.0+cvs20040908+mp4v2+bmp-0ubuntu5)’,
but 2.6.1-2 is atempted to be installed –> Error: corrupted packes!?

Any ideas or suggestions?

Thanks in advance for your efforts.

Bye
Hergerger

I had trouble with the frame resolution that this script assumes. It’s assuming 1440×1080, and my camera can shoot @1920×1080. If you try to process a 1920 file with this script, you’ll get “flipping” (not sure if that’s the right term) where it looks as if you had turned the old-school “vert” knob on your TV too far one way or the other.

The fix is to edit the m2tstoavi(.fifo) script. Replace 1440 with 1920, and the video will turn out fine.

Of course, the files will only have sound in mplayer, the sound, when you do have it, is out of sync by a few seconds, and the output file won’t import into Cinelerra. Time to do some more googling…

From Convert MTS/M2TS(AVCHD) to AVI

I had to make the same change to my script. I recorded video on a Panasonic SD9 and after making the change from "1440" to "1920", the picture showed up like it was suppose to. It does look good.

I had trouble with the frame resolution that this script assumes. It’s assuming 1440×1080, and my camera can shoot @1920×1080. If you try to process a 1920 file with this script, you’ll get “flipping” (not sure if that’s the right term) where it looks as if you had turned the old-school “vert” knob on your TV too far one way or the other.

The fix is to edit the m2tstoavi(.fifo) script. Replace 1440 with 1920, and the video will turn out fine.

Of course, the files will only have sound in mplayer, the sound, when you do have it, is out of sync by a few seconds, and the output file won’t import into Cinelerra. Time to do some more googling…

From Convert MTS/M2TS(AVCHD) to AVI

hey wes. great work :)

did you find out anything about the lossyness of this procedure.

@paul

I'm sorry, I haven't heard the term "lossyness" before. I'm not sure if your referring to loss in sound or video quality.

Here is an example of the video/audio bitrates of a HD MTS video, and after the transcoded bitrates.

Original MTS File

Video bitrate: 9573 kb/s
Audio:48000 Hz, 5:1, 448 kb/s

Transcoded to AVI

Video bitrate: 461 kb/s
Audio 48000 Hz, 5:1, 448 kb/s

As you can see, there is quite a loss in the video bitrate. The audio is not affected. Hope this helps

Why is it that I can never get the ./install command to work? Here is the output:

root@ryan-laptop:/home/ryan/m2ts# ./install
bash: ./install: /bin/csh: bad interpreter: No such file or directory

Can anyone help?

The problem is the csh shell is not installed on your system.

Install csh with this command:

sudo apt-get install csh

Small correction - Step 4 should be:
sudo gedit download

Thank you for helping improve this article.

one of your first responses in this thread reads "I’m not sure if the quality is affected by the conversion process. I will look into this for you"

i should have put quotes around my 'lossyness'. converting file formats is often lossy i.e. some detail/quality is lost. i was just wondering how lossy this is. did you ever find anything out?

kbps figures dont mean much to me i'm afraid. can you *see* any difference?

I can tell you that the audio quality is unaffected(no loss). The video looks perfectly fine on my lcd monitor or standard television.

However I do believe the video quality would be noticeable on a HD televison. I will try to confirm this in the new future.

I apologize for the delay .

Thanks for the fine set of sommand scripts; At first glance, everything seems to work. Unfortunately, I encounter 2 problems:

* Playing the *avi in mplayer works fine, howeveer, in VLC I have no sound!
* When importing the *avi into cinelerra, ist pretends to be audio only, no video!

I tried several container formats and/or seperate files juggling with ffmpeg, but I can't find any container format holding both video and audio!!!

Any hints or suggestions are highly welcome!

You are correct, the default ffmpeg parameters used by m2tstoavi don't create files that can be imported into cinelerra.

These parameters have been reported to create files that can be imported into Cinelerra.

ffmpeg -i filename.mts -acodec libfaac -ab 256k -ac 2 -vcodec mpeg4 -sameq -aspect 16:9 -b 15000k -copyts output_filename.mov

audio codec = libfaac
video codec = mpeg4
container = mov

Please let me know if that helps.

Does not work for me;

:~/compilations/m2ts$ ffmpeg -i samplevideo.m2ts -acodec libfaac -ab 256k -ac 2 -vcodec mpeg4 -sameq -aspect 16:9 -b 15000k -copyts output_filename.mov
FFmpeg version SVN-rUNKNOWN, Copyright (c) 2000-2007 Fabrice Bellard, et al.
configuration: --enable-gpl --enable-pp --enable-swscaler --enable-pthreads --enable-libvorbis --enable-libtheora --enable-libogg --enable-libgsm --enable-dc1394 --disable-debug --enable-libmp3lame --enable-libfaadbin --enable-libfaad --enable-libfaac --enable-xvid --enable-x264 --enable-liba52 --enable-amr_nb --enable-amr_wb --enable-shared --prefix=/usr
libavutil version: 1d.49.3.0
libavcodec version: 1d.51.38.0
libavformat version: 1d.51.10.0
built on Apr 3 2008 18:39:35, gcc: 4.2.3 (Ubuntu 4.2.3-2ubuntu7)
[h264 @ 0x7fa34c89f8d0]PAFF interlacing is not implemented
[h264 @ 0x7fa34c89f8d0]concealing 3060 DC, 3060 AC, 3060 MV errors
Input #0, mpegts, from 'samplevideo.m2ts':
Duration: 00:00:02.4, start: 1.100100, bitrate: 16367 kb/s
Stream #0.0[0x1011]: Video: h264, yuv420p, 1440x1080, 29.97 fps(r)
Stream #0.1[0x1100]: Audio: ac3, 48000 Hz, 5:1, 448 kb/s
Unknown codec 'libfaac'

I have libfaac0 installed. When I replace libfaac with libfaac0 I get the same output.

Try substituting libfaac with libmp3lame

same result Unknown codec 'libmp3lame'

I suspect the problem is that you are using the repository verision of ffmpeg "FFmpeg version SVN-rUNKNOWN". You might need the latest svn version of svn ffmpeg.

I wrote this article, that shows you how to compile ffmpeg

Bingo ! That is it Wesley. I compiled ffmpeg with the instructions of your article and converted a samplevideo correctly. Thanks a lot for the support !

Good morning and thank you for your help converting .m2ts to.avi. It helped me.:-)
I would like to ask you a question:
Why do you use "Sudo" to untar?

With this command: sudo tar zxvf m2ts.tar.gz, is it possible to make it without using sudo. Because with sudo, a locked file is got. What I think strange.
Thank you for your answer.

Hi Patrice

Thank you for your feedback.

This tutorial documents the method I use to install m2tstoavi. When I
install m2tstoavi, I usually download it into /usr/local/bin. Which as
you know, is only writable by root.

So that is the reason, why I use "sudo" to untar, it needs root
permissions to untar in that folder.

However you raise a good point, if users download m2tstoavi to their
own personal directory. Then the sudo would not be necessary.

I will update my tutorial.

wesley, I can't get the install script to work. The output I get is below :-


checking dependencies

compiling object file "obj/annexb.o" ...
compiling object file "obj/biaridecod.o" ...
compiling object file "obj/block.o" ...
compiling object file "obj/cabac.o" ...
compiling object file "obj/context_ini.o" ...
compiling object file "obj/erc_api.o" ...
compiling object file "obj/erc_do_i.o" ...
compiling object file "obj/erc_do_p.o" ...
compiling object file "obj/errorconcealment.o" ...
compiling object file "obj/filehandle.o" ...
compiling object file "obj/fmo.o" ...
compiling object file "obj/header.o" ...
compiling object file "obj/image.o" ...
compiling object file "obj/ldecod.o" ...
compiling object file "obj/leaky_bucket.o" ...
compiling object file "obj/loopFilter.o" ...
compiling object file "obj/macroblock.o" ...
compiling object file "obj/mb_access.o" ...
compiling object file "obj/mbuffer.o" ...
compiling object file "obj/mc_prediction.o" ...
compiling object file "obj/memalloc.o" ...
compiling object file "obj/nal.o" ...
compiling object file "obj/nal_part.o" ...
compiling object file "obj/nalu.o" ...
compiling object file "obj/nalucommon.o" ...
compiling object file "obj/output.o" ...
compiling object file "obj/parset.o" ...
compiling object file "obj/parsetcommon.o" ...
compiling object file "obj/quant.o" ...
In file included from src/quant.c:24:
inc/quant.h:32: error: conflicting types for ‘qmatrix’
inc/global.h:76: error: previous declaration of ‘qmatrix’ was here
src/quant.c:226: error: conflicting types for ‘qmatrix’
inc/global.h:76: error: previous declaration of ‘qmatrix’ was here
src/quant.c: In function ‘init_qp_process’:
src/quant.c:242: warning: implicit declaration of function ‘malloc’
src/quant.c:242: warning: incompatible implicit declaration of built-in function ‘malloc’
src/quant.c:245: warning: incompatible implicit declaration of built-in function ‘malloc’
make: *** [obj/quant.o] Error 1
cp: cannot stat `bin/ldecod.exe': No such file or directory
chmod: cannot access `../xporthdmv': No such file or directory
chmod: cannot access `../ldecod': No such file or directory

Run the configure2 script to configure ffmpeg and mplayer

The ./compile script has ended.
Installing xporthdmv into /usr/local
Installing hdrsr1 into /usr/local
Installing m2tstoavi into /usr/local
Doing make install for x264-snapshot-20080629-2245
Makefile:3: config.mak: No such file or directory
./configure
No suitable assembler found. Install 'yasm' to get MMX/SSE optimized code.
If you really want to compile without asm, configure with --disable-asm.
make: *** [config.mak] Error 1
Doing make install for a52dec-0.7.4
Making install in autotools
make[1]: Entering directory `/home/oliver/avchd/src/a52dec-0.7.4/autotools'
make[2]: Entering directory `/home/oliver/avchd/src/a52dec-0.7.4/autotools'
make[2]: Nothing to be done for `install-exec-am'.
make[2]: Nothing to be done for `install-data-am'.
make[2]: Leaving directory `/home/oliver/avchd/src/a52dec-0.7.4/autotools'
make[1]: Leaving directory `/home/oliver/avchd/src/a52dec-0.7.4/autotools'
Making install in include
make[1]: Entering directory `/home/oliver/avchd/src/a52dec-0.7.4/include'
make[2]: Entering directory `/home/oliver/avchd/src/a52dec-0.7.4/include'
make[2]: Nothing to be done for `install-exec-am'.
/bin/bash ../autotools/mkinstalldirs /usr/local/include/a52dec
/usr/bin/install -c -m 644 a52.h /usr/local/include/a52dec/a52.h
/usr/bin/install -c -m 644 attributes.h /usr/local/include/a52dec/attributes.h
/usr/bin/install -c -m 644 audio_out.h /usr/local/include/a52dec/audio_out.h
/usr/bin/install -c -m 644 mm_accel.h /usr/local/include/a52dec/mm_accel.h
make[2]: Leaving directory `/home/oliver/avchd/src/a52dec-0.7.4/include'
make[1]: Leaving directory `/home/oliver/avchd/src/a52dec-0.7.4/include'
Making install in doc
make[1]: Entering directory `/home/oliver/avchd/src/a52dec-0.7.4/doc'
make[2]: Entering directory `/home/oliver/avchd/src/a52dec-0.7.4/doc'
make[2]: Nothing to be done for `install-exec-am'.
make[2]: Nothing to be done for `install-data-am'.
make[2]: Leaving directory `/home/oliver/avchd/src/a52dec-0.7.4/doc'
make[1]: Leaving directory `/home/oliver/avchd/src/a52dec-0.7.4/doc'
Making install in liba52
make[1]: Entering directory `/home/oliver/avchd/src/a52dec-0.7.4/liba52'
make[2]: Entering directory `/home/oliver/avchd/src/a52dec-0.7.4/liba52'
/bin/bash ../autotools/mkinstalldirs /usr/local/lib
/bin/bash ../libtool --mode=install /usr/bin/install -c liba52.la /usr/local/lib/liba52.la
/usr/bin/install -c .libs/liba52.lai /usr/local/lib/liba52.la
/usr/bin/install -c .libs/liba52.a /usr/local/lib/liba52.a
ranlib /usr/local/lib/liba52.a
chmod 644 /usr/local/lib/liba52.a
PATH="$PATH:/sbin" ldconfig -n /usr/local/lib
----------------------------------------------------------------------
Libraries have been installed in:
/usr/local/lib

If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the `-LLIBDIR'
flag during linking and do at least one of the following:
- add LIBDIR to the `LD_LIBRARY_PATH' environment variable
during execution
- add LIBDIR to the `LD_RUN_PATH' environment variable
during linking
- use the `-Wl,--rpath -Wl,LIBDIR' linker flag
- have your system administrator add LIBDIR to `/etc/ld.so.conf'

See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.
----------------------------------------------------------------------
make[2]: Nothing to be done for `install-data-am'.
make[2]: Leaving directory `/home/oliver/avchd/src/a52dec-0.7.4/liba52'
make[1]: Leaving directory `/home/oliver/avchd/src/a52dec-0.7.4/liba52'
Making install in libao
make[1]: Entering directory `/home/oliver/avchd/src/a52dec-0.7.4/libao'
make[2]: Entering directory `/home/oliver/avchd/src/a52dec-0.7.4/libao'
make[2]: Nothing to be done for `install-exec-am'.
make[2]: Nothing to be done for `install-data-am'.
make[2]: Leaving directory `/home/oliver/avchd/src/a52dec-0.7.4/libao'
make[1]: Leaving directory `/home/oliver/avchd/src/a52dec-0.7.4/libao'
Making install in src
make[1]: Entering directory `/home/oliver/avchd/src/a52dec-0.7.4/src'
make[2]: Entering directory `/home/oliver/avchd/src/a52dec-0.7.4/src'
/bin/bash ../autotools/mkinstalldirs /usr/local/bin
/bin/bash ../libtool --mode=install /usr/bin/install -c a52dec /usr/local/bin/a52dec
/usr/bin/install -c a52dec /usr/local/bin/a52dec
/bin/bash ../libtool --mode=install /usr/bin/install -c extract_a52 /usr/local/bin/extract_a52
/usr/bin/install -c extract_a52 /usr/local/bin/extract_a52
make install-man1
make[3]: Entering directory `/home/oliver/avchd/src/a52dec-0.7.4/src'
/bin/bash ../autotools/mkinstalldirs /usr/local/man/man1
/usr/bin/install -c -m 644 ./a52dec.1 /usr/local/man/man1/a52dec.1
/usr/bin/install -c -m 644 ./extract_a52.1 /usr/local/man/man1/extract_a52.1
make[3]: Leaving directory `/home/oliver/avchd/src/a52dec-0.7.4/src'
make[2]: Leaving directory `/home/oliver/avchd/src/a52dec-0.7.4/src'
make[1]: Leaving directory `/home/oliver/avchd/src/a52dec-0.7.4/src'
Making install in vc++
make[1]: Entering directory `/home/oliver/avchd/src/a52dec-0.7.4/vc++'
make[2]: Entering directory `/home/oliver/avchd/src/a52dec-0.7.4/vc++'
make[2]: Nothing to be done for `install-exec-am'.
make[2]: Nothing to be done for `install-data-am'.
make[2]: Leaving directory `/home/oliver/avchd/src/a52dec-0.7.4/vc++'
make[1]: Leaving directory `/home/oliver/avchd/src/a52dec-0.7.4/vc++'
Making install in test
make[1]: Entering directory `/home/oliver/avchd/src/a52dec-0.7.4/test'
make[2]: Entering directory `/home/oliver/avchd/src/a52dec-0.7.4/test'
make[2]: Nothing to be done for `install-exec-am'.
make[2]: Nothing to be done for `install-data-am'.
make[2]: Leaving directory `/home/oliver/avchd/src/a52dec-0.7.4/test'
make[1]: Leaving directory `/home/oliver/avchd/src/a52dec-0.7.4/test'
make[1]: Entering directory `/home/oliver/avchd/src/a52dec-0.7.4'
make[2]: Entering directory `/home/oliver/avchd/src/a52dec-0.7.4'
make[2]: Nothing to be done for `install-exec-am'.
make[2]: Nothing to be done for `install-data-am'.
make[2]: Leaving directory `/home/oliver/avchd/src/a52dec-0.7.4'
make[1]: Leaving directory `/home/oliver/avchd/src/a52dec-0.7.4'
Starting ./configure2 script.

Run the compile2 script to compile ffmpeg and mplayer.

The ./configure2 script has ended.
Starting ./compile2 script.

Run the installasroot script as root to install the software in /usr/local/bin

The ./compile2 script has ended.
using:
./xporthdmv
ldecod: Command not found.
MPlayer 1.0rc2-4.2.3 (C) 2000-2007 MPlayer Team
CPU: Intel(R) Pentium(R) 4 CPU 2.66GHz (Family: 15, Model: 2, Stepping: 7)
CPUflags: MMX: 1 MMX2: 1 3DNow: 0 3DNow2: 0 SSE: 1 SSE2: 1
Compiled with runtime CPU detection.
mplayer: could not connect to socket
mplayer: No such file or directory
Failed to open LIRC support. You will not be able to use your remote control.

Apologies for the long post, but I really don't know which bit is relevant

Oliver

Thanks for the very helpful tutorial. I got this to work (to the point of the sample video at least) in Kubuntu 8.04.

Just in case anyone else has this - I tripped over a small problem getting it working. The x264 section of the configure script complained that I didn't have a suitable assembler, and suggested yasm. I tried installing yasm, but the script then complained that the version wasn't recent enough. It suggested nasm, which I put in - the error went away.

I also discovered that it was necessary to delete everything and start again from the extraction from the archive after messing up step 5 by failing to sudo - i.e. simply repeating the step but using sudo didn't cure the problem.

Also, do you maybe mean 755 instead of 744 in step 7?

Anyway, thanks again for the help.

Im having trouble with the ./install script.
It doesn't appear to compile ldecod correctly.

Run the compile script to compile the software.

The ./configure script has ended.
Starting ./compile script.

checking dependencies

compiling object file "obj/annexb.o" ...
compiling object file "obj/biaridecod.o" ...
compiling object file "obj/block.o" ...
compiling object file "obj/cabac.o" ...
compiling object file "obj/context_ini.o" ...
compiling object file "obj/erc_api.o" ...
compiling object file "obj/erc_do_i.o" ...
compiling object file "obj/erc_do_p.o" ...
compiling object file "obj/errorconcealment.o" ...
compiling object file "obj/filehandle.o" ...
compiling object file "obj/fmo.o" ...
compiling object file "obj/header.o" ...
compiling object file "obj/image.o" ...
compiling object file "obj/ldecod.o" ...
compiling object file "obj/leaky_bucket.o" ...
compiling object file "obj/loopFilter.o" ...
compiling object file "obj/macroblock.o" ...
compiling object file "obj/mb_access.o" ...
compiling object file "obj/mbuffer.o" ...
compiling object file "obj/mc_prediction.o" ...
compiling object file "obj/memalloc.o" ...
compiling object file "obj/nal.o" ...
compiling object file "obj/nal_part.o" ...
compiling object file "obj/nalu.o" ...
compiling object file "obj/nalucommon.o" ...
compiling object file "obj/output.o" ...
compiling object file "obj/parset.o" ...
compiling object file "obj/parsetcommon.o" ...
compiling object file "obj/rtp.o" ...
compiling object file "obj/sei.o" ...
compiling object file "obj/transform8x8.o" ...
compiling object file "obj/vlc.o" ...

creating binary "../bin/ldecod.exe"
... done

update tag table
/bin/sh: ctags: command not found
make: *** [tags] Error 127
cp: cannot stat `bin/ldecod.exe': No such file or directory
chmod: cannot access `../xporthdmv': No such file or directory
chmod: cannot access `../ldecod': No such file or directory

The source of this problem lies with nasm

If you see this early in the output
-----
Run the configure script to configure the downloaded software

The ./download script has ended.
Starting ./configure script.
/bin/sed
Removing DOS LF chars...
Done.
x264
No suitable assembler found. Install 'yasm' to get MMX/SSE optimized code.
If you really want to compile without asm, configure with --disable-asm.
x264 done
----

Then you need to install nasm using synaptic package manager

thank you for the work, but it still seems to have some problem with the "m2ts" file largger than 2GB.

On my Ubuntu 7.10 , the csh and xporthdmv are both unable to support that.

In csh, the condition testing statement " -f my.m2ts" returns false,

and the xporthdmv returns "Cannot open bitstream file "

I have the following error message:

using:
/usr/local/bin/xporthdmv
ldecod: Command not found.

What is ldecod and how can I get it? Thank you for answer.

I have the following error message:

using:
/usr/local/bin/xporthdmv
ldecod: Command not found.

What is ldecod and how can I get it? Thank you for answer.

I noticed that encoding a mts file to avi with fifo method takes forever.

What is the average time for conversion of a say 100 MB mts file?

- currently encoding 424mb mts file, its going and going.....

shoot me email back! jbspillman@gmail.com

Hello. I have the following message:

using:
/usr/local/bin/xporthdmv
ldecod: Command not found.

What is wrong?

This not works with hardy for me.

a52dec and libfaad2-dev are not in the repository (universe and multiverse is enabled). Instead a52dec I installed liba52-0.7.4-dev (libfaad2-dev I skipped).

After running the install script I get the following message running "./m2tstoavi samplevideo.m2ts":
using:
./xporthdmv
ldecod: Command not found.

Anyone installed this in hardy and has an idea what I did wrong?

For MTS's from Sony, just renaming the file from .mts to .mpg -- both mplayer and ffplay will then play it. Dunno if sound works, but hey, it'll save you a few hours!

Thanks.
But it is not easy.
here is another tutorial:
how to Convert MTS/M2TS(AVCHD) to AVI on mac.

Hey Wes,
got it working, thanks. (Errors with 'command not found' were solved: it was because I didn't type in proper version from link and just typed in 14.0). Using Panasonic HDC-SD9.

However, same problem as person up above, i.e. sound is out of sinc. In fact, I don't think its out of sinc, I think the video is FAST because with longer videos the sound increases its lag behind the video (and if sound was too slow, it would sound different). Any ideas for solutions?

PS I used
sudo apt-get install libfaad-dev
as I couldn't get libfaad2 and it worked fine (except for sound sync)

For people having problems with ldecod not be being found. sudo apt-get install ctags

i have also tried to install this on hardy and have the same problem as anonymous. can anybody shed some light on this?

Almost there...

Audio works, but I get no video.

[code]
[mpeg4 @ 0xacd380]header damaged
Error while decoding stream #0.0
[mpeg4 @ 0xacd380]header damaged
Error while decoding stream #0.0
[mpeg4 @ 0xacd380]header damaged
Error while decoding stream #0.0
[mpeg4 @ 0xacd380]header damaged
Error while decoding stream #0.0
01133( b ) 2266 246 20 4:2:0 401
01137( P ) 2274 246 19 4:2:0 227
01135( B ) 2270 247 21 4:2:0 276
read_new_slice: Found NALU_TYPE_FILL, len 1
Skipping these filling bits, proceeding w/ next NALU
[mpeg4 @ 0xacd380]header damaged
Error while decoding stream #0.0
[mpeg4 @ 0xacd380]header damaged
Error while decoding stream #0.0
[mpeg4 @ 0xacd380]header damaged
Error while decoding stream #0.0
[mpeg4 @ 0xacd380]header damaged
Error while decoding stream #0.0
01136( b ) 2272 248 21 4:2:0 378
-------------------- Average SNR all frames ------------------------------
SNR Y(dB) : 0.00
SNR U(dB) : 0.00
SNR V(dB) : 0.00
Total decoding time : 395.985 sec (2.879 fps)
--------------------------------------------------------------------------
Exit JM 15 (FRExt) decoder, ver 15.0
[mpeg4 @ 0xacd380]header damaged
Error while decoding stream #0.0
[mpeg4 @ 0xacd380]header damaged
Error while decoding stream #0.0
frame= 0 fps= 0 q=0.0 Lsize= 2182kB time=45.63 bitrate= 391.7kbits/s
video:0kB audio:2139kB global headers:0kB muxing overhead 2.014668%
[1] + Done ldecod -i bits0001.mpv -o /tmp/00001.yuv
/usr/local/bin/m2tstoavi.fifo complete.
[/code]

What could wrong?

I get no video, but sound is working.

00053( b )      106    38    16                             4:2:0     376
00057( P )      114    38    14                             4:2:0     291
00055( B )      110    39    18                             4:2:0     245
read_new_slice: Found NALU_TYPE_FILL, len 1
Skipping these filling bits, proceeding w/ next NALU
[mpeg4 @ 0x717380]header damaged
Error while decoding stream #0.0
[mpeg4 @ 0x717380]header damaged
Error while decoding stream #0.0
[mpeg4 @ 0x717380]header damaged
Error while decoding stream #0.0
[mpeg4 @ 0x717380]header damaged
Error while decoding stream #0.0
00056( b )      112    40    16                             4:2:0     358
-------------------- Average SNR all frames ------------------------------
SNR Y(dB)           :  0.00
SNR U(dB)           :  0.00
SNR V(dB)           :  0.00
Total decoding time : 17.677 sec (3.394 fps)
--------------------------------------------------------------------------
Exit JM 15 (FRExt) decoder, ver 15.0
[mpeg4 @ 0x717380]header damaged
Error while decoding stream #0.0
[mpeg4 @ 0x717380]header damaged
Error while decoding stream #0.0
frame=    0 fps=  0 q=0.0 Lsize=     125kB time=2.43 bitrate= 422.6kbits/s   
video:0kB audio:114kB global headers:0kB muxing overhead 10.046601%
/usr/local/bin/m2tstoavi.fifo complete.

Whats wrong?

Post new comment

The content of this field is kept private and will not be shown publicly.
Array

More information about formatting options

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
Image CAPTCHA
copy the characters (respecting upper/lower case) from the image.