or Connect
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 4

post #91 of 176
Hi,
I just got my sony hdr-sr12, hot off the assembly line.

I took a quick video (48 mb) just to play with for conversion.
When I run it through the m2tstoavi, I end up with a multi-pane fluctuating green video.
I have attached a screen shot.


I get this same output with either the mencoder method or ffmpeg method, so I'm suspect of either the demuxer or ldecoder.



Here are some of the details:

everything installed from the script.

$ xport
xport Transport Stream Demuxer 1.00

$ ldecod
----------------------------- JM 14.1 (FRExt) -----------------------------
Decoder config file : (null)
--------------------------------------------------------------------------
Input H.264 bitstream : test.264
Output decoded YUV : test_dec.yuv
Output status file : log.dec
Input reference file : test_rec.yuv does not exist
SNR values are not available
LL
post #92 of 176
Macgreg, I have an SR-10 and had exactly the same problem you had. The information below is a good starting point, but it is not a conclusive fix. I've noticed that although now I don't get the green screen, I do get major macroblock issues shortly into the video and the audio and video don't seem to sync up.

Edit: I've figured out why the blocks show up. Turns out that the m2tstoavi script isn't setting a bitrate explicitly, and mencoder, by default, uses a bitrate which is ok for DVD-resolution things, but it's horrible for HD-resolution video. So, if you don't want to learn mencoder-fu, then simply add "-lavcopts vcodec=mpeg4:vbitrate=12000" into the mencoder line as mentioned below for the resolution fix. You can tack it onto the end if you want. If you intend to edit the video, then you probably should research mencoder options and translate it to a lossless format instead.

The deal is that the resolution is being assumed by m2tstoavi to be 1440x1080, and I had exactly the same screen you had.

My SR-10's files are apparently 1920x1080, because as soon as I editted the /usr/local/bin/m2tstoavi script and changed everywhere I saw:

"mencoder $videofifo -demuxer rawvideo -rawvideo w=1440:h=1080 -aspect 16:9 -ofps 29.97"

to:

"mencoder $videofifo -demuxer rawvideo -rawvideo w=1920:h=1080 -aspect 16:9 -ofps 29.97"

Suddenly my video output changed from that nasty green screen-spasm into exactly what I'd filmed.

I suspect there's a flag somewhere in the video that could be read/parsed in order to allow m2tstoavi to tell what the original resolution was, but it may not be worth the developer's time to change things.

So, all that folks like us with 1920x1080 cameras must do, is edit one line.

Given that the product literature says that the SR-10 has 2.3 effective megapixels, while the SR-11 and SR-12 have 5.6, it's possible that you may still need to adjust your resolution settings. If that's the case, I recommend going to sonystyle.com and looking at the product spec charts. Whatever item is listed as 1920x1080 (probably "effective resolution" or something) on the SR-10, would probably have a higher-res counterpart on the SR-11 or SR-12.
post #93 of 176
Hi,

I'm new here and joined because of this thread. I have just purchased a Sony HDR-SR11E and until I sort out AVCHD its in SD mode.

I'm also very new to ffmpeg and encoding.

I have run the script and get the following code in Ubuntu 8.04:

rob@robs:~/m2ts$ m2tstoavi sample.mts
using:
./xporthdmv
ldecod: Command not found.

What do I need to do to get ldecod?

TIA

Rob
post #94 of 176
Quote:
Originally Posted by erlander View Post

Hi,

I'm new here and joined because of this thread. I have just purchased a Sony HDR-SR11E and until I sort out AVCHD its in SD mode.

I'm also very new to ffmpeg and encoding.

I have run the script and get the following code in Ubuntu 8.04:

rob@robs:~/m2ts$ m2tstoavi sample.mts
using:
./xporthdmv
ldecod: Command not found.

What do I need to do to get ldecod?

I was just thrashing that out last night myself... here are my notes; not really formatted since they were just for my reference, but obtaining ldecod is covered.

Grr... don't have 3 posts so I can't post URLs. Ok, so just copy the line below into your address bar to see my notes on it.

notes.cheapspeech.com/bin/view/Notes/RefHdCamcorderOnLinux

Now, if someone wants to be real nice to me, maybe they can post an example mencoder command line that'll result in a file which Cinelerra will enjoy trying to import? Right now I'm thrashing around trying to figure out lqt_transcode due to some reading at cinelerra.org/docs/wiki/doku.php?id=supported_file_formats which seems to indicate that most AVI container files (which mencoder seems to work easiest with) aren't going to smell right to cinelerra.
post #95 of 176
That was the ticket.

I changed my ffmpeg line from 1440 to 1920 and it worked like a charm.

As a side note, I have been kicking myself all day about not noticing that.
What is 1440 anyway? PAL?

Quote:
Originally Posted by grammaton76 View Post

Macgreg, I have an SR-10 and had exactly the same problem you had. The information below is a good starting point, but it is not a conclusive fix. I've noticed that although now I don't get the green screen, I do get major macroblock issues shortly into the video and the audio and video don't seem to sync up.

Edit: I've figured out why the blocks show up. Turns out that the m2tstoavi script isn't setting a bitrate explicitly, and mencoder, by default, uses a bitrate which is ok for DVD-resolution things, but it's horrible for HD-resolution video. So, if you don't want to learn mencoder-fu, then simply add "-lavcopts vcodec=mpeg4:vbitrate=12000" into the mencoder line as mentioned below for the resolution fix. You can tack it onto the end if you want. If you intend to edit the video, then you probably should research mencoder options and translate it to a lossless format instead.

The deal is that the resolution is being assumed by m2tstoavi to be 1440x1080, and I had exactly the same screen you had.

My SR-10's files are apparently 1920x1080, because as soon as I editted the /usr/local/bin/m2tstoavi script and changed everywhere I saw:

"mencoder $videofifo -demuxer rawvideo -rawvideo w=1440:h=1080 -aspect 16:9 -ofps 29.97"

to:

"mencoder $videofifo -demuxer rawvideo -rawvideo w=1920:h=1080 -aspect 16:9 -ofps 29.97"

Suddenly my video output changed from that nasty green screen-spasm into exactly what I'd filmed.

I suspect there's a flag somewhere in the video that could be read/parsed in order to allow m2tstoavi to tell what the original resolution was, but it may not be worth the developer's time to change things.

So, all that folks like us with 1920x1080 cameras must do, is edit one line.

Given that the product literature says that the SR-10 has 2.3 effective megapixels, while the SR-11 and SR-12 have 5.6, it's possible that you may still need to adjust your resolution settings. If that's the case, I recommend going to sonystyle.com and looking at the product spec charts. Whatever item is listed as 1920x1080 (probably "effective resolution" or something) on the SR-10, would probably have a higher-res counterpart on the SR-11 or SR-12.
post #96 of 176
modify the download script change:

# Download jm12.2
#
# Versions change often, so if it fails, just
# change the 12.2 below to whatever is listed at
# iphome.hhi.de/suehring/tml/download
#
set version=12.2

to:
set version=14.1

I ran the install script included in the tarball and it downloaded:
jm14.1.zip
unpacked and compiled it no errors.


Quote:
Originally Posted by erlander View Post

Hi,

I'm new here and joined because of this thread. I have just purchased a Sony HDR-SR11E and until I sort out AVCHD its in SD mode.

I'm also very new to ffmpeg and encoding.

I have run the script and get the following code in Ubuntu 8.04:

rob@robs:~/m2ts$ m2tstoavi sample.mts
using:
./xporthdmv
ldecod: Command not found.

What do I need to do to get ldecod?

TIA

Rob
post #97 of 176
Quote:
Originally Posted by macgreg View Post

That was the ticket.

I changed my ffmpeg line from 1440 to 1920 and it worked like a charm.

As a side note, I have been kicking myself all day about not noticing that.
What is 1440 anyway? PAL?

Some cameras are just 1440 instead of 1920, or when they use 1920 it's variable bitrate instead of CBR. Two examples that came up real quick:

http://www.videodirect.com/Merchant2...duct_Code=XHA1

http://www.maximumpc.com/article/jvc...rive_camcorder
post #98 of 176
I'm still not having any luck. I notice problems with dependencies at step 2 of Wes Bailey's HowTo. ie "sudo apt-get install mplayer ffmpeg a52dec mencoder x264 faad faac libfaad2-0 libfaad2-dev subversion csh build-essential"

I have resolved most of them but have had to un-install programs like Cinerella and Kino.

My current plan is to do a clean install of Ubuntu and then see how I go.

I will have to do some backups of data first for safety's sake so will take a day or 2.

Rob
post #99 of 176
For what it's worth, I found that the Livna repository presents horrible conflicts under Fedora, but going with freshrpms.net versions of mplayer, etc seems to resolve the conflicts. Of course, in Ubuntu I really can't help you there.

I'm not far off from finishing my sr10tomov script (a mutilated version of m2tstoavi). At present, it's geared towards getting files into cinerella. Useful tip: mplayer can't do anything with the video from a mts file, but it can identify and play OR DUMP the audio just fine. I'm using mplayer in the modified script to copy out the audio to avoid the stereo downmixing.

At present, I've moved from mencoder to transcode (better Quicktime support), but I can't get transcode to stop mutilating my audio. I just want it to pass the 5.1 sound through, but I can't find a single way for it to agree to STOP downmixing it to 2-channel stereo. I should amend that; there's ways to get it to stop trying that, but then it insists that the import and/or export methods don't support it.

However, Cinelerra doesn't seem to mind having a separate 6-channel ac3 file and 1920x1080 Quicktime file.

Other than the annoyance of loading two files instead of one, the only major hitch left is that transcode seems to only want to get the full frame count if I tell it that the video's 120FPS. Of course, Cinelerra reads this and says, "Ok, I'm going to make your 1.7s sample video only .5s long". But if I drop the frame rate to a reasonable number, Transcode decides it's done after 13 or so frames and I'm still stuck with only .5s or so of video. So, I can have either all the frames in .5s or around a quarter of my frames in .5s, but for some reason it seems really hung up on only letting me have .5s or so of video once it reaches Cinelerra.
post #100 of 176
Attached, is the sr10tomov script. This modified version of Axel's m2tstoavi is geared towards SR-10 camcorder owners who wish to import their video files into Cinelerra for editing. Edit: I have deleted this older version of the script due to bugs - check farther down in the page for the current version of sr10tomov.

In order to use this script, you should first have Axel's package installed and working, then ensure you've also got ffmpeg installed. There could be other dependencies too, dunno.

Switching to ffmpeg addressed the weird time issue I mentioned one post ago, and also allowed me enough freedom that I was able to get the audio file into the Quicktime container. The resultant file can be loaded into Cinelerra and edited, at least under 2.1-0.14.20080214.fc9 running on Fedora Core 9 on i386.

According to http://cinelerra.org/docs/wiki/doku....d_file_formats , the videos this script puts out should be a fairly reasonable format to edit. ffmpeg's output says:

Output #0, mov, to '00040.mts.mov':
Stream #0.0: Video: mpeg4, yuv420p, 1920x1080, q=2-31, 25000 kb/s, 25.00 tb(c)
Stream #0.1: Audio: libfaac, 48000 Hz, 5:1, 448 kb/s

According to the compatibility chart, mpeg4 audio and video in Quicktime files sync well, and are stable. Hopefully that is the case. I will say it syncs fine with my 1.7s sample video, and at present I'm busy rendering a few larger videos (a few minutes each) to see how they do.

By no means do I consider this script to be final or even 'good' yet. It's just there so other SR-10 owners can have a starting point that should at least get the data into Cinelerra in one piece.

BTW, don't run more than one copy of this script in any one directory at a time. The design of ldecod (hardcoded filenames) creates some race conditions that'd mess up batch processing. As long as the scripts are in different working directories, you should be fine.
post #101 of 176
Now that I've seen longer samples... frame rate is definitely off, audio is way off sync.

The separate AC3 file is retaining 5.1 surround sound, but the in-mov track isn't - this can probably be fixed fairly easily.

Interestingly enough, all the spec sheets I've read say that the Sony SR-10 is recording in 25FPS. However, based upon the frame-count benchmarks and run-time benchmarks (comparing audio track runtime vs video runtime), it seems that things should match evenly after tweaking ffmpeg to consider the YUV source to be in 29.97fps.
post #102 of 176
Next generation of sr10tomov attached. It seems to completely fix audio sync, however it's only including a downsampled AC3 track. It does, however, leave the original AC3 track in the directory, so you can still load it separetely into Cinelerra.

I've tested this with some short (30s) videos taken at a shooting range, and it looks like the gunshots are lining up well with what's supposed to be happening. I'm presently rendering some much longer videos, in order to see if there's a gradual loss of sync later on.

Next project is to get inlined 5.1ch audio, and after that I believe I'm done. Let the torch pass on to the next guy who discovers that Sony has made slight improvements to his camera, vs the previous model.

 

sr10tomov.txt 1.9189453125k . file
post #103 of 176
Quote:
Originally Posted by grammaton76 View Post

Now that I've seen longer samples... frame rate is definitely off, audio is way off sync.

The separate AC3 file is retaining 5.1 surround sound, but the in-mov track isn't - this can probably be fixed fairly easily.

Interestingly enough, all the spec sheets I've read say that the Sony SR-10 is recording in 25FPS. However, based upon the frame-count benchmarks and run-time benchmarks (comparing audio track runtime vs video runtime), it seems that things should match evenly after tweaking ffmpeg to consider the YUV source to be in 29.97fps.

We have seen this behavior before, and I think someone in this thread might have mentioned it. It seems as though (on occasion) PAL cameras are winding up in NTSC locations and vice versa. If you can upload a sample (to a personal site or sharing site), I can take a look at it if you want.
post #104 of 176
Has anybody tried this on a PS3 running linux?
post #105 of 176
Quote:
Originally Posted by 0ctane View Post

We have seen this behavior before, and I think someone in this thread might have mentioned it. It seems as though (on occasion) PAL cameras are winding up in NTSC locations and vice versa. If you can upload a sample (to a personal site or sharing site), I can take a look at it if you want.

Interesting. I kind of doubt it was a wrong-territory camera, given that it was purchased at an official Sony store. But, I'll attempt to get a sample uploaded somewhere for your inspection.
post #106 of 176
Quote:
Originally Posted by ABaugh View Post

Has anybody tried this on a PS3 running linux?

I'm sure it would work, assuming that ffmpeg and such are available for it. However, I don't think the codecs are particularly optimized for multi threaded operation, which is probably why using a PS3 would be so desirable.
post #107 of 176
Hello. I tried to run m2tstoavi and had the following error:
Code:
using:
/usr/local/bin/xporthdmv
ldecod: Command not found.
Where can I get ldecod?
post #108 of 176
Hi there Alex,

ldecod is part of the jm package. The newest version seems to be 14.2. If you use the original m2ts package you need to change the version in 'download' file ('set version=14.2').

I hope this helps.
post #109 of 176
hi,

i'm using m2tstoavi with ubuntu 8.04. Compiling went well and the testfile was converted successfully.
Then I tried to convert a 14GB file and the result was:
Quote:


./m2tstoavi /media/sdc2/Tierra.La.Pelicula.de.Nuestro.Planeta.Blu-ray.1080p.VC-1.DD5.1-GrupoHDS/BDMV/STREAM/00004.m2ts
using:
./xporthdmv
./ldecod
/usr/bin/ffmpeg
./m2tstoavi Starting.

file /media/sdc2/Tierra.La.Pelicula.de.Nuestro.Planeta.Blu-ray.1080p.VC-1.DD5.1-GrupoHDS/BDMV/STREAM/00004.m2ts not found

any ideas?

I wrote a testscript and the result was true. Something wrong with csh?
Quote:


#!/bin/bash

if [ -f $1 ]
then
echo true
else
echo false
fi
post #110 of 176
Quote:
Originally Posted by sharan4o View Post

hi,
i'm using m2tstoavi with ubuntu 8.04. Compiling went well and the testfile was converted successfully.
Then I tried to convert a 14GB file and the result was:
any ideas?
I wrote a testscript and the result was true. Something wrong with csh?

Not sure, but it may be because you are trying to convert copyrighted material.

Try running each individual step to see where things are failing.
post #111 of 176
Hello,

I'm new here.
I've installed the files and everything works fine.

Due to a better qualitiy of my videos I want to covert my the mts-files with m2tstoavi.fifo.

The quality is much better, but the converted video is very very slow. Well it's hardly to belive it's a video-file. If I don't know it - I'd thougt it's a picture-slide-show..
Maybe I have to change the bitrate, but I don't know where I have to change it..?
Audio is ok.

BTW: I've chaged in m2tstoavi.fifo the line:

ffmpeg -r 29.97 -s 1440x1080 -vcodec mpeg4 -sameq -i $videofifo \\

into:

ffmpeg -r 29.97 -s 1920x1080 -vcodec mpeg4 -sameq -i $videofifo \\

Does anyone have any solution for this problem?

cu
Chris
post #112 of 176
Quote:
Originally Posted by cautionyou View Post

With the superfast and high-quality m2ts converter can convert M2TS files to so many other formats. What' more, this M2TS Converter has powerful editing function, you can crop, trim the video and customize video effect and merge the video into a file.

Unless there's a Linux version of this application which is not being advertised on the page I loaded (which was ONLY a Windows app as far as I can tell), the quoted post is irrelevant spam to this thread.
post #113 of 176
Not to encourage spamming of this thread, but if it worked under Wine I'd be willing to pay for a windows app that did the job well, as I am having problems with the script...
post #114 of 176
Quote:
Originally Posted by Galaxydriver View Post

Hello,
...
BTW: I've chaged in m2tstoavi.fifo the line:

ffmpeg -r 29.97 -s 1440x1080 -vcodec mpeg4 -sameq -i $videofifo \\

into:

ffmpeg -r 29.97 -s 1920x1080 -vcodec mpeg4 -sameq -i $videofifo \\

Does anyone have any solution for this problem?

The resolution entirely depends on how you originally captured the video. The first generation cameras that Axel and I have were only able to capture at 1440x1080. Current generation cameras cam capture at both 1920 and 1440, so you need to adjust the "-s" flag accordingly.
Quote:
Originally Posted by cautionyou View Post

With the superfast and high-quality m2ts converter can convert M2TS files to so many other formats. What' more, this M2TS Converter has powerful editing function, you can crop, trim the video and customize video effect and merge the video into a file.

I agree with grammaton76. This looks a little suspect.
post #115 of 176
Quote:
Originally Posted by Inquisitive Alex View Post

Hello. I tried to run m2tstoavi and had the following error:
Code:
using:
/usr/local/bin/xporthdmv
ldecod: Command not found.
Where can I get ldecod?

Quote:
Originally Posted by erkara View Post

Hi there Alex,

ldecod is part of the jm package. The newest version seems to be 14.2. If you use the original m2ts package you need to change the version in 'download' file ('set version=14.2').

I hope this helps.

this help very well! Now m2toavi is working on my hardy ubuntu linux system!
Thanks a lot!
post #116 of 176
Quote:
Originally Posted by 0ctane View Post

The resolution entirely depends on how you originally captured the video. The first generation cameras that Axel and I have were only able to capture at 1440x1080. Current generation cameras cam capture at both 1920 and 1440, so you need to adjust the "-s" flag accordingly.

A convenient modification if you have a camera that does both (e.g. the Sony SR11) is near the start of the script to add:
Code:
if ( $#argv == "0" ) then
        echo usage: $0 filename.m2ts ...
        exit
else

    if ("$1" == '-h') then
        set xsz = 1920
        set aspect = "16:9"
        shift
    else if ("$1" == '-l') then
        set xsz = 1440
        set aspect = "4:3"
        shift
    else
        set xsz = 1440
        set aspect = "4:3"
    endif
    set files=($*)
endif
in place of:
Code:
if ( $#argv == "0" ) then
        echo usage: $0 filename.m2ts ...
        exit
else
    set files=($*)
endif
And the modify the ffmpeg line to read:
Code:
                        ffmpeg -r 29.97 -s ${xsz}x1080 -vcodec mpeg4 \\
                            -sameq -i $videofifo -aspect ${aspect} \\
                            -acodec  mp3 -i $audiofile -b 15000k \\
                            $outputfile || exit 1
post #117 of 176
A couple of months ago I had m2tstoavi working fine, with the mods I described in an earlier post (including changing the audio codec to mp3 from copy as xine couldn't play the DVM sound). However when I tried it again today, I get an error:
Code:
Input #0, rawvideo, from '/tmp/00006.yuv':
  Duration: N/A, bitrate: N/A
  Stream #0.0: Video: rawvideo, yuv420p, 1920x1080, 29.97 fps(r)
Input #1, ac3, from '/tmp/00006.ac3':
  Duration: 00:00:11.9, start: 0.000000, bitrate: 256 kb/s
  Stream #1.0: Audio: 0x0000, 48000 Hz, stereo, 256 kb/s
Output #0, avi, to '00006.avi':
  Stream #0.0: Video: mpeg4, yuv420p, 1920x1080, q=2-31, 15000 kb/s, 29.97 fps(c)
  Stream #0.1: Audio: pcm_s16le, 48000 Hz, stereo, 1536 kb/s
Stream mapping:
  Stream #0.0 -> #0.0
  Stream #1.0 -> #0.1
Unsupported codec (id=86020) for input stream #1.0
As far as I can make out, it looks as if ffmpeg is no longer able to convert DVM input streams -- has anyone else seen anything similar and if so is there a fix.

I'm using Kubuntu Hardy (not yet ready for KDE4), with the ffmpeg from the repositories.
post #118 of 176
Your best bet is to compile ffmpeg from subversion source.
post #119 of 176
Quote:
Originally Posted by 0ctane View Post

Your best bet is to compile ffmpeg from subversion source.

When I did that, I just got an Mpeg4 header error for each and every data frame (sorry I don't have the exact errors) -- I may try that option again but on my "crash & burn" machine.
post #120 of 176
Using a couple variations of the script, I can't get past this error:

"Failed to open audio demuxer: samplevideo.ac3"

The video works fine, but I can never get audio.

However, the samplevideo.ac3 in /tmp/ sounds just fine. Why can't it demux?
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