AVCHD .m2ts conversion for Linux - AVS Forum
Forum Jump: 
Reply
 
Thread Tools
post #1 of 176 Old 01-17-2007, 08:13 PM - Thread Starter
Senior Member
 
Axel Olmos's Avatar
 
Join Date: Sep 2001
Location: Oakland, CA USA
Posts: 295
Mentioned: 0 Post(s)
Tagged: 0 Thread(s)
Quoted: 0 Post(s)
Liked: 10
Hi,

For those of us using Linux, I put together a readme and some sample scripts on how to convert .m2ts files to a format playable with mplayer.

Here's a link to the package I put together:
http://www.olmosconsulting.com/m2ts.tar.gz

Here is the procedure used:
1. Use xporthdmv to convert the file into .mpv and .mpa files.
2. Use ldecod to convert the .mpv file into a .yuv file.
3. Rename the .mpa file ldecod created to .ac3
4. Convert the .yuv file into a .y4m file using yuv4mpeg.

At this point, you have a .y4m file and .ac3 file which should be
standard.

5. Use ffmpeg to create a .avi file that contains the .y4m
transcoded to something else and the .ac3 file.

Sample commands:
xporthdmv -nh FILE.m2ts 1 1 1
ldecod -i bits0001.mpv -o /tmp/FILE.yuv
mv bits0001.mpa /tmp/FILE.ac3
yuv4mpeg -w 1440 -h 1080 -x 420mpeg2 < /tmp/FILE.yuv > /tmp/FILE.y4m
ffmpeg -i /tmp/FILE.y4m -i /tmp/FILE.ac3 -acodec copy -vcodec h264 -sameq -s 1440x1080 -aspect 16:9 -b 15000000 FILE.avi

If there is anyone out there who knows what they are doing with ffmpeg and
has suggestions, I'd love to hear them.

Axel
Axel Olmos is offline  
Sponsored Links
Advertisement
 
post #2 of 176 Old 01-27-2007, 05:23 AM
Newbie
 
Giorgio Arlanch's Avatar
 
Join Date: Jan 2007
Location: Italy
Posts: 5
Mentioned: 0 Post(s)
Tagged: 0 Thread(s)
Quoted: 0 Post(s)
Liked: 10
It's about a month that I'm looking for a m2ts conversion.
I spent a lot of hour in internet, but this is the first solution I found that use only opensource programs.
I tried and it works fine.
I found only a little problems during the last step:

ffmpeg -i /tmp/FILE.y4m -i /tmp/FILE.ac3 -acodec copy -vcodec h264 -sameq -s 1440x1080 -aspect 16:9 -b 15000000 FILE.avi

The output is:
Input #0, yuv4mpegpipe, from 'bits0001.y4m':
Duration: N/A, bitrate: N/A
Stream #0.0: Video: rawvideo, yuv420p, 1440x1080, 29.97 fps(r)
Input #1, ac3, from 'bits0001.ac3':
Duration: 00:00:21.3, start: 0.000000, bitrate: 448 kb/s
Stream #1.0: Audio: ac3, 48000 Hz, 5 channels, 448 kb/s
Output #0, avi, to 'output.avi':
Stream #0.0: Video: 0x0000, yuv420p, 1440x1080, q=2-31, 2115098 kb/s, 29.97 fps(c)
Stream #0.1: Audio: ac3, 48000 Hz, 5 channels, 448 kb/s
Stream mapping:
Stream #0.0 -> #0.0
Stream #1.0 -> #0.1
Unsupported codec for output stream #0.0


Then i tried with mpegvideo code and it runs well.

I use cinelerra and the 1080i source video has to deinterlace.
Do you think it's better to deinterlace during the conversion m2ts->avi or could be better to deinterlace using cinelerra filter?

Thanks very much
Giorgio Arlanch is offline  
post #3 of 176 Old 02-05-2007, 02:09 PM
Member
 
0ctane's Avatar
 
Join Date: Aug 2004
Location: Zionsville, IN
Posts: 130
Mentioned: 0 Post(s)
Tagged: 0 Thread(s)
Quoted: 0 Post(s)
Liked: 10
For all of you Mac OS X users, this is a viable solution. I will give Axel full details on how I got it to work so that he can include it in his m2ts.tar.gz file. There are still a few bugs to work out (aspect ratio for one), but I was able to get the m2ts file converted, and I can view it in various programs. Stay tuned.

0ctane is offline  
post #4 of 176 Old 02-06-2007, 07:47 PM
Newbie
 
mangell's Avatar
 
Join Date: Nov 2005
Posts: 6
Mentioned: 0 Post(s)
Tagged: 0 Thread(s)
Quoted: 0 Post(s)
Liked: 10
How were you able to get the file on to your Linux workstation? Has anyone been successful in mounting the drive over USB? I've been trying this to no avail. What device should I use on the mount command? I'm using RH9, so my kernel may certainly be to old for this cambera. After reading through theBlu-ray Disc/DVD+RW/+R/-R[W] for Linux article it seems an upgrade may be in order.

Any pointers?
mangell is offline  
post #5 of 176 Old 02-07-2007, 03:31 AM
Newbie
 
Giorgio Arlanch's Avatar
 
Join Date: Jan 2007
Location: Italy
Posts: 5
Mentioned: 0 Post(s)
Tagged: 0 Thread(s)
Quoted: 0 Post(s)
Liked: 10
Hi Mangel,

I use Kubuntu edgy and it autodetect and mount itself pendrive and camera.
I prefer to use windows to save the m2ts file on a fat32 partition and then I return in linux and use a script for convert the m2ts->quicktime mov file with mpeg4+aac codec.
The script is very slow, but the mov file works fine in cinelerra.

When you connect the device to usb port try to use the command

lsusb

You can see the list of the founded devices.

Bye

Giorgio


Quote:
Originally Posted by mangell View Post

How were you able to get the file on to your Linux workstation? Has anyone been successful in mounting the drive over USB? I've been trying this to no avail. What device should I use on the mount command? I'm using RH9, so my kernel may certainly be to old for this cambera. After reading through theBlu-ray Disc/DVD+RW/+R/-R[W] for Linux article it seems an upgrade may be in order.

Any pointers?

Giorgio Arlanch is offline  
post #6 of 176 Old 02-07-2007, 11:43 AM
Member
 
0ctane's Avatar
 
Join Date: Aug 2004
Location: Zionsville, IN
Posts: 130
Mentioned: 0 Post(s)
Tagged: 0 Thread(s)
Quoted: 0 Post(s)
Liked: 10
As I have discussed with Axel in PMs, the yuv4mpeg step can be skipped using the following command:

% ffmpeg -r 29.97 -s 1440x1080 -i /tmp/samplevideo.yuv -i /tmp/samplevideo.ac3 -vcodec mpeg4 -acodec copy -aspect 16:9 -b 15000k samplevideo.avi

Ffmpeg will take the *.yuv file created by ldecod and convert it to whatever format you like. Note that the order of options is important (which might help Giorgio's problem).
[edited] video and audio now sync properly with the addition of -r 29.97

0ctane is offline  
post #7 of 176 Old 02-07-2007, 07:04 PM
Member
 
0ctane's Avatar
 
Join Date: Aug 2004
Location: Zionsville, IN
Posts: 130
Mentioned: 0 Post(s)
Tagged: 0 Thread(s)
Quoted: 0 Post(s)
Liked: 10
I have posted Mac OS X instructions here for converting AVCHD content to HDV, and hopefully Axel will include them in his package. You should still get Axel's m2ts.tar.gz file (see first post at top of page) since it has a sample video clip and other information.

My instructions illustrate how to convert AVCHD content into HDV content, which is a format supported by iMovieHD and Final Cut. Of course, you can convert your videos into many other formats too, but that is up to you.

A new option is Voltaic. This bundles the whole process together into one program (and does not require QTPro). Of course, the benefit of my instructions are that it is the free way of doing a conversion.

0ctane is offline  
post #8 of 176 Old 02-08-2007, 06:32 AM
Newbie
 
Giorgio Arlanch's Avatar
 
Join Date: Jan 2007
Location: Italy
Posts: 5
Mentioned: 0 Post(s)
Tagged: 0 Thread(s)
Quoted: 0 Post(s)
Liked: 10
Thanks for your suggestion Octane. I will try it.

The procecude is very slow. Remove a step is a good idea.

I also tried -vcodec mpeg4 but I must use -acodec aac.
I don't know why, but I have problem using -acode copy. Cinelerra don't work with this ac3 stream.

I also tried the option -deinterlace. It seems work well.
At the moment I prefer use pal low resolution format and so I use this command:

ffmpeg -i /tmp/samplevideo.y4v -i /tmp/samplevideo.ac3 -acodec aac -ac 5 -ab 448 -r 25 -vcodec mpeg4 -sameq -s 720x576 -aspect 16:9 -deinterlace samplevideo.mov

Bye

Quote:
Originally Posted by 0ctane View Post

As I have discussed with Axel in PMs, the yuv4mpeg step can be skipped using the following command:

% ffmpeg -r 29.97 -s 1440x1080 -i /tmp/samplevideo.yuv -i /tmp/samplevideo.ac3 -vcodec mpeg4 -acodec copy -aspect 16:9 -b 15000k samplevideo.avi

Giorgio Arlanch is offline  
post #9 of 176 Old 02-08-2007, 10:58 AM
Newbie
 
Giorgio Arlanch's Avatar
 
Join Date: Jan 2007
Location: Italy
Posts: 5
Mentioned: 0 Post(s)
Tagged: 0 Thread(s)
Quoted: 0 Post(s)
Liked: 10
Hi Octane,

I tried to use directly yuv file but my ffmpeg don't recognize yuv codec:

Code:
FFmpeg version SVN-r7773, Copyright (c) 2000-2006 Fabrice Bellard, et al.
  configuration:  --enable-faac --enable-gpl --enable-pthreads --disable-debug --disable-mmx --enable-a52
  libavutil version: 49.2.0
  libavcodec version: 51.29.0
  libavformat version: 51.8.0
  built on Jan 31 2007 08:18:23, gcc: 4.1.2 20060928 (prerelease) (Ubuntu 4.1.1-13ubuntu5)
picture size invalid (0x0)
[rawvideo @ 0x6d4880]Could not find codec parameters (Video: rawvideo, yuv420p)
/mnt/hda4/temp/file.yuv: could not find codec parameters
Did you compile ffmpeg or did you install it from binary? Can you give me the configuration options. You can find it on the second line when you run ffmpeg.

Thanks


Quote:
Originally Posted by 0ctane View Post

% ffmpeg -r 29.97 -s 1440x1080 -i /tmp/samplevideo.yuv -i /tmp/samplevideo.ac3 -vcodec mpeg4 -acodec copy -aspect 16:9 -b 15000k samplevideo.avi

Giorgio Arlanch is offline  
post #10 of 176 Old 02-08-2007, 11:13 AM
Member
 
0ctane's Avatar
 
Join Date: Aug 2004
Location: Zionsville, IN
Posts: 130
Mentioned: 0 Post(s)
Tagged: 0 Thread(s)
Quoted: 0 Post(s)
Liked: 10
Quote:
Originally Posted by Giorgio Arlanch View Post

Hi Octane,
I tried to use directly yuv file but my ffmpeg don't recognize yuv codec:

Code:
picture size invalid (0x0)
[rawvideo @ 0x6d4880]Could not find codec parameters (Video: rawvideo, yuv420p)
/mnt/hda4/temp/file.yuv: could not find codec parameters

I have to requote myself: "Note that the order of options is important". Maybe I should have written "VERY important". If the -r 29.97 -s 1440x1080 is NOT before your input (-i) you will get the error you experienced (I had to post to the ffmpeg forums in order to learn this lesson). By having the -r -s before the -i you are telling ffmpeg that the input is 29.97fps and at a 1440x1080 size.

0ctane is offline  
post #11 of 176 Old 02-08-2007, 01:18 PM - Thread Starter
Senior Member
 
Axel Olmos's Avatar
 
Join Date: Sep 2001
Location: Oakland, CA USA
Posts: 295
Mentioned: 0 Post(s)
Tagged: 0 Thread(s)
Quoted: 0 Post(s)
Liked: 10
Quote:
Originally Posted by 0ctane View Post

For all of you Mac OS X users, this is a viable solution. I will give Axel full details on how I got it to work so that he can include it in his m2ts.tar.gz file. There are still a few bugs to work out (aspect ratio for one), but I was able to get the m2ts file converted, and I can view it in various programs. Stay tuned.

Thanks so much for this!! I updated the .tar.gz with the improvements.
Axel Olmos is offline  
post #12 of 176 Old 02-08-2007, 02:37 PM - Thread Starter
Senior Member
 
Axel Olmos's Avatar
 
Join Date: Sep 2001
Location: Oakland, CA USA
Posts: 295
Mentioned: 0 Post(s)
Tagged: 0 Thread(s)
Quoted: 0 Post(s)
Liked: 10
It looks to me that our videos are NOT 16:9, but are 4:3. Dropping the -aspect 16:9 from the ffmpeg line makes the video smaller, but the aspect looks right. Can anyone verify?
Axel Olmos is offline  
post #13 of 176 Old 02-08-2007, 04:40 PM
Newbie
 
Giorgio Arlanch's Avatar
 
Join Date: Jan 2007
Location: Italy
Posts: 5
Mentioned: 0 Post(s)
Tagged: 0 Thread(s)
Quoted: 0 Post(s)
Liked: 10
Thanks Octane,

using the right order it works well.
And now, the next step, is to remove ldecod!

Quote:
Originally Posted by 0ctane View Post

... "VERY important". If the -r 29.97 -s 1440x1080 is NOT before your input (-i) ...

Giorgio Arlanch is offline  
post #14 of 176 Old 02-17-2007, 11:28 AM
Newbie
 
johnellisdm's Avatar
 
Join Date: Feb 2007
Posts: 6
Mentioned: 0 Post(s)
Tagged: 0 Thread(s)
Quoted: 0 Post(s)
Liked: 10
i tried your instructions at octane(dot)net for getting this to convert with a mac. i'm getting strange results. in iMovieHD, the avi just comes out black. i tried with the sample in axel's post and also with a sample i got from somewhere else (i don't want to commit to buying the camera until i am comfortable that i can edit footage with it), both with the same results. in FCP, it tells me that it is missing a codec.

any ideas?
johnellisdm is offline  
post #15 of 176 Old 02-17-2007, 12:11 PM
Newbie
 
johnellisdm's Avatar
 
Join Date: Feb 2007
Posts: 6
Mentioned: 0 Post(s)
Tagged: 0 Thread(s)
Quoted: 0 Post(s)
Liked: 10
ok, after running all the scrits, i can get it to work in mplayer, but i'm still getting "no codec" in fcp. do i have to get this codec from somewhere?
johnellisdm is offline  
post #16 of 176 Old 02-17-2007, 04:35 PM
Newbie
 
johnellisdm's Avatar
 
Join Date: Feb 2007
Posts: 6
Mentioned: 0 Post(s)
Tagged: 0 Thread(s)
Quoted: 0 Post(s)
Liked: 10
after playing around with the m2tstoavi script a bit, i think i *might* be getting somewhere:

i can load stuff into fcp if i change the vcodec to mpeg2video and change the extension of the file to .mpg. only problem is i don't get sound. i'm thinking that fcp doesn't support ac3? anyway, i tried to set acodec to something other than copy and i get:

[ac3 @ 0x423514]A52 library liba52.so.0 could not be opened!
dlopen(liba52.so.0, 1): image not found

i tried to recompile with --enable-shared but that got a compile error. i am using the ffmpeg revision 7013. the one checked out as a result of the download script doesn't seem to work with the configuration options in the "configure" script. it seems they have changed at some point.

any ideas?
johnellisdm is offline  
post #17 of 176 Old 02-17-2007, 11:01 PM
Newbie
 
johnellisdm's Avatar
 
Join Date: Feb 2007
Posts: 6
Mentioned: 0 Post(s)
Tagged: 0 Thread(s)
Quoted: 0 Post(s)
Liked: 10
i've been playing with some of the settings for ffmpeg. i changed the script around so that i could change the video codec, audio codec, format and the output file extension.

i ended up with:
set codec=mpeg4
set acodec=mp3
set fformat=mov
set fext=mov

and i use the -f option which forces a certain format on ffmpeg.

and that seemed to work ok in fcp if i set the project to:
HDV 1080i60

the only problem is that i have to always render the timeline, which will take a long time. i'm wondering if there is some format i could use ffmpeg to transform to that fcp will handle natively.

the other section of the scrip that i modified is the bottom that calls ffmpeg:

echo ffmpeg -r 29.97 -s 1440x1080 -i $tmpfile".yuv" -i $tmpfile".ac3" -f $fformat -vcodec $codec -sameq -acodec $acodec -aspect 16:9 -b 15000k $outputfile
ffmpeg -r 29.97 -s 1440x1080 -i $tmpfile".yuv" -i $tmpfile".ac3" -f $fformat -vcodec $codec -sameq -acodec $acodec -aspect 16:9 -b 15000k $outputfile && rm -f $tmpfile".ac3" $tmpfile".yuv"

john
johnellisdm is offline  
post #18 of 176 Old 02-19-2007, 09:16 AM
Newbie
 
johnellisdm's Avatar
 
Join Date: Feb 2007
Posts: 6
Mentioned: 0 Post(s)
Tagged: 0 Thread(s)
Quoted: 0 Post(s)
Liked: 10
Ok.. using all the steps above, you can get an mpeg4/mp3 .mov file (i guess you loose the surround sound feature of the camera). from there, you can use Compressor to convert to HDV. once the file is in HDV, you can edit natively in FCP.

I am planning on using the above script and apple's Folder Actions feature to create an apple script that will run when .m2ts files are dropped into my "porjects" folder. with this, i will have pretty much the same workflow as if FCP handled AVCHD natively.

when i get all this done, i will post all the relevant scripts, etc.

john
johnellisdm is offline  
post #19 of 176 Old 02-21-2007, 03:09 PM
Newbie
 
johnellisdm's Avatar
 
Join Date: Feb 2007
Posts: 6
Mentioned: 0 Post(s)
Tagged: 0 Thread(s)
Quoted: 0 Post(s)
Liked: 10
ok... i got an SR1 from fry's electronics (they still have a "no restocking fee" return policy) and tried some video out. i was able to edit, but for every min. of recorded footage, it took about 20-30 mins to convert. this will not work for me since i usually shoot underwater footage on a dive trip. i like to shoot in the morning and edit in the afternoons/evenings. i couldn't wait the 5 hours it would take to convert 10 mins of video.

i think i'll go with the HDR-HC7. looks like it has some better stats anyway, especially for the low light conditions when diving.
johnellisdm is offline  
post #20 of 176 Old 03-14-2007, 09:47 AM
Newbie
 
Lysander's Avatar
 
Join Date: Oct 2006
Posts: 10
Mentioned: 0 Post(s)
Tagged: 0 Thread(s)
Quoted: 0 Post(s)
Liked: 10
xport is not compiling for me without warnings. And it doesn't seem to be working. As I understand it, xport should convert the .MTS (m2ts) file into seperate video and audio files in original format- eg: mp4 and ac3. The audio file is playable in VLC, but the video is not.

The warning I get when trying to compile xport on a mac are:
gcc -o xportdmv xport.c ; chmod 755 xportdmv
xport.c:37: warning: integer constant is too large for 'long' type
xport.c: In function 'parse_ac3_audio':
xport.c:383: warning: integer constant is too large for 'long' type
xport.c: In function 'parse_mp2_audio':
xport.c:626: warning: integer constant is too large for 'long' type

This is a PowerMac G5 with OS X 10.4.8

I checked the first line and the value is being put into a long long type, not a long type, and long long seems to be supported on the Mac, so I'm not sure how to get GCC to compile this correctly... it wants to put it in a long (And this probably causes the video problems I was seeing.)

gcc --version
powerpc-apple-darwin8-gcc-4.0.1 (GCC) 4.0.1 (Apple Computer, Inc. build 5367)
Copyright (C) 2005 Free Software Foundation, Inc.
Lysander is offline  
post #21 of 176 Old 03-14-2007, 05:32 PM
Member
 
0ctane's Avatar
 
Join Date: Aug 2004
Location: Zionsville, IN
Posts: 130
Mentioned: 0 Post(s)
Tagged: 0 Thread(s)
Quoted: 0 Post(s)
Liked: 10
Quote:
Originally Posted by Lysander View Post

xport is not compiling for me without warnings. And it doesn't seem to be working. As I understand it, xport should convert the .MTS (m2ts) file into seperate video and audio files in original format- eg: mp4 and ac3. The audio file is playable in VLC, but the video is not.

Yes, xport separates tracks. The video cannot be played in VLC since VLC does not (yet?) recognize AVCHD.
Quote:


The warning I get when trying to compile xport on a mac are:
... it wants to put it in a long (And this probably causes the video problems I was seeing.)

Are you saying that it did compile, but just gave error/warning messages? Did you go through the rest of the procedure to convert to *.yuv and then to a playable mpeg/mp4 format?

0ctane is offline  
post #22 of 176 Old 03-16-2007, 06:12 PM - Thread Starter
Senior Member
 
Axel Olmos's Avatar
 
Join Date: Sep 2001
Location: Oakland, CA USA
Posts: 295
Mentioned: 0 Post(s)
Tagged: 0 Thread(s)
Quoted: 0 Post(s)
Liked: 10
Quote:
Originally Posted by Lysander View Post

xport is not compiling for me without warnings. And it doesn't seem to be working...

Hi, it turns out the latest version of xporthdmv exports 0 byte audio files. I am in contact with the author who will try and fix it. In the meantime, unless you are lucky enough to find a download of an older version of xport, you are stuck without audio.
Axel Olmos is offline  
post #23 of 176 Old 03-23-2007, 04:48 PM - Thread Starter
Senior Member
 
Axel Olmos's Avatar
 
Join Date: Sep 2001
Location: Oakland, CA USA
Posts: 295
Mentioned: 0 Post(s)
Tagged: 0 Thread(s)
Quoted: 0 Post(s)
Liked: 10
Quote:
Originally Posted by Axel Olmos View Post

Hi, it turns out the latest version of xporthdmv exports 0 byte audio files. I am in contact with the author who will try and fix it. In the meantime, unless you are lucky enough to find a download of an older version of xport, you are stuck without audio.

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.)
Axel Olmos is offline  
post #24 of 176 Old 04-02-2007, 10:34 PM
Newbie
 
p28driver's Avatar
 
Join Date: Apr 2007
Posts: 3
Mentioned: 0 Post(s)
Tagged: 0 Thread(s)
Quoted: 0 Post(s)
Liked: 10
Axel - Thanks for your post; works great on the small samples I've played with. Problem is the size of the raw files generated by ldecod - around 4GB / min of video for my samples. Seems like there should be a way to avoid creating the entire raw file, like piping the output of ldecod directly to ffmpeg. I tried this, but it looks like one or the other (or both) doesn't support pipes. Am I wrong? Any ideas?

p28driver
p28driver is offline  
post #25 of 176 Old 04-03-2007, 07:33 AM
Member
 
0ctane's Avatar
 
Join Date: Aug 2004
Location: Zionsville, IN
Posts: 130
Mentioned: 0 Post(s)
Tagged: 0 Thread(s)
Quoted: 0 Post(s)
Liked: 10
Yeah, the hard drive overhead is quite big. I am not aware of being able to pipe into ffmpeg. You could always get onto the ffmpeg development forum and post an inquiry there.

0ctane is offline  
post #26 of 176 Old 04-03-2007, 10:02 AM
Newbie
 
p28driver's Avatar
 
Join Date: Apr 2007
Posts: 3
Mentioned: 0 Post(s)
Tagged: 0 Thread(s)
Quoted: 0 Post(s)
Liked: 10
I dug into this a bit more by looking at the source code for ffmpeg, and it certainly does allow for pipes. Looks like you still have to specify an input filename with the -i option, but for a pipe you specify either "-" or "/dev/stdin" as the input filename.

The remaining question is whether or not the ldecod output can be piped to another program, which looks doubtful. I'm looking into the source code of ldecod to see if it's possible, with or without modifiation...

p28driver
p28driver is offline  
post #27 of 176 Old 04-03-2007, 11:22 AM
Member
 
latedate's Avatar
 
Join Date: Mar 2007
Location: Champaign, IL
Posts: 93
Mentioned: 0 Post(s)
Tagged: 0 Thread(s)
Quoted: 0 Post(s)
Liked: 10
Quote:
Originally Posted by p28driver View Post

I dug into this a bit more by looking at the source code for ffmpeg, and it certainly does allow for pipes. Looks like you still have to specify an input filename with the -i option, but for a pipe you specify either "-" or "/dev/stdin" as the input filename.

The remaining question is whether or not the ldecod output can be piped to another program, which looks doubtful. I'm looking into the source code of ldecod to see if it's possible, with or without modifiation...

p28driver

If ldecod doesn't accept pipes (stdin) explicitly, can't you work around the problem using named pipes (FIFOs)?

Chris
latedate is offline  
post #28 of 176 Old 04-03-2007, 05:47 PM
Newbie
 
p28driver's Avatar
 
Join Date: Apr 2007
Posts: 3
Mentioned: 0 Post(s)
Tagged: 0 Thread(s)
Quoted: 0 Post(s)
Liked: 10
Thanks, Chris! Named pipes do the trick nicely!

Here's what I tried:

% xport -h sample.m2ts 1 1 1
% mv bits0001.mpa sample.ac3

% mkfifo pipe.yuv
% ldecod -i bits0001.mpv -o pipe.yuv &
% ffmpeg -r 29.97 -s 1440x1080 -i pipe.yuv -i /tmp/sample.ac3 -acodec copy \\
-vcodec mpeg4 -aspect 16:9 -b 15000k sample.avi
% rm pipe.yuv

No gigantic intermediate files, no filling up my hard drive with 15 minutes of raw video I'm just going to delete anyway! This is starting to look like a practical technique.

Does anybody have links to other sample videos from any of the Sony AVCHD cameras?

Dallas
p28driver is offline  
post #29 of 176 Old 04-19-2007, 01:42 AM
Member
 
0ctane's Avatar
 
Join Date: Aug 2004
Location: Zionsville, IN
Posts: 130
Mentioned: 0 Post(s)
Tagged: 0 Thread(s)
Quoted: 0 Post(s)
Liked: 10
Quote:
Originally Posted by Axel Olmos View Post

It looks to me that our videos are NOT 16:9, but are 4:3. Dropping the -aspect 16:9 from the ffmpeg line makes the video smaller, but the aspect looks right. Can anyone verify?

Yes, the camera captures video at 4:3. That is why we need to explicitly state the resolution (1440x1080) and aspect ratio (16:9).

Interesting work-around with the pipes guys. I had never used (or even heard of) mkfifo before. I tested it out on one of my videos and it worked just fine. Great job!

For Macintosh iMovie users, the ac3 format and -acodec copy does not seem to be a viable option. Apple does not really support ac3, and Quicktime does not seem to be able to convert to a different audio format internally. I slightly modified my command-line options to allow output as mp3.
Code:
% ffmpeg -r 29.97 -s 1440x1080 -i avchd.yuv -i avchd.ac3 -vcodec mpeg4 -ac 2 -acodec mp3 -aspect 16:9 -b 15000k sample.avi
I was previously having "Error while opening codec for output stream #0.1" problems because ac3 is 5 (.1) channel while mp3 is 2 channel. Duh. However, exporting the video to HDV 1440x1080 in Quicktime Pro still causes the audio to drop/fail. More digging...

Thanks to everyone who is contributing, debugging, and optimizing.

0ctane is offline  
post #30 of 176 Old 04-19-2007, 05:38 AM
 
dwrowley's Avatar
 
Join Date: Nov 2003
Posts: 13
Mentioned: 0 Post(s)
Tagged: 0 Thread(s)
Quoted: 0 Post(s)
Liked: 10
Does anyone have any pre-compiled intel binaries for xport, ldecod, etc.?

Thanks,
David
dwrowley is offline  
Reply Camcorders

User Tag List

Thread Tools
Show Printable Version Show Printable Version
Email this Page Email this Page


Forum Jump: 

Posting Rules  
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off