VideoHelp Forum
+ Reply to Thread
Page 1 of 2
1 2 LastLast
Results 1 to 30 of 48
Thread
  1. Member
    Join Date
    May 2006
    Location
    United States
    Search Comp PM
    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
    Quote Quote  
  2. Member
    Join Date
    Apr 2002
    Location
    Oskeeweewee Ontario
    Search Comp PM
    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.
    Quote Quote  
  3. Member
    Join Date
    May 2006
    Location
    United States
    Search Comp PM
    <folded into my original post above>
    Quote Quote  
  4. 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.
    Quote Quote  
  5. Member Soopafresh's Avatar
    Join Date
    Jan 2004
    Location
    United States
    Search Comp PM
    Yup. DGindex with Mpeg2source is faster than Directshowsource for conversion.
    Quote Quote  
  6. Member racer-x's Avatar
    Join Date
    Mar 2003
    Location
    3rd Rock from the Sun
    Search Comp PM
    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........
    Quote Quote  
  7. I can understand converting to a lossless codec to do extensive filtering.
    Sure, so can I. I do it all the time when my filters are slow. My point is, though, about the conversion to RGB. It looks to me like he's creating an AviSynth script so he can open the video in VDub in order to use the VDub filters. Which sort of defeats the purpose of using AviSynth in the first place. The idea is to do the filtering in the script, and if creating a lossless AVI, to convert to the colorspace used by the next link in the chain, rather than converting to RGB just because VDub is going to convert it poorly if he doesn't. The fewer colorspace conversions the better. So, as an example, in my case I'll filter in my script and then create a Lagarith AVI in YUY2, because that's what my MPEG-2 encoder (CCE) wants.
    Since he's capturing in Scene Detection, that's a lot of files to keep track of.
    I guess there's a reason for doing it that way, but he can also join them all back together again in DGIndex, if he finds that useful.
    Quote Quote  
  8. Member racer-x's Avatar
    Join Date
    Mar 2003
    Location
    3rd Rock from the Sun
    Search Comp PM
    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........
    Quote Quote  
  9. Member
    Join Date
    Aug 2002
    Location
    Sweden
    Search PM
    Do you load the m2t files directly in DGIndex?
    When I tried it did not see the files with m2t extension.

    However after demuxing with projectX I could load the m2v elementary stream in DGIndex. It is probably a good Idea anyway to process the m2t files with projectx to fix any errors.
    Quote Quote  
  10. Do you load the m2t files directly in DGIndex?
    That's what they say:

    http://forum.doom9.org/showthread.php?t=118482&highlight=m2t
    Quote Quote  
  11. Member Soopafresh's Avatar
    Join Date
    Jan 2004
    Location
    United States
    Search Comp PM
    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
    Quote Quote  
  12. Member
    Join Date
    Aug 2002
    Location
    Sweden
    Search PM
    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?
    Quote Quote  
  13. Member Soopafresh's Avatar
    Join Date
    Jan 2004
    Location
    United States
    Search Comp PM
    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.
    Quote Quote  
  14. Member
    Join Date
    Aug 2002
    Location
    Sweden
    Search PM
    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...
    Quote Quote  
  15. Member racer-x's Avatar
    Join Date
    Mar 2003
    Location
    3rd Rock from the Sun
    Search Comp PM
    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 it
    Got my retirement plans all set. Looks like I only have to work another 5 years after I die........
    Quote Quote  
  16. Member Soopafresh's Avatar
    Join Date
    Jan 2004
    Location
    United States
    Search Comp PM
    You can use 2.56 if you swap out the Yadif deinterlacer for a different one (Leak, Tdeint, etc)
    Quote Quote  
  17. Member
    Join Date
    Aug 2002
    Location
    Sweden
    Search PM
    I have seen reports that yadif works in avisynth version 2.56 and above. By the way yadif is a great deinterlacer. I tried it when converting 1080i PAL HDV to 50 fps 1280x720 and I liked the results.
    Quote Quote  
  18. Member Soopafresh's Avatar
    Join Date
    Jan 2004
    Location
    United States
    Search Comp PM
    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")
    Quote Quote  
  19. Member
    Join Date
    Jul 2007
    Location
    United States
    Search Comp PM
    My DGIndex 1.4.9 won't demux the audio. How can I get "the audio to normalized WAV and autofixes delay"?
    Answer myself, choose audio->output method->demux tracks.
    I was using demux all tracks, wonder what's the difference?

    Originally Posted by Soopafresh
    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
    Quote Quote  
  20. Member Soopafresh's Avatar
    Join Date
    Jan 2004
    Location
    United States
    Search Comp PM
    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.
    Quote Quote  
  21. Member
    Join Date
    Jul 2007
    Location
    United States
    Search Comp PM
    It is from my canon hv20, m2t, dgindex can demux mpa, no more tracks.
    Quote Quote  
  22. Member Soopafresh's Avatar
    Join Date
    Jan 2004
    Location
    United States
    Search Comp PM
    Do You Have Avisynth and Lagarith installed ? You need to have both installed. The script doesn't demux the M2V video - it converts the video to the lossless Lagarith codec so it can be imported by Vegas or Premiere and other NLEs.
    Quote Quote  
  23. Member
    Join Date
    Nov 2006
    Location
    Belgium
    Search Comp PM
    Originally Posted by Soopafresh
    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

    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.
    Quote Quote  
  24. Member Soopafresh's Avatar
    Join Date
    Jan 2004
    Location
    United States
    Search Comp PM
    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/
    Quote Quote  
  25. Member
    Join Date
    Nov 2006
    Location
    Belgium
    Search Comp PM
    Originally Posted by Soopafresh
    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/
    Hi 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.
    Quote Quote  
  26. Member Soopafresh's Avatar
    Join Date
    Jan 2004
    Location
    United States
    Search Comp PM
    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


    Quote Quote  
  27. Member
    Join Date
    Nov 2006
    Location
    Belgium
    Search Comp PM
    @Soopafresh,

    works perfect, you are the best.

    Peter.
    Quote Quote  
  28. Member
    Join Date
    Nov 2006
    Location
    Belgium
    Search Comp PM
    Originally Posted by Soopafresh
    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



    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.
    Quote Quote  
  29. Member Soopafresh's Avatar
    Join Date
    Jan 2004
    Location
    United States
    Search Comp PM
    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
    Quote Quote  
  30. Member
    Join Date
    Nov 2006
    Location
    Belgium
    Search Comp PM
    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.
    Quote Quote  



Similar Threads

Visit our sponsor! Try DVDFab and backup Blu-rays!