Just a note wanted to share...
Ever since I purchased my Sony Hdr-Hc1 and Hdr-Fx1 cameras, I've have to cope with mpeg transport stream files (m2t) and software that can't read them, or forces them into some other proprietory lossy encoding.
I prefer to convert everything I shoot into a speedy, lossless encoding for prefiltering and editting, usually HuffYuv or Lagarith. Uses up a lot of disk space, but just temporarily. (I use a different encoding for archiving.) Searches on the internet yeilded lots of convoluted methods for transcoding m2t files. The best method I have found so far for converting m2t files into avi files is to simply use the latest version of AviSynth coupled with software that works with AviSynth's avs files, such as VirtualDub.
In short, first I use HdvSplit to capture the m2t files from my camera. (HdvSplit conveniently splits the tape into files by scene). Then I create simple Avs files such as "HomeMovieClip01.avs" containing the following single line:
DirectShowSource("HomeMovieClip01.m2t")
And viola, I can the open AviSynth file I created "HomeMovieClip01.avs" in VirtualDub and filter/transcode it however I wish.
Furthermore, for conversion of the YUV in Hdv to RGB (if desired), an additional line should be added to the AviSynth script.
DirectShowSource("HomeMovieClip01.m2t")
ConvertToRGB(matrix="rec709")
The "rec709" causes the proper handling of the Luma/Chroma encoding used in Hdv, which is a different encoding than the one that was used in older, standard definition video ("rec601").
And finally, if your source is interlaced, that should be mentioned as well, otherwise the chroma will bleed between fields during the conversion from chroma subsampled YV12 to RGB.
ConvertToRGB(matrix="rec709", interlaced=true)
Note that if you don't convert to RGB (as some posters mention below), but rather pass along the YUV, you must make sure that the recipient knows that it is YUV(709) and not YUV(601). If you just blindly hand the YUV(709) to codecs like HuffYuv or Lagarith or Xvid, they will happily encode it, but then apps will assume they are gettings YUV(601) when they decode from these codecs, and will improperly display the colors. However, you can use the AviSynth ColorMatrix() function to convert between YUV(709) to YUV(601).
I hope other find this useful!
I think that links to AviSynth, HdvSplit and VirtualDub can all be found on www.videohelp.com.
Cheers,
Landrew
Try StreamFab Downloader and download from Netflix, Amazon, Youtube! Or Try DVDFab and copy Blu-rays! or rip iTunes movies!
+ Reply to Thread
Results 1 to 30 of 48
Thread
-
-
Welcome to the forums.
Are you resizing for DVD specs??
If so, what kind of processing time is it taking..
Hard to tell with no Computer Details. -
Hi-
You'd be better off opening the M2T in DGIndex and making a D2V project file from it. Then you can use AviSynth's MPEG2Source to open it, rather than DirectShowSource. More information here:
http://neuron2.net/dgmpgdec/QuickStart.html
Also, I'm not entirely sure why you need to convert it to RGB if you're making an AVI, but maybe you have your reasons. Maybe it depends on the final goal (DVD?). But if using AviSynth, you don't need to use the VDub filters. -
Well it might be a little faster, about 1/2 to 1 fps faster on my system working with HDV m2t's. But it also takes more time to run them through dgindex to create the d2v and mpa. Since he's capturing in Scene Detection, that's a lot of files to keep track of.
Personally, I like to capture one continuous file and edit the m2t directly in the Timeline. My PC is fast enough to support real-time editing of HDV. Both Premiere and Vegas have no problems with the m2t, provided you have enough CPU. I can understand converting to a lossless codec to do extensive filtering. That's rarely the case for my projects though.Got my retirement plans all set. Looks like I only have to work another 5 years after I die........ -
I can understand converting to a lossless codec to do extensive filtering.
Since he's capturing in Scene Detection, that's a lot of files to keep track of. -
I agree, conversion to RGB isn't a great idea. I would use YUY2 with Lagaryth also. It could be that he wants to use apps like After Effects and other high end programs that demand an AVI as input. They may also only work in RGB, in that case his conversions make sence.
You are definitely right about using minimum color space conversions. That's why I like to edit the m2t files directly in Premiere. Avisynth is an invaluable tool for me too. I use it extensively to change frame rates, size formats and slow-motion. But I do a lot of editing and compositing, for that I like using an NLE.Got my retirement plans all set. Looks like I only have to work another 5 years after I die........ -
-
Do you load the m2t files directly in DGIndex?
http://forum.doom9.org/showthread.php?t=118482&highlight=m2t -
Created a script which will process a folder of M2T files, automatically creating .D2V, AVS script, and demuxes the audio to normalized WAV and autofixes delay. Also deinterlaces and creates Lagarith encoded AVI video file for further processing. Modify batch files to suit your liking.
http://www.savefile.com/files/893627
The stuff you'll probably want to modify is the following:
for %%a in ("*.d2v") do @echo yadif(mode=1,order=-1) >>"%%~na.avs"
for %%a in ("*.d2v") do @echo bicubicResize(1280,720) >>"%%~na.avs"
for %%a in ("*.d2v") do @echo converttorgb() >>"%%~na.avs"
rem CFHD
for %%a in ("*.avs") do avs2avi "%%a" "vid-%%~na.avi" -c LAGS
:end
Requirements:
Avisynth 2.57 or greater
Lagarith Codec installed -
I tested DGIndex again and it worked with my m2t files when I choosed the option to show all file types, not only MPEG files. It seems that m2t is probably the same thing as ts format, a MPEG-2 transport stream.
Cool batch script Soopafresh!
The reason to create lagarith file is to make further processing faster compared to work directly with an avisynth script? -
Yeah, but that's up to you, obviously. You can delete the AVS2AVI line and work directly with the AVS file if your editing app accepts that format. Not all do, as I'm sure you know, so the conversion to Lagarith was the most compressed free lossless codec I could come up with. Smaller and faster is Cineform's codec, but it is in the $400 range.
-
Yes I use Lagarith for analog video capturing and sometimes also as intermediate editing format. Lagarith is nice because it also supports YV12 format which is the default output from avisynth and also the input format of HCEnc. Lagarith in YV12 format is a little bit smaller than in YUY2. What input format is preferred if I want to work with Vegas, YUY2, YV12 or RGB? Or maybe Vegas is good enough to do any format conversions by itself so I can feed anything to it? Normally I trust avisynth conversions more than anything else.
There are some wrappers like Link2 or VFAPI that can turn avs files to pseudo avi files to be opened in editing applications without avs support, but then the editing will still be slow... -
Vegas only works in RGB. Premiere Pro 2 can work in YUY2. There is also an AVS Plug-in that allows you to import and work with AVS scripts in Premiere. I've used it a few times and it works great. It's a little slower than working with the m2t directly, but you won't have to render to an intermediate codec. I've loaded some Slow-Motion scripts into premire while editing m2t of a Baseball game and it rendered out perfectly. I've also imported 720/60p scripts into a 720/60p Project Timeline and was able to edit at will, though it was a little stuttery. Not as smooth as editing m2t.
Soopafresh - Thanks for the Batch Process script, I'll check it out when I have a chance. I'm still using version 2.56, but will upgrade for itGot my retirement plans all set. Looks like I only have to work another 5 years after I die........ -
You can use 2.56 if you swap out the Yadif deinterlacer for a different one (Leak, Tdeint, etc)
-
I like yadif a lot as well. Fast and good.
2.56? Possibly, if you load it as a C plugin.
try -
load_stdcall_plugin("yadif.dll") -
Could be a lot of things - I'm guessing you have AC3 audio instead of MP2?
Post a segment of one of your transport stream files somewhere and I'll tell you for sure. 15 Seconds will do. -
Originally Posted by Soopafresh
Hi Soopafresh,
my sony hdr hc7 records m2t files with resolution 1440/1080, how can I bicubicResize to normal 16:9 for easy editing?
Peter. -
Hello PeterK:
If you want full resolution of your camera, change
for %%a in ("*.d2v") do @echo bicubicResize(1280,720) >>"%%~na.avs"
to
for %%a in ("*.d2v") do @echo bicubicResize(1920,1080) >>"%%~na.avs"
That'll give you 16:9 - both 1920x1080 and 1280x720 will, actually.
(and remember to install Avisynth and Lagarith)
Note: 1920x1080 is BIG. Conversion to Lagarith codec AVI will take some time. The Deinterlacing will add to the encode time. If you don't want to deinterlace, remove the YADIF lines.
You can also just import your M2T files into Vegas as an option. See here: http://www.hdr-hc7.info/ -
Originally Posted by Soopafresh
thanks for supporting.
Whats the smallest size in 16:9 that I can use for playing on TV?
I have used 720:576 but I don't think this is the good way, the movie is deformed.
Can you help my?
I also want to use the pinnacle codec ( PICVideo MJPEG codec), how can I ad this in your bat file?
Thanks,
Peter. -
Try this .BAT file: Download (Right Click). Unzip/Unrar
_run_for_peterk.rar
This should properly give you a 16:9 image with black top and bottom borders at 720x576
If you don't want the letterboxing, delete the line that says "Addborders"
The PicVideo Mjpeg will require testing.
Change this line
for %%a in ("*.avs") do avs2avi "%%a" "vid-%%~na.avi" -c LAGS
to this (I think)
for %%a in ("*.avs") do avs2avi "%%a" "vid-%%~na.avi" -c MJPG
-
Originally Posted by Soopafresh
Hi Soopafresh,
in the bat file can I change
for %%a in ("*.d2v") do @echo bicubicResize(1440,1080) >>"%%~na.avs"
in to
for %%a in ("*.d2v") do @echo bicubicResize(720,756) >>"%%~na.avs"
If possible how to set apect ratio to 16:9 without deformat the picture?
Why not use the lacrose resezing filtre.
Peter. -
If possible how to set apect ratio to 16:9 without deformat the picture?
Why not use the lacrose resezing filtre.
1) Test it out. It might look a bit strange for MJPEG which uses 1:1 pixel aspect ratio, but then encode to MPEG2 with 16:9 aspect ratio and it should look normal. I live in NTSC land, so I'm not an expert in PAL resizing.
I think you can convert to 768x576 for MJPEG, then after you are done editing, resize to 720x576 and 16:9 for MPEG2.
2) lanczosresize will work fine as well. Bicubic is very fast when you resize from BIG to small. My eyes can't see a difference, but maybe yours can -
Hi Soopafresh,
is it possible to edit the script so I can make one merged AVI file from all the m2t files.
Thanks in advance.
Similar Threads
-
Convert .m2t HD-DVR file to .ts for Blu ray burning??
By tackdriver in forum Video ConversionReplies: 15Last Post: 19th Feb 2012, 12:25 -
Convert a DVD to an avi,mkv using Avisynth Scripts and VDubMod or MeGUI
By ppeterr in forum DVD RippingReplies: 6Last Post: 25th Apr 2010, 05:04 -
What to convert M2T to?
By assman24 in forum Video ConversionReplies: 4Last Post: 29th Nov 2008, 14:17 -
Is it doable to convert HDV/.m2t 1080i files to AVI files and what...
By Canon GL-2 Guy in forum Newbie / General discussionsReplies: 4Last Post: 30th Sep 2007, 04:03 -
Lossless editing of .m2t (MPEG-2 TS) in Avisynth
By Tigon in forum Camcorders (DV/HDV/AVCHD/HD)Replies: 2Last Post: 8th May 2007, 08:23