AVS › AVS Forum › Other Areas of Interest › Camcorders › AVCHD .m2ts conversion for Linux
New Posts  All Forums:Forum Nav:

AVCHD .m2ts conversion for Linux - Page 2

post #31 of 176
Quote:
Originally Posted by dwrowley View Post

Does anyone have any pre-compiled intel binaries for xport, ldecod, etc.?

Thanks,
David

David,
Well, yes. Anyone who has followed the instructions has intel binaries for the programs. The big problem is that most of these programs by default use dynamic library linking, and if your libraries are in slightly different places, then you will not be able to use someone else's binaries. Eventually I may build and distribute binaries (if the various packages' licenses allow it). That also requires time that I do not have right now. I did provide my ffmpeg binary to someone to test, but they never told me if it worked or not. Very frustrating.

If you put in a little effort, you can compile the binaries yourself. Alex and I already put in the toughest work in figuring out how to get the ball rolling. And, by building the software yourself, you will better understand how to build other free software too.
post #32 of 176
An update on my AVCHD to MacOS / Quicktime conversion goal.

Well I was able to get xport compiled and running, and then ldecod (I originally tried JM 12.2 - March 13, 2007 - but got bus errors, so I backed out to 12.1 - worked fine). (Axel's and Jeffrey's documentation was great)

For ffmpeg, when compiling the x264 library, the configure script was a bit screwed up for macs - looking for yasm instead of nasm - but I just grabbed/compiled/installed yasm and all was well.

Everything else (lame, etc.) was straightforward.

I got the mkfifo version of the script running easily (I had to apply the same '-ac 2' fix to map 5.1 to stereo) - and am now happily (though SLOWLY!) transcoding AVCHD .MTS files to 20mbps mpeg4 quicktime files which import nicely into iMovieHD. This makes my new Panasonic HDC-SD3 camcorder FAR more useful to me (and the quality of the video is excellent - full 1920x1080i - and it records to 4gb+ SD cards (SDHC actually)) I now have a complete MacOS only workflow - no more having to run Nero under Windows/Parallels!

It's amazing how many people's efforts went in to this incredible open source environment - all very much appreciated.

Now if we can only improve ldecod performance :-)

Thanks again,
Cheers,
David
post #33 of 176
Quote:
Originally Posted by dwrowley View Post

It's amazing how many people's efforts went in to this incredible open source environment - all very much appreciated.

I am glad things are working for you. Yes, while Axel was the instigator of this madness, and while I continued the fun, the community has helped a lot with debugging and useful advice.
post #34 of 176
That's excellent news, 0ctane!

Do you know if anyone is working on a higher-performance ldecod?

It would also be great to have AVCHD/.m2ts support in some kind of player (mplayer, vlc, etc.) - right now the best alternative I've found on the mac is to run Elecard's player under Parallels...

Looks like things are starting to come together for the AVCHD format! (I noticed Pinnacle sent out an announce for Studio 11 that supports AVCHD -- and while I don't use Pinnacle, it's good to see further support announced).

David
post #35 of 176
I don't have to pretend to be a dumb beginning user...I AM ONE. I thought I was purchasing something more than a PAPER WEIGHT to use with my MAC...so far it is the most expensive paper weight ever!

I have the HDC-SD1PP...I have a MacBook Pro fully loaded and up to date running VMware Fusion (so I can move files - images and avchd to the MAC).

I have read everything in this thread...makes me hopeful, but still lost.

Is there something I can do once I have the AVCHD files on the MAC to convert them there or do I have to try and figure out how to make what you all mention above work under Fusion?

Finally...when Premier Pro for MAC comes out and they support AVCHD...how will that work...how will I get files from the camera to the computer?

Final "finally"...I spoke with Panasonic...they said there was NO WAY to use the camera as a webcam. Any of you know otherwise?

At this point I feel like I made a real mistake buying this...but the video looks so nice in bright and dark settings :-)!

Thanks, ---bill
post #36 of 176
Quote:
Originally Posted by dwrowley View Post

Do you know if anyone is working on a higher-performance ldecod?

I am just a hobbiest that has a little programming experience. As far as I know, the JM group are the only ones with ldecod (of course, someone might be calling it something else). Their website has information on the AVCHD specifications, and I know they are continuing to work on improving the code.
Quote:


It would also be great to have AVCHD/.m2ts support in some kind of player (mplayer, vlc, etc.) - right now the best alternative I've found on the mac is to run Elecard's player under Parallels...

Not much of an alternative, especially if you have 1GB RAM or less. Yes, it would be nice to have AVCHD playback support in a Mac program. Go ahead and write it. I am looking into adding AVCHD support to ffmpeg which would save a step (but in reality it would just be bundling ldecod into ffmpeg). As I have little-to-no AV experience, this may be a delusion, and it might take a few years. Anyone feel like helping my R&D expenses?
Quote:
Originally Posted by bdaul View Post

I have the HDC-SD1PP...I have a MacBook Pro fully loaded and up to date running VMware Fusion (so I can move files - images and avchd to the MAC).

Well, you do not need VMware to access the files. Just plug the USB cable to you Mac. I forget which directory the files live in (DCIM maybe?), but you can just copy them over as if the camera was an external hard drive.
Quote:


Is there something I can do once I have the AVCHD files on the MAC to convert them there or do I have to try and figure out how to make what you all mention above work under Fusion?

Again, the "solution" we have devised does not require VMware or Windows. You will need to figure out how to use the "command line" on your Mac. Yes, the process is a little laborious. Eventually I hope to make a friendlier interface, so you may want to keep your paperweight a little longer.
Quote:


Finally...when Premier Pro for MAC comes out and they support AVCHD...how will that work...how will I get files from the camera to the computer?

Well, like I wrote above, you will probably just need to drag the files onto your computer and then edit them there. For a better answer, talk to the Premier Pro folks.
Quote:


Final "finally"...I spoke with Panasonic...they said there was NO WAY to use the camera as a webcam. Any of you know otherwise?

Not me.
post #37 of 176
After playing with setting for a while, I think I have come up with a better encoding scheme for OS X users. This is borrrowing on the pipe information presented earlier, and it includes an optimization for iMovieHD users.
Code:
% xporthdmv -nh samplevideo.m2ts 1 1 1
% mv bits0001.mpa /tmp/samplevideo.ac3
% mkfifo pipe.yuv
% ldecod -i bits0001.mpv -o pipe.yuv &
% ffmpeg -r 29.97 -s 1440x1080 -i pipe.yuv -i /tmp/samplevideo.ac3 -acodec pcm_s16le -ac 2 -vcodec mpeg4 -aspect 16:9 -b 15000k samplevideo.avi
% rm pipe.yuv /tmp/samplevideo.ac3
We are mapping the AC3 audio into 2 channel PCM which Quicktime is happy about. Yes, the aspect ratio looks funny. You still need to "Export..." from Quicktime Pro in the Apple Intermediate Codec as HDV1080i, and you need to choose Linear PCM Stereo for the audio. The resulting film should appear just fine (16:9) when you import it into iMovieHD. It worked for me, YMMV.
post #38 of 176
Thread Starter 
Quote:
Originally Posted by Axel Olmos View Post

For those of you having trouble with xport creating 0 byte audio files:

diff xport.c xport.c.orig
383,384c383,384
< if (pts_aligned != 0 ) {
< if (current_pts >= 0 ) {
---
> if (pts_aligned != 0xffffffffffffffff) {
> if (current_pts >= pts_aligned) {

Change lines 383,384 as indicated above.

That change makes it work on my machine. (It probably has unintended consequences for other cases I don't understand.)

I updated the .tar.gz file to include this change as well as 0ctane's new readme.
post #39 of 176
My pipeline is working well with the JM 12.1 ldecod I compiled, but the performance is SLOW! Apparently 12.2 (release March 13, 2007) has some good performance improvements, but it hangs when I run it on my test files...

Anyone have any luck with using JM 12.2 (on MacOS)?

Thanks,
David
post #40 of 176
Yes, I am using JM 12.2 right now on OS X.
post #41 of 176
And no problems? Did you make any mods in the src, set special compiler options, or anything else?

Could you perhaps PM me the file? (ldecod is relatively standalone, right?)

Thanks,
David
post #42 of 176
general question...

Can I do any significant damage is I say mis-type some of the script items in the command line?

outside of the obvious dl *.*

thanks...almost ready to try the wizardry you all have created.

--bill
post #43 of 176
Hi,
I am about to buy a camcorder, and like the Panasonic SD1, howeverneed to know can i down load AVCHD onto my Mac and then edit it from there. I am not very technically savy and i have tried to follow the thread, but it looks like i am going to have trouble doing that. Please advise.

Also, for all SD1 owners, what is the quality of the video like. I read that there is still a "trailing" issue with all AVCHD type recording vs. traditional tape. Is there any thing to be said for that.

Thanks for you comments.
post #44 of 176
If you follow the instructions in Axel's download (or from my site) you can edit AVCHD content on your Mac (free version). Or, you can wait 1 week. For those of you who are not programming savvy, I will be releasing prebuilt & bundled software to do the conversion to HDV1080i (which can be edited in iMovieHD and FC, but you will have to pay a few bucks). Stay tuned.
post #45 of 176
Quote:
Originally Posted by 0ctane View Post

If you follow the instructions in Axel's download (or from my site) you can edit AVCHD content on your Mac (free version). Or, you can wait 1 week. For those of you who are not programming savvy, I will be releasing prebuilt & bundled software to do the conversion to HDV1080i (which can be edited in iMovieHD and FC, but you will have to pay a few bucks). Stay tuned.

I hope it isn't out of the range of us working POOR, but either way...thanks to all here that have strived to allow the rest of us to use our cameras with a MAC! Hip, Hip Horray!

--bill

p.s. OCTANE, if you have a mailing list of those interested in your programming magic please ADD me.
post #46 of 176
thanks octane for your help. yes a pre-bundled version would be GREAT to have. let us know when your package is avaliable & reliable.

ta!!!
post #47 of 176
Quote:
Originally Posted by dwrowley View Post

Does anyone have any pre-compiled intel binaries for xport, ldecod, etc.?

Since this seems to be a common question (especially in e-mails), there is a new option. Voltaic brings the whole process together in one package. The output format is HDV1080i with the Apple Intermediate Codec. Therefore, the resulting movies are in the native format for iMovieHD and Final Cut. QuicktimePro is not necessary. Visit http://www.mac1080hd.com.

[edit]I don't have a e-mail list yet. I have a personal website . I am thinking of creating a developer blog, probably with a RSS feed. Unfortunately, I am not great with blogging software.
post #48 of 176
Thanks Octane and others...the software from Voltaic is WORTH it!

==bill
post #49 of 176
I recently bought a Sony HD camcorder the HDR5 HDD 40Gig one. I downloaded the scripts and all dependencies and am having a audio sync issue. I am using JM12.3 ldecod Not sure if that is the problem or not I guess I could try to find 12.2 but the installer did not retrieve it. any help would be greatly appreciated I can try about any thing can program a little and know my way around linux enough to be dangerous
post #50 of 176
snostorm,
Your problem is probably a regional one. NTSC vs PAL. Set your FPS to 25 if you are in a PAL region or 29.97 if in a NTSC region.
post #51 of 176
Here is my ffmpeg command I have also tried moving the -r option around but always get the same results I have also set it to 25 to match what it seems to think the video is but I bought he camcorder in the US so it should be NTSC, not sure why ffmpeg thinks the video is in PAL 25 fps

ffmpeg -r 29.97 -s 1440x1080 -i test_dec.yuv -i test.ac3 -vcodec mpeg4 -acodec copy -aspect 16:9 -b 15000k samplevideo.avi
FFmpeg version SVN-r8743, Copyright (c) 2000-2007 Fabrice Bellard, et al.
configuration: --prefix=/usr --libdir=/usr/lib --shlibdir=/usr/lib --mandir=/usr/share/man --enable-shared --enable-gpl --enable-pp --enable-swscaler --enable-pthreads --enable-x11grab --enable-dc1394 --enable-liba52bin --enable-libdts --enable-libfaac --enable-libfaadbin --enable-libmp3lame --enable-libogg --enable-libtheora --enable-libvorbis --enable-xvid --extra-cflags=-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m32 -march=i386 -mtune=generic -fasynchronous-unwind-tables --disable-strip
libavutil version: 49.4.0
libavcodec version: 51.40.3
libavformat version: 51.12.1
built on Apr 23 2007 23:45:21, gcc: 4.1.1 20070105 (Red Hat 4.1.1-51)
Input #0, rawvideo, from 'test_dec.yuv':
Duration: N/A, bitrate: N/A
Stream #0.0: Video: rawvideo, yuv420p, 1440x1080, 25.00 fps(r)
Input #1, ac3, from 'test.ac3':
Duration: 00:00:44.5, start: 0.000000, bitrate: 448 kb/s
Stream #1.0: Audio: 0x0000, 48000 Hz, 5:1, 448 kb/s
Output #0, avi, to 'samplevideo.avi':
Stream #0.0: Video: mpeg4, yuv420p, 1440x1080, q=2-31, 15000 kb/s, 29.97 fps(c)
Stream #0.1: Audio: ac3, 48000 Hz, 5:1, 448 kb/s
Stream mapping:
Stream #0.0 -> #0.0
Stream #1.0 -> #0.1
Press [q] to stop encoding
frame= 386 fps= 14 q=4.5 Lsize= 24559kB time=12.9 bitrate=15639.7kbits/s
video:20774kB audio:704kB global headers:0kB muxing overhead 14.346512%
Received signal 2: terminating.
post #52 of 176
I am somewhat of a linux noob. I've learned a lot though. Anyways, I try not to compile from source if I don't have to. In fact I think I only ever successfully did it once. I wish there was another way but anyways, here's what I'm getting when I run ./install or ./installasroot or even with ./configure.

Code:
/bin/csh: bad interpreter: Permission denied
Surely I am doing something wrong? Can someone shed some light on this for me?

I have Sony HDR-SR1 with .mts files I need to convert then edit.

Thanks in advance.
post #53 of 176
Quote:
Originally Posted by snostorm View Post

Here is my ffmpeg command I have also tried moving the -r option around but always get the same results I have also set it to 25 to match what it seems to think the video is but I bought he camcorder in the US so it should be NTSC, not sure why ffmpeg thinks the video is in PAL 25 fps

ffmpeg -r 29.97 -s 1440x1080 -i test_dec.yuv -i test.ac3 -vcodec mpeg4 -acodec copy -aspect 16:9 -b 15000k samplevideo.avi
...
Input #0, rawvideo, from 'test_dec.yuv':
Duration: N/A, bitrate: N/A
Stream #0.0: Video: rawvideo, yuv420p, 1440x1080, 25.00 fps(r)
Input #1, ac3, from 'test.ac3':
Duration: 00:00:44.5, start: 0.000000, bitrate: 448 kb/s
Stream #1.0: Audio: 0x0000, 48000 Hz, 5:1, 448 kb/s
Output #0, avi, to 'samplevideo.avi':
Stream #0.0: Video: mpeg4, yuv420p, 1440x1080, q=2-31, 15000 kb/s, 29.97 fps(c)

The -r command stays at the front as you have posted. Did you get your camera off e-bay or something? It is possible that you did get a PAL camera, as it clearly seems to be the case. I thought I remembered reading something about a cinema mode that would do 24 or 25fps on an otherwise NTSC camera, but I could be mistaken. Offhand, I do not recall any camera options for setting the regional info, but you could check through the menus and manual.
post #54 of 176
snostorm & others:

I am having the EXACT same audio syncing issues. Using all the scripts as is I cannot get the audio to sync to the video... the longer the clip, the more out of sync it gets. I began to suspect the frame rate, and pulled out plenty of hair. I went ahead and forced the ffmpeg step to 25 fps... and the audio sync'd up!

I bought this camera for my wife 12/20/06 from a Best Buy in Kansas City. All the packaging and manuals say NTSC. What am I doing wrong here?
post #55 of 176
I do not think you are necessarily doing anything wrong. Apparently PAL encoding cameras are finding there was to NTSC regions. I would be very interested to know if there is a way to switch.
post #56 of 176
There is no doubt in my mind that I have a PAL camera. The following scripts produce clips with perfectly sync'd audio (note the 25 fps on the ffmpeg and mencoder steps):

$ cat /usr/local/bin/m2tstoavi
Quote:


#!/bin/tcsh

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

echo using:
which xporthdmv || exit
which ldecod || exit
which ffmpeg || exit

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

set path = ( . $path )

echo $0 Starting.
echo " "
foreach file ($files)
if ( ! -f $file ) then
echo file $file not found
exit
endif

set outputfile=`basename $file | sed s/\\.m2ts// | sed s/\\.MTS//`
set tmpfile=`echo $outputfile`
set outputfile=$outputfile".avi"

echo Converting $file of $files...

if ( ! -f $tmpfile".ac3" ) then
echo xporthdmv -nh $file 1 1 1
xporthdmv -nh $file 1 1 1 && mv bits0001.mpa $tmpfile".ac3"
else
echo $tmpfile".ac3" already exists, not creating it.
endif

if ( ! -f $outputfile ) then
mkfifo pipe.yuv

echo ldecod -i bits0001.mpv -o pipe.yuv
echo ffmpeg -r 25 -s 1440x1080 -i pipe.yuv -i $tmpfile".ac3" -vcodec mpeg4 -sameq -acodec copy -aspect 16:9 -b 15000k $outputfile

ldecod -i bits0001.mpv -o pipe.yuv &
ffmpeg -r 25 -s 1440x1080 -i pipe.yuv -i $tmpfile".ac3" -vcodec mpeg4 -sameq -acodec copy -aspect 16:9 -b 15000k $outputfile && rm -f $tmpfile".ac3" $tmpfile".yuv"

rm -f bits0001.mpv
rm -f pipe.yuv
else
echo $outputfile exists, not creating it.
endif
end

rm -f ./dataDec.txt ./log.dec
echo $0 complete.

$ cat /usr/local/bin/mencoder_two_pass
Quote:


#!/bin/tcsh

#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.avi ...
exit
else
set files=($*)
endif

set path = ( . $path )

echo using:
which mencoder || exit

echo $0 Starting.
echo " "
foreach file ($files)
if ( ! -f $file ) then
echo file $file not found
exit
endif

set outputfile=`basename $file | sed s/\\.avi// | sed s/\\.AVI//`
set outputfile=$outputfile".m2p.avi"

echo MENCODER two-pass encoder converting $file of $files -- pass 1...

mencoder $file -o $outputfile \\
-fps 25 \\
-vf scale=720:405 \\
-oac copy \\
-ovc lavc \\
-lavcopts \\
vcodec=mpeg4:trell:qpel:vbitrate=4000:mbd=1:vqmax=10:lmax=10 :keyint=130:vpass=1:turbo

echo MENCODER two-pass encoder converting $file of $files -- pass 2...

mencoder $file -o $outputfile \\
-fps 25 \\
-vf scale=720:405 \\
-oac copy \\
-ovc lavc \\
-lavcopts \\
vcodec=mpeg4:trell:qpel:vbitrate=4000:mbd=1:vqmax=10:lmax=10 :keyint=130:vpass=2

end

echo $0 complete.
rm divx2pass.log

If the scripts are adjusted to use 29.97 fps the audio in the resulting clip falls more and more out of sync as the length of the clip increases. Judging from this thread and others I have found on the web I know I am not the only one with this issue. Can it be an accident that PAL cameras are in the US in NTSC boxes? Or did Sony realize they were falling short of quantities of NTSC HDR-SR1 leading up to xmas '06? Did they make up the shortfall by boxing PAL cameras in NTSC boxes? I am more than a little disappointed.
post #57 of 176
I have a fix for the H.264 reference decoder with files from the Panasonic HDC-SD5 AVCHD camcorder. The HDC-SD5 H.264 bitstream does not contain recovery_point SEI messages, and this makes the reference decoder essentially ignore the stream.

I've added an option (-f) to ldecod to force the recovery point.

ldecod -f -i bits0001.mpv

Here's the patched source files (for JM 13.0) along with the Windows binary.

http://www.w6rz.net/ldecod_patch.zip

BTW, has anyone tried to compile xport lately? I've been trying to make it as OS independent as possible. Version 1.00 is here:

http://www.w6z.net/xport.zip

Ron
post #58 of 176
Thanks Ron. I haven't had any problem using the existing version of ldecod with H.264 streams from my Panasonic HDC-SD3 (which resembles the HDC-SD1 more than the SD5). I guess that means the recovery_point SEI messages were present in the streams from these earlier models...
post #59 of 176
Thanks Ron. I will take a look at these new files. As I communicated with you previously, there are a few SD5 cameras out there that have problems, but not all. Hopefully this will solve the problems.
post #60 of 176
Hi, Ron,

any plans to include this change in the official sources?

Thanks, Gordan
New Posts  All Forums:Forum Nav:
  Return Home
  Back to Forum: Camcorders
AVS › AVS Forum › Other Areas of Interest › Camcorders › AVCHD .m2ts conversion for Linux