Welcome, Guest
Username Password: Remember me

TOPIC: How can I re-wrap an AVCHD MTS file to MP4?

How can I re-wrap an AVCHD MTS file to MP4? 2 years, 10 months ago #11548



My first video tutorial using CamStudio 2.6b. Note: make sure to select the highest playback quality (720p) to get the sharpest picture.

Also note that since this tutorial was made, version 0.6 of FFMBC has been released for both 32 bit and 64 bit systems. Windows binaries are available here. I have tested both and they work fine.

FFMBC 0.7 release candidate has also been compiled and can be downloaded here. Click on Regular Download. This takes you to another page. Click on the link Click here to start download from sendspace inside the blue rectangle just above the word SHARE. Version 0.7 is reported to be better at batch encoding than previous versions.

Lightworks currently only supports AVCHD in QuickTime containers not MTS/M2TS/TS. So, the latter need to be re-wrapped to mp4 or mov.

This tutorial shows how to use a command line to re-wrap MTS files to mp4 using FFMBC so that it can be imported into Lightworks--without having to navigate with the Windows Command Prompt.

The command string used in the video is:

ffmbc -i input.mts -vcodec copy -acodec aac -strict experimental -ab 512k output.mp4


Simply copy and paste into a text file, save it and rename the .txt extension to .bat as you see in the tutorial.

If you experience playback problems in Lightworks with your re-wrapped AVCHD files, see the tutorial below about transcoding AVCHD/MP4 files to MPEG2 I-frame HD on import into Lightworks. Editing AVCHD files requires a very powerful CPU. And Lightworks has some performance problems with long GOP compression (such as AVCHD). Transcoding on import to intra-frame compression solves playback problems with little loss of quality.

Transcoding AVCHD/MP4 to MPEG2 I-frame HD



Note. The Matrox codecs must be installed on your system in order to transncode to MPEG2 I-frame HD.
Dell Inspiron 560MT. Intel Core 2 Quad Q8300 Processor (2.50GHz, 4MB cache, 1333MHz FSB). 6 GB Dual Channel DDR3 [2x2048 + 2x1024]. 1TB (7200 rpm) SATA Internal HDD (Windows 7 installed), Seagate Barracuda 2 TB internal HDD (Ubuntu Studio 12.04 installed). 2TB WD External 1021 SATA HDD (7200 rpm), ITB Toshiba External HDD (7200 rpm), ATI Radeon HD 5450. Samsung SyncMaster S23B35OH LED monitor. EchoAudio Mia 24/96 soundcard. Windows 7 Home Premium 64 bit SP1. Sony HDR SR10 Handicam.

I am not employed by EditShare. I am a Lightworks user.
Last Edit: 2 years, 6 months ago by shaunthesheep.

Re: How can I re-wrap an AVCHD MTS file to mp4? 2 years, 10 months ago #11549

  • Greg_E
  • Pro User
  • OFFLINE
  • Platinum Boarder
  • Posts: 2212
Isn't there a way to have the bat convert *.mts to *.mp4? Also while this is informative, what does each parameter in that batch file mean?

Is there a GUI that actually works correctly with FFmbc? I was never able to get Avanti or winFF to work with it. If you have more info on these questions, a video would be very welcome since we are kind of stuck using conversions for the time being. I would also love to have conversion directly into Mpeg Iframe (the Matrox codec) because FFmbc should be a lot faster than Lightworks for this conversion.

I'm still trying to find a way to get XDCam EX into lightworks without jumping through too many hoops.

Re: How can I re-wrap an AVCHD MTS file to mp4? 2 years, 10 months ago #11590

Also while this is informative, what does each parameter in that batch file mean?


Inside the ffmbc 0.5 download folder there is a help text file which lists all the parameters available. If you use command prompt and navigate to the folder containing your ffmbc.exe file and run this command (which is listed in the ffmbc help file):

-codecs


it lists all the codec abbreviations that can be used. The list can be copied and pasted to a text file for future reference.

Isn't there a way to have the bat convert *.mts to *.mp4? Also while this is informative, what does each parameter in that batch file mean?


Yes, there is using batch files. I am still getting my head round that.

Is there a GUI that actually works correctly with FFmbc? I was never able to get Avanti or winFF to work with it. If you have more info on these questions, a video would be very welcome since we are kind of stuck using conversions for the time being. I would also love to have conversion directly into Mpeg Iframe (the Matrox codec) because FFmbc should be a lot faster than Lightworks for this conversion.


Avanti GUI is supposed to work with it but again I am still learning how it works. Re-name ffmbc.exe to ffmpeg_ffmbc.exe and put it in the ffmpeg folder inside the Avanti programme folder. That is as far as I have got. There is a very good Avanti support thread at the Videohelp forum.

I'm still trying to find a way to get XDCam EX into lightworks without jumping through too many hoops.


I found the following on the ffmbc author site. Not sure if it is of any use.


FFmpeg customized for broadcast and professional usage.

What you can do with FFMBC:

Import your files in Final Cut Pro or AVID Media Composer
Create XDCAM HD422 files in .mov or .mxf
Create XDCAM IMX/D-10 files in .mov or .mxf
Create AVID DNxHD files in .mov
Convert V210 Files to DNxHD
Convert YUV BT709 to BT601 and vice versa

Transcode your MPEG-2 4:2:2 Tranport stream files containing S302M audio.
Transcode your AVCHD Camera files correctly.

Merge and split your audio tracks.
Create Quicktime files containing time code tracks.

Creating audio files (mp3 and m4a) with cover art.
Keep covert art when converting your audio files.
Dell Inspiron 560MT. Intel Core 2 Quad Q8300 Processor (2.50GHz, 4MB cache, 1333MHz FSB). 6 GB Dual Channel DDR3 [2x2048 + 2x1024]. 1TB (7200 rpm) SATA Internal HDD (Windows 7 installed), Seagate Barracuda 2 TB internal HDD (Ubuntu Studio 12.04 installed). 2TB WD External 1021 SATA HDD (7200 rpm), ITB Toshiba External HDD (7200 rpm), ATI Radeon HD 5450. Samsung SyncMaster S23B35OH LED monitor. EchoAudio Mia 24/96 soundcard. Windows 7 Home Premium 64 bit SP1. Sony HDR SR10 Handicam.

I am not employed by EditShare. I am a Lightworks user.
Last Edit: 2 years, 10 months ago by shaunthesheep.

Re: How can I re-wrap an AVCHD MTS file to mp4? 2 years, 10 months ago #11595

  • Greg_E
  • Pro User
  • OFFLINE
  • Platinum Boarder
  • Posts: 2212
I tried to get Avanti to work, didn't have any luck after renaming the executable so I gave up. I don't use XDCam EX very much because those are work cameras, but it would be nice to be able to use them now and then for things.

Re: How can I re-wrap an AVCHD MTS file to MP4? 2 years, 10 months ago #11641

  • frear
  • OFFLINE
  • Fresh Boarder
  • Posts: 14
Hello Shaunthesheep, I appreciate your video tutorials. I remembered I saw this thread, so let me post the code you need to do it the fast way.

I assume you put ffmbc exe file in C:\Program Files\ffmbc\ directory.
If not, i suggest to move it there; otherwise just change the following code as needed.

Brief instructions: be sure that you have set an absolute path to the exe file (ie not in the same directory of the mts, otherwise you will have to change it every other time..), then

1. copy paste the following code in a text file
2. rename the .txt to .bat as you usually do
3. keep it somewhere: you won't need to repeat 1 & 2
4. put the mts you want to rewrap in an empty directory as you always do
5. make a copy paste of the .bat and put it in the same dir
6. execute your .bat

expected results:
- all your mts in a mts\ subdirectory
- all yout mp4 in a mp4\ subdirectory

Just that easy, and clean.

I hope to have helped, as your many accurate posts still do help me.

Cheers.

DO (
md mts
md mp4
)

for %%f IN (*.mts) DO (
"C:\Program Files\ffmbc\ffmbc.exe" -i %%f -vcodec copy -acodec aac -strict experimental -ab 512k %%~nf.mp4
)

DO (
move *.mp4 "mp4\"
move *.mts "mts\"
)
Last Edit: 2 years, 10 months ago by frear.

Re: How can I re-wrap an AVCHD MTS file to MP4? 2 years, 10 months ago #11646

Many thanks for this. I will give it a whirl.

EDIT

Yes, it works fine. My thanks again.

On Windows 7 64 bit OS there are two Program directories--Programs (x64) and Programs (x86). I placed the ffmbc directory in the Programs (x86) directory and modified the path to it in your batch commands.
Dell Inspiron 560MT. Intel Core 2 Quad Q8300 Processor (2.50GHz, 4MB cache, 1333MHz FSB). 6 GB Dual Channel DDR3 [2x2048 + 2x1024]. 1TB (7200 rpm) SATA Internal HDD (Windows 7 installed), Seagate Barracuda 2 TB internal HDD (Ubuntu Studio 12.04 installed). 2TB WD External 1021 SATA HDD (7200 rpm), ITB Toshiba External HDD (7200 rpm), ATI Radeon HD 5450. Samsung SyncMaster S23B35OH LED monitor. EchoAudio Mia 24/96 soundcard. Windows 7 Home Premium 64 bit SP1. Sony HDR SR10 Handicam.

I am not employed by EditShare. I am a Lightworks user.
Last Edit: 2 years, 10 months ago by shaunthesheep.

Re: How can I re-wrap an AVCHD MTS file to MP4? 2 years, 10 months ago #11655

  • Greg_E
  • Pro User
  • OFFLINE
  • Platinum Boarder
  • Posts: 2212
When needing absolute paths, I normally get lazy and put the application folder at C:\ so I don't have to type as many characters.

Re: How can I re-wrap an AVCHD MTS file to mp4? 2 years, 9 months ago #12088

Greg_E wrote:
I tried to get Avanti to work, didn't have any luck after renaming the executable so I gave up. I don't use XDCam EX very much because those are work cameras, but it would be nice to be able to use them now and then for things.


An alternative is to place the ffmbc folder in the programs (x86) folder, rename ffmbc.exe to ffmpeg_ffmbc.exe (in the bin folder). Then open up Avanti, right click on the Start Process button > Use other ffmpeg version > navigate to the renamed ffmpeg_ffmbc.exe in the programs (x86 folder) and select it.

Avanti is also a GUI for AVISynth. So download that and try a get a "working combo" of ffmbc and AviSynth. The message box at the bottom will tell you when this has been achieved.

It looks quite a formidable GUI to use. I think command line is probably easier to do!
Dell Inspiron 560MT. Intel Core 2 Quad Q8300 Processor (2.50GHz, 4MB cache, 1333MHz FSB). 6 GB Dual Channel DDR3 [2x2048 + 2x1024]. 1TB (7200 rpm) SATA Internal HDD (Windows 7 installed), Seagate Barracuda 2 TB internal HDD (Ubuntu Studio 12.04 installed). 2TB WD External 1021 SATA HDD (7200 rpm), ITB Toshiba External HDD (7200 rpm), ATI Radeon HD 5450. Samsung SyncMaster S23B35OH LED monitor. EchoAudio Mia 24/96 soundcard. Windows 7 Home Premium 64 bit SP1. Sony HDR SR10 Handicam.

I am not employed by EditShare. I am a Lightworks user.
Last Edit: 2 years, 9 months ago by shaunthesheep.

Re: How can I re-wrap an AVCHD MTS file to mp4? 2 years, 9 months ago #12235

Hi, I'm new to Lightworks - I'm testing right now its features

There is sometimes a problem with 1080 psf and i material.

Assume you have a 1080 25p material in an interlaced avchd file, so you need to import it in lightworks as 1080 25p, and you have other material wich is real i in an avchd file.

If you wrap to mov you will get in the import dialog in lightworks 1080i, and if you wrap to mp4 you will get 1080p

Here again the cmd-lines for it:
ffmbc -i 00000.mts -vcodec copy -acodec aac -strict experimental -ab 512k 00000.mov for i
ffmbc -i 00000.mts -vcodec copy -acodec aac -strict experimental -ab 512k 00000.mp4 for p

Kind regards, Gregor
Last Edit: 2 years, 9 months ago by gekkonier.

Re: How can I re-wrap an AVCHD MTS file to mp4? 2 years, 9 months ago #12239

Yes, I had noticed some identification problems when importing PsF AVCHD files. It has been noted in other threads too.
Dell Inspiron 560MT. Intel Core 2 Quad Q8300 Processor (2.50GHz, 4MB cache, 1333MHz FSB). 6 GB Dual Channel DDR3 [2x2048 + 2x1024]. 1TB (7200 rpm) SATA Internal HDD (Windows 7 installed), Seagate Barracuda 2 TB internal HDD (Ubuntu Studio 12.04 installed). 2TB WD External 1021 SATA HDD (7200 rpm), ITB Toshiba External HDD (7200 rpm), ATI Radeon HD 5450. Samsung SyncMaster S23B35OH LED monitor. EchoAudio Mia 24/96 soundcard. Windows 7 Home Premium 64 bit SP1. Sony HDR SR10 Handicam.

I am not employed by EditShare. I am a Lightworks user.

Re: How can I re-wrap an AVCHD MTS file to mp4? 2 years, 9 months ago #12261

I had time to quickly do some tests, here are results:

If you shoot 1080 25 psf, or 1080 25 i wrap to mov, because lightworks says on import: its 1080i - but you have the option to set in transfer to straigth! The dialog says: "Was this source transferred from a previous frame-based video/film generation?"
With psf material -> yes, so lightworks knows that it should handle the frames as whole frames and not interlaced, no mather if the container is i.

I proved the output (import & output as iframe 250, in a psf project) in avid ds, with a sony hr multiformat triniton tube, it looked exactly the same! (mp4 as 1080p import, mov as 1080i with straight import). The next tests i will do with the tube to check quality is with my other avchd cam which records true interlaced in interlaced projects. I would like to know how for example dve's calculates the interlaced output.

So far, I'm impressed with lightworks!!!

regards, Gregor.

Re: How can I re-wrap an AVCHD MTS file to mp4? 2 years, 9 months ago #12263

I did some more tests:

Rewrapping to mov could be the best method, but I got issues with the transcode method inside lightworks. On most clips it transcode only the first few seconds and fills the rest of the clip with a freeze.

What works right now:
1) put the mts into tmpeg encoder, and do an avi with matrox 250 i frame codec (as a filter say don't deinterlace)
2) inside Lightworks select copy - so you have proper clips to play with!

It seems this is a decoding bug in the quicktime stack of Lightworks, or inproper avchd streams which tmpeg can handle?
Last Edit: 2 years, 9 months ago by gekkonier.

Re: How can I re-wrap an AVCHD MTS file to mp4? 2 years, 9 months ago #12264

I don't know if this helps, but you can't actually tell the difference between true 25p and 25PsF when you view it on a progressive monitor. The two interlaced fields making up the frame are derived from the same still image, so when you view them on an Monitor (or edit them on a timeline) they will look the same anyway.

Another thing to bear in mind is that a lot of NLEs show only a single field, and this can be confusing when you're not sure whether you're viewing PsF material or genuinely interlaced material (ie material that has 50i time-separated image samples per second: just like analogue TV used to do it!).

Anyway, it's no wonder that NLEs sometimes get it wrong when they're reporting whether your footage is interlaced or progressive. Quite often, in a sense, it's both!

Re: How can I re-wrap an AVCHD MTS file to mp4? 2 years, 9 months ago #12267

Deleted by poster
Dell Inspiron 560MT. Intel Core 2 Quad Q8300 Processor (2.50GHz, 4MB cache, 1333MHz FSB). 6 GB Dual Channel DDR3 [2x2048 + 2x1024]. 1TB (7200 rpm) SATA Internal HDD (Windows 7 installed), Seagate Barracuda 2 TB internal HDD (Ubuntu Studio 12.04 installed). 2TB WD External 1021 SATA HDD (7200 rpm), ITB Toshiba External HDD (7200 rpm), ATI Radeon HD 5450. Samsung SyncMaster S23B35OH LED monitor. EchoAudio Mia 24/96 soundcard. Windows 7 Home Premium 64 bit SP1. Sony HDR SR10 Handicam.

I am not employed by EditShare. I am a Lightworks user.
Last Edit: 2 years, 9 months ago by shaunthesheep.

Re: How can I re-wrap an AVCHD MTS file to mp4? 2 years, 9 months ago #12295

Forum Admin wrote:
Anyway, it's no wonder that NLEs sometimes get it wrong when they're reporting whether your footage is interlaced or progressive. Quite often, in a sense, it's both!

Thats true! But when importing avi or mov in 1080 its great to see the transfer option in Lightworks. Lightworks renders it correctly if you do the transfer setting I mentioned before. That option _says_ its psf (p wrapped in i). Thats important in psf projects! I did tests on a true interlaced tube hd monitor in my studio, it works as intended. Also the deinterlacing of true interlaced footage is pretty good, I compared several nle's with that (Avid MC, Avid DS, Sony Vegas Pro, Premiere Pro) on the same footage.

I mentioned before that I had issues with freeze frames after few seconds in longer clips - I have this problem only on a Windows XP Systems (x86, x64), but not on Windows 7. In 1-2 weeks I can check this problem on Vista, lets see how it works there.
Time to create page: 1.81 seconds