VideoHelp Forum

Try DVDFab and copy Ultra HD Blu-rays and DVDs! Or rip iTunes movies and music! Download free trial !
+ Reply to Thread
Page 1 of 2
1 2 LastLast
Results 1 to 30 of 36
Thread
  1. Member RogerTango's Avatar
    Join Date
    Nov 2007
    Location
    United States
    Search Comp PM
    Thanks to Soopafresh for the great script! I have made a few changes and am posting here for future comment.

    The process is a bit modified.

    Xport to AC3
    DGIndex to DGA
    Use NicAudio to load AC3 directly
    Do a smoothdeinterlace (comment out if your source is progressive)
    FFMPEG to XviD using a newer version of FFMPEG, going the route of CBR.

    Download:
    http://rogertango.com/download/mts2xvid.rar


    I will post some expanded information in the near future.

    Andrew
    Quote Quote  
  2. Member RogerTango's Avatar
    Join Date
    Nov 2007
    Location
    United States
    Search Comp PM
    Code:
    rem Original script by Soopafresh/videohelp.com, some modifications made by myself RogerTango/videohelp.com
    
    rem cleanup
    del *.avs
    del *.avc
    del *.log
    del *.ac3
    del *.dga
    del *.log
    
    
    
    rem Get the AC3 audio from the MTS file
    for %%b in ("*.mts") do xport -h "%%b" 1 1 1 && ren bits0001.mpa "%%~nb.ac3" &&  ren bits0001.mpv "%%~nb.avc"
    
    rem Generate the .DGA file from the MTS file
    for %%a in ("*.mts") do DGAVCIndex -i "%%a" -o "%%~na.dga" -e
    
    
    rem Build the AVISynth .AVS file to load the two, deinterlace and resize
    for %%a in ("*.dga") do @echo loadplugin("NicAudio.dll") > "%%~na.avs"
    for %%a in ("*.dga") do @echo loadplugin("dgavcdecode.dll") >> "%%~na.avs"
    for %%a in ("*.dga") do @echo loadplugin("SmoothDeinterlacer.dll") >> "%%~na.avs"
    for %%a in ("*.dga") do @echo video = avcsource("%%~na.dga") >> "%%~na.avs"
    for %%a in ("*.dga") do @echo audio = NicAC3Source("%%~na.ac3") >> "%%~na.avs"
    for %%a in ("*.dga") do @echo audiodub(video,audio) >> "%%~na.avs"
    for %%a in ("*.dga") do @echo SmoothDeinterlace() >> "%%~na.avs"
    for %%a in ("*.dga") do @echo Lanczos4Resize(1280,720) >> "%%~na.avs"
    
    rem Using FFMPEG, encode all to XviD.  Change command line as needed for other formats
    for %%a in ("*.avs") do ffmpeg.exe -i "%%a" -aspect 16:9 -vcodec libxvid -s 1280x720 -b 5500k -vtag DX50 -bufsize 4096 -acodec libmp3lame -ar 44100 -ab 128k -ac 2 -y "%%~na.avi"
    
    
    
    rem cleanup
    del *.avs
    del *.avc
    del *.log
    del *.ac3
    del *.dga
    del *.log
    Quote Quote  
  3. I wouldn't use DGAVCIndex with interlaced AVC content, such as that from AVCHD camcorders. Well known libav decoder bug and macroblocking artifacts. The author won't update to the new libavcodec libraries, because apparently there are problems with non-linear seeks
    Quote Quote  
  4. Member Soopafresh's Avatar
    Join Date
    Jan 2004
    Location
    United States
    Search Comp PM
    Cool. I pass the torch
    "Quality is cool, but don't forget... Content is King!"
    Quote Quote  
  5. Member RogerTango's Avatar
    Join Date
    Nov 2007
    Location
    United States
    Search Comp PM
    Soop- I bow to you, you were the brainstorm of this. I just tweaked it up for personal taste.

    Poison, until a better suited solution presents it's self, the DGAVCindex tool is the only solution for the job at hand.

    I have found reading a DGA into an AVISynth script presents much better results than using directshowsource("xxx.mts"), so I go this route.

    My Canon Vixia HF10 will do 30p (which provides the optimal AVCHD MTS file by the way!) while my JVC Enviro MZ-HD10US does 60i (both are psudo HD 1440X1080). With my Canon MTS I do NOT use deinterlace, with my JVC MTS I DO use deinterlace, that is the only difference in the script. Just use an "#" to rem out the deinterlace line in the AVISynth script as presented.

    I was working on a VB program that would do all of this for me, but since I found the script already done, I am using that.

    You can add options to the AVISynth scrip as you see fit, add additional lines of FFMPEG to generage DVD, WMV, MP4 etc... files, or whatever you want.

    Ive been using FFMPEG, Avisyntgh, Virtualdub and the like for a LONG time. This is a GREAT script bringing some tried and true apps together for a GREAT final product (1000 times better quality than any paid solution Ive evaluated)

    Thanks again Soopa, you da man!
    Andrew
    Quote Quote  
  6. Originally Posted by RogerTango
    Poison, until a better suited solution presents it's self, the DGAVCindex tool is the only solution for the job at hand.

    I have found reading a DGA into an AVISynth script presents much better results than using directshowsource("xxx.mts"), so I go this route.
    I repeat: not a good choice for interlaced AVC content as a source filter. The bug is real and reproducible, this has been examined in many forums. If you haven't seen it yet in your own encodes, I would examine your results more closely. Have a look at Soopa's thread, there are examples there of the problems. The fact is the decoder is broken with the current build. There are other options

    Directshowsource for linear seeks (straight encoding) using haali, a recent ffdshow build, or coreavc, or divx h264 would provide better results. The problem with this is it is dependent on system installed splitters and codecs. So and end user might get inconsistent results unless they have the proper splitters/decoders installed. Directshowsource() with a multithreaded decoder is also much faster for decoding. You can see 20-30% faster encodes because it frees up CPU cycles, depending on our system, and where the bottleneck is - but those are just additional benefits - the real issue here is the macroblocking artifacts caused byusing DGAVCIndex

    Another option is ffmpegsource2. This would avoid the problems with non-linear access with directshowsource (it indexes the file like DGAVCIndex), avoid the problems with variable splitters and decoders on the end user system, and would be more consistent.
    Quote Quote  
  7. Member RogerTango's Avatar
    Join Date
    Nov 2007
    Location
    United States
    Search Comp PM
    Posion, if you can direct me to a binary download of ffmpegsource2 Id be happy to see how I can weave it into the project and how the results are.

    Thx,
    Andrew
    Quote Quote  
  8. http://code.google.com/p/ffmpegsource
    http://forum.doom9.org/showthread.php?t=127037

    You wouldn't need nicaudio or xport if you used ffmpegsource2, as it can pass through the the audio if you use atrack=-1. One drawback of ffms2 is the index file it generates, but it looks like your batch file has a cleanup function

    Apparently neuron2 is trying to get the issues fixed with DGAVCIndex, so stay tuned to that as well
    Quote Quote  
  9. Member RogerTango's Avatar
    Join Date
    Nov 2007
    Location
    United States
    Search Comp PM
    Got it, having trouble getting it to work wtih FFMPEG.

    Am I to load the MTS directly, or still use xport and load the AVC and AC3?

    Andrew
    Quote Quote  
  10. Member RogerTango's Avatar
    Join Date
    Nov 2007
    Location
    United States
    Search Comp PM
    I think Im closer, I need to include "FFMS2.avsi" in my test AVS script, but I cant remember how/cant find via google how, to include it. Then I can use the FFmpegSource2 command.

    Andrew
    Quote Quote  
  11. If you wanted video and audio and you have the ffms2.avsi autoload script (it should go in the avisynth/plugins folder), an example of the syntax would be

    FFMpegSource2("0001.mts", atrack=-1)

    The separate audio and video are called with FFVideoSource() and FFAudioSource() , respectively. The autoloading avsi script basically defines the function with audiodub() and calls it FFMpegSource2()

    All the commands and syntax should be included in the documentation
    Quote Quote  
  12. Member RogerTango's Avatar
    Join Date
    Nov 2007
    Location
    United States
    Search Comp PM
    I got the include working, the MTS loading directly using FFMPegsource2() and can see the video/audio in Zoom Player or VLC, however when using the AVS for the source to encode via FFMPEG.EXE, FFMPEG crashes.

    Andrew
    Quote Quote  
  13. Not sure what would be the cause. If you can see preview the .avs script, it should feed to ffmpeg correctly

    It might be an issue with the .avsi script

    What if you define FFVideoSource and FFAudioSource separately? (i.e not using the ffms2.avsi)
    Quote Quote  
  14. Member RogerTango's Avatar
    Join Date
    Nov 2007
    Location
    United States
    Search Comp PM
    Same crash either way poison.

    I could go back to an older version of FFMPEG and try that, but that does not sound logical. Like you said, if the avs can be previewed in a media player, it SHOULD feed fine to FFMPEG.

    Ill fiddle with it more later and post what findings I have. Thx for your time.

    Andrew
    Quote Quote  
  15. Member racer-x's Avatar
    Join Date
    Mar 2003
    Location
    3rd Rock from the Sun
    Search Comp PM
    Not to step on anybody's toes, but khaver over at hv20.com wrote some very cool utilities that can do this with ease. It uses ffdshow to encode. it's dirt simple to use and has lot's of encoding options............

    http://www.hv20.com/showpost.php?p=262848&postcount=111
    Got my retirement plans all set. Looks like I only have to work another 5 years after I die........
    Quote Quote  
  16. Member RogerTango's Avatar
    Join Date
    Nov 2007
    Location
    United States
    Search Comp PM
    Racer, thx, I downloaded it and am looking at it now.
    Quote Quote  
  17. Member RogerTango's Avatar
    Join Date
    Nov 2007
    Location
    United States
    Search Comp PM
    Just an additional option to add to the mix, the latest version of Any Video Converter does a GREAT job converting the MTS to an XviD AVI *directly*, with proper frame rate and audio sync. For the audio option, select "Original" and the original AC3 audio will be copied. The reason you do this is because the AC3 to MP3 conversion leaves a lot of crackle in the audio, directly copying the audio solves that.

    BTW, Im running the free version.

    Also, the resulting 720 AVI file edits like a charm with Ulead Media Studio Pro 8 (since it does NOT support direct import of MTS files). I also have the latest/greatest Corel X2 V12 release, but I really like the MSP8 GUI, workflow and function much better.

    HTH,
    Andrew
    Quote Quote  
  18. Member RogerTango's Avatar
    Join Date
    Nov 2007
    Location
    United States
    Search Comp PM
    NEW UPDATE!

    Mencoder will do the VIDEO perfectly, but the mp3 encoding is broken, audio contains a lot of crackle. Mencoder will encode XviD directly from the mts.

    FFmpeg will do the AUDIO perfectly, but the video is broken, it cannot properly translate and encode 60i mts video. FFmpeg will encode MP3 directly from the mts.

    FFmpeg can successfully mux the good video from mencoder and the good audio from ffmpeg into a proper and synced avi!

    Stand by (a day or two) for the batch with bins!

    Andrew
    Quote Quote  
  19. Member RogerTango's Avatar
    Join Date
    Nov 2007
    Location
    United States
    Search Comp PM
    Forgot to mention, you can audio codec copy with mencoder into the encoded avi, so you can just copy the AC3 from the MTS source and have a good AVI using only mencoder if you so desire.

    Andrew
    Quote Quote  
  20. Member RogerTango's Avatar
    Join Date
    Nov 2007
    Location
    United States
    Search Comp PM
    One of the reasons I *HATE* Mencoder is because she is soooo finicky about the order of parameters... where as FFmpeg doesnt care what order, just feed it.

    Anyway, Im dressing up several batch files to include in the RAR, and... Ill post the link here, and in a new thread for further discussion.

    Been working on this for 3 days now, after it has finished this batch of MTS files off my camcorder, Ill know how well the sync is... The video and audio are SUPERB!

    Andrew
    Quote Quote  
  21. Member RogerTango's Avatar
    Join Date
    Nov 2007
    Location
    United States
    Search Comp PM
    More fun trivia for the AVCHD crowd... Mencoder doesnt know 100% how to handle PROGRESSIVE mts files!

    But I have already found that feeding say a 30p MTS to FFMpeg via an AviSynth [ directshowsource("xxx.mts") ] works perfect. This however DOES NOT WORK with 60i mts files!

    So, the packaged RAR will include the install of AviSynth 2.58, and scripts for MTS 2 AVI conversion.

    Speak now or forever hold your peace, do you also want to see scrips for X264, WMV, etc..?? The main reason I am focusing on AVI-XviD/MP3 is because this file format is almost universally readable by all editing software. I want suggestions because I am not just doing this for myself, but for others too.

    Cheers,
    Andrew
    Quote Quote  
  22. Member RogerTango's Avatar
    Join Date
    Nov 2007
    Location
    United States
    Search Comp PM
    So far I have working:

    60i MTS -> XviD/MP3 AVI
    60i MTS -> XviD/AC3 AVI
    30p MTS -> XviD/MP3 AVI
    30p MTS -> XviD/AC3 AVI

    I just set my Canon Vixia HF10 to 60i and ran that MTS through my process, perfect video.

    As I mentioned before, by tomorrow Ill know HOW WELL the sync holds up and did I do everything right, then Ill be ready to post something for download.

    Cheers,
    Andrew
    Quote Quote  
  23. Member RogerTango's Avatar
    Join Date
    Nov 2007
    Location
    United States
    Search Comp PM
    Ive gone back and redirected all my energy into the project without using DGAVC or AVIsynth.

    The new "package" revolves mostly around Mencoder. With the help of TwoLAME and a few other CLI applications, and some rather crafty scripting by myself from what I am seeing, I am getting great results from 60i MTS source to MPEG4/MPA AVI files! These files are easily loaded into most all common/typical video editors. But because even a 720p AVI at 10mb/s is a LOT of data to digest, even a somewhat strong computer will be somewhat slow in dealing with the files. My system is a dual core AMD that is 2 years old.

    Ill be posting more soon. I need to convert some 30p MTS sources and further test the script, options, etc..

    The ability to select either a single core of the CPU or all cores is now avaliable with startafinity.exe, and if you wan an SMS sent to your cell phone, sendemail.exe can be used too!

    Cheers,
    Andrew
    Quote Quote  
  24. Member RogerTango's Avatar
    Join Date
    Nov 2007
    Location
    United States
    Search Comp PM
    Is anyone interested in these batch files/scripts???

    With 30p, AVIsynth is used, with 60i it is not used, but I can put everything that is needed into one RAR/ZIP and point to it if anyone wants it.

    The results are GREAT! I use the FieldDeinterlace feature of Mencoder for the 60i material (most all prosumer/consumer AVCHD camcorders) and each frame looks like a Kodak moment, no blurring!

    Andrew
    Quote Quote  
  25. Member
    Join Date
    Dec 2009
    Location
    United States
    Search Comp PM
    I would be very interested in seeing the scripts you've been working on. I'm just catching up on this and other similar threads. Trying to setup a way to process my mts files.

    Appreciate the work you and many others have done!
    Rick
    Quote Quote  
  26. Member RogerTango's Avatar
    Join Date
    Nov 2007
    Location
    United States
    Search Comp PM
    Update: I have found out a few nifty things... Like Canon's 30 FPS progressive MTS from the Vixia series is really 60 FPS internal... which makes for a lot of confusion when media info programs keep reporting 30 FPS!!!!

    Anyway, I *think* I have come up with a system using *ONLY* Mencoder to convert both 60FPS interlaced and 30FPS progressive!!

    Ill have more data coming on this very soon-

    Andrew
    Quote Quote  
  27. Originally Posted by RogerTango View Post
    Update: I have found out a few nifty things... Like Canon's 30 FPS progressive MTS from the Vixia series is really 60 FPS internal... which makes for a lot of confusion when media info programs keep reporting 30 FPS!!!!

    Anyway, I *think* I have come up with a system using *ONLY* Mencoder to convert both 60FPS interlaced and 30FPS progressive!!

    Ill have more data coming on this very soon-

    Andrew
    would like to try it out. thx.
    Quote Quote  
  28. VideoStream 0:
    CodecName: h264
    CodecLongName: H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10
    CodecTag: 1447904328 (HDMV)
    Profile: High @ L4.0
    Duration: 00:32:02.387
    Start Position: 0.37s
    Decoder Timebase: 1001 / 120000
    Stream Timebase: 1 / 90000
    Frames: 57614
    Resolution: 1280x720p
    Interlace: Progressive
    Aspect: 1.778
    PixelFormat: YUV420P
    Framerate: 29.970
    Max refs frames: 1
    ID: 4113
    Quote Quote  
  29. Member RogerTango's Avatar
    Join Date
    Nov 2007
    Location
    United States
    Search Comp PM
    Its been a while, and have done more research. I found a few things out, and think I have a perfect system for converting MTS interlaced or progressive, 30 or 60 fps to 30fps 720 or 1080 XviD/MP3 for use in video editing software. Even if a program can import MTS or MP4 directly, a lot of "slower" machines are slow to scrub. However, XviD/MP3 vids are easier on the CPU and can most times scrub quickly and accurately.

    Andrew
    Quote Quote  
  30. Thanks. Yeah. That's what I am trying to do. I've used a bunch of freeware but with a bad source, I am looking for as close to lossless avi, for editing.

    C
    Quote Quote  



Similar Threads