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.
I will post some expanded information in the near future.
+ Reply to Thread
Results 1 to 30 of 36
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
Cool. I pass the torch"Quality is cool, but don't forget... Content is King!"
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!
Originally Posted by RogerTango
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.
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.
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
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.
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
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
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.
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=111Got my retirement plans all set. Looks like I only have to work another 5 years after I die........
Racer, thx, I downloaded it and am looking at it now.
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.
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!
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!
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.
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.
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!
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!
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!
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-
CodecLongName: H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10
CodecTag: 1447904328 (HDMV)
Profile: High @ L4.0
Start Position: 0.37s
Decoder Timebase: 1001 / 120000
Stream Timebase: 1 / 90000
Max refs frames: 1
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.
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.