The batch file
I use this web page to create the DOS batch file that runs tsMuxeR and eac3to according to the AVCHD joining procedure described in my Joining My AVCHD Videos page. This web page works with Mozilla Firefox and Google Chrome but does not work with Internet Explorer.
Essentially, the batch file created by this web page performs the following tasks:
- Set up the various parameters to be used by tsMuxeR and eac3to.
- Set up the meta file to be used by tsMuxeR.
- Run eac3to to generate the joined audio file.
- Run tsMuxeR with the eac3to audio file to generate the joined AVCHD file.
- Remove some temporary files generated during the joining process.
Steps to create the batch file
-
Enter a file name for the joined AVCHD file below:
- Drag and drop the AVCHD files to be joined from the AVCHD working directory to the box below:
- Review the AVCHD files to be joined. Repeat Step 2 if necessary. The joining sequency is listed above and is determined by the alphabetical order of the file names.
-
Click on the button below to generate the batch code:
-
Open Notepad from Windows:
- Click the Start button.
- Click Run.
- Type Notepad and press Enter.
-
Copy the batch code to Notepad:
- Double-click inside the text box above to highlight all the batch code.
- Right-click and select Copy.
- Go back to Notepad.
- Right-click and select Paste.
-
Save the file as AVCHD.bat:
- Click File from the top menu bar.
- Click Save As.
- Set "Save as type" to "All files (*.*)".
- Enter "AVCHD.bat" as file name.
- Click Save.
- Close Notepad.
64 comments:
Great job. Thanks for posting this.
I noticed the original separate files and the new joined file are all in the same folder. Is it possible to have these on separate physical drives and edit the batch file accordingly?
Yes, it is possible to have these files on separate locations by editing the batch code. You just need to provide the full path for each file in these two lines:
set videoFileName=
set mtsList=
bro this is cool. can u please create a downloadable program that creates the batch file, just in case you delete this blog in the future
I have got a problem. I was trying to join some MTS files from my camcorder. Some successfully joined without the audio being out of sync, but some was out of sync.
Whenever the ones that I joined got out of sync, this message was on the cmd screen, "skipping dirty PES bytes.."
Ps: the original mts files from the camcorder are showing perfectly, without any syncing problems. However when I try to join using your method, some join without having the audio sync problem, but some still gets out of sync.
I tried googling "skipping dirty pes bytes", but i didn't find a solution
Thanks. I will try if I have time. However, I have no plan to delete this blog.
Sorry, I have not seen this "skipping dirty PES bytes.." problem myself and do not have a solution. Hope you can find the solution somewhere else.
Great!
Only draging and dropping the originals in your site to create the batchfile doesn't work (instead video starts playing!) so need to create the batch file myself. Is there a setting in IE I need to change so dragging works? Win7 64; IE8
Thanks!
Sorry, this web page does not work with Internet Explorer. You may want to view it using either Mozilla Firefox or Google Chrome. They are free and can be easily installed.
You are a genius. A stone cold genius. This works like a dream. I love you. Thankyou.
I'm still using this, and you are still a genius!
I'm trying to join a BR film in a BDMV folder structure so that I get 1 large m2ts file to play with my WDTV Live.
Using your batch file, I have the following error:
H.264 stream does not contain fps field. Muxing fps 23.976
H264 warn: Force frame_mbs_only_flag division invalid detected. Cancel this flag
Bad SEI detected. SEI too short
SPS picture order 1 not supported
The process stopped prematurely and I only get a 40-60MB file. Strangely, running the batch file several times give me diff sizes. Sometimes 46B, sometimes 60MB. Once I had 120+MB.
I ran tsMuxer using the GUI (a PITA to manually add each m2ts file) and it joined it without errors. I have not tried on my wdtv live if there are sound lags or any other probs.
I'm thinking is it because of this line in the batch file:
set tsCommand1=MUXOPT --no-pcr-on-video-pid --new-audio-pes --vbr --vbv-len=500
that is causing the SEI error?
CyWa,
Thanks for the note.
If the tsMuxeR GUI works, you may want to try to copy the MUXOPT option line from the tsMuxeR GUI to the batch file and check if this would work or not.
The other thing you may want to try is to set the fps (frame per second) parameter in the batch file:
set tsCommand3=fps=, insertSEI, contSPS, track=4113
This parameter is empty in the batch file. Normally, tsMuxeR figures out what value to use. In your case, you may want to set this parameter explicitly if you know the fps of your files.
Hope this helps.
Still using it, still thanking you...
This works better than everything else I have tried for joining m2ts files. Great actually! Thanks!
This works far better than everything else I have tried for joining m2ts files. The sync problems I got when using Ts-Muxer alone are gone, that is just great! Thanks!
This works far better than everything else I have tried for joining m2ts files. The sync problems I got when using Ts-Muxer alone are gone, that is just great! Thanks!
When I tried this it joined the files but now the video is all strange. It runs fast for a few seconds and then pauses for a few. I got the raw files from a friend and am trying to join them together... I believe he used a SONY AVCHD Camcorder. Any help would be great.
@DrJ,
I have tested this method only on AVCHD files from Sony camcorders. It is possible that this method may not work on raw files from other camcorders. You may want to double check the source of your files.
Thanks for the effort dude ! but I have a problem: the audio is still so out-of-sync although I followed the exact steps. The joined video is produced, but the video runs so fast while the audio runs normally. I tried setting the "fps" parameter but still nothing. I tried with 9 files and then with just 2. The videos are .mts files with 1920x1080 resolution, 25 fps, and audio bitrate is 256 kbps. what should I do ?
PGS (date&time of camcorder) is missing after merged.
How can I put any parameter to keep it ?
By the way, to add more than one file simultaneously to the tsMuxeR GUI you just select the files and drag them to the "add" or "join" button ,then drop. I read about it somewhere and it works, but is there a way to use both tsMuxeR and eac3to from the txMuxeR GUI ?
"Thanks for the effort dude ! but I have a problem: the audio is still so out-of-sync ..."
Again, I have only tested this method with AVCHD files from SONY camcorders. It may not work for AVCHD files from other camcorders. Sorry.
"PGS (date&time of camcorder) is missing after merged.
How can I put any parameter to keep it ?"
PGS is supported by tsMuxeR but, unfortunately, is not supported by this version of the batch file generator. When I have time, I will try to look into this more.
"By the way, to add more than one file simultaneously to the tsMuxeR GUI you just select the files and drag them to the "add" or "join" button ,then drop. I read about it somewhere and it works, but is there a way to use both tsMuxeR and eac3to from the txMuxeR GUI ?".
Thanks for the note. It is good to know. However, I don't think there is a way to invoke eac3to within the tsMuxeR GUI. That is why I need to use a batch file instead.
Great job. Thanks for posting this.
Great tool. The only solution i found. thanks.
if you want a subtitle track with recoding time/date you can use karl voss' subtitlemaker on the joined file. It works!
It uses datetimeoriginal stamp in each clip. tsmuxer maintain that meta data. fantastic.
Is there a way to set what audio track I want to use from the source file? I am dealing with German sources files that have English set to use the second audio track. The first track is in German
Can you try the following and see if it works?
Replace this line in the batch script:
echo ".\eac3to\eac3to" %mtsList% %audioFile% > %batFile%
with
echo ".\eac3to\eac3to" %mtsList% 2: %audioFile% > %batFile%
Here, I assume you want track 2 in the source file.
That is amazing, is it possible to have these on separate physical drives and edit the batch file accordingly? thx.
@Kate,
Yes, it is possible.
If the files to be joined are on a different drive, you just need to replace all ".\" with the full path name (e.g., "F:\xyz\") in the line beginning with "set mtsList" in the batch file. However, you should not replace ".\" elsewhere in the batch file.
After days of downloading apps and waiting on conversion times that turned up no sound, I found this page. Thanks. I came back today to try again from another computer and I get bat error of Source file "./00.ac3" not found. I've started over several times to no avail. Any ideas? Thanks, Mark T.
Mark,
00.ac3 is the output merged audio file generated by eac3to. This file is deleted by the batch file after the completion of the overall merging process.
If 00.ac3 is missing before the end of the merging process, there may be something wrong with the eac3to execution. Maybe eac3to could not find the source mts files.
When using a different computer, you need to use the web script to generate a new batch file. This may solve your problem. Hope this helps.
Thank you for this page. Great job!!!
your post is so helpful, thank you for sharing.
GREAT!!!
After many hours lose finding a sw to join multiple files I found your blog an d your easy and fast solution! Thanks a lot
Great script and programme. I tried to join 700 MTS files, and received the error 00.AC3 not found...after reducing the files to 450, it worked fine.
So, for any how gets this error. Decrease the number of MTS files and join in several steps.
Did anyone find the solution for "Skipping dirty PES bytes"? Im following the setup to the tee and the batch starts then returns this in a never ending loop.
thankyou once again!
Thanks man, works like a charm.. If someone is having "audio out of sync" problem is because there is included a file video recorded without HD. It means they don't have the same resulotion.
Спасибо! Самый лучший и простой вариант работы с видеофайлами AVCHD
Thank You Very Much. Your notes really helped.
Worked wonders and workrd like a charm. Thanks for sharing..
Hi - Many thanks for the above - I am afraid I must be thick but I am having problems. When I drag the files across o the box they do not appear? I have tried it on two machines. so it must be me. I did get a list of files in view downloads on one occasion but I usually just get a single file playing & when I run the batch file the dos flicks up very briefly and I am unable read & no joined file appears. If you could advise what stupidity I am carrying out I would be very grateful. Thanks Kevin
DrPhotoOnTour, I suspect you were using IE to generate the batch file. Please try Chrome or Firefox.
You are correct - Best I change browser then. Many thanks verry new to all this & going around in circles. Many thanks Kevin
I have tried with Chrome and now I see the files and I get the MS box which says joined hit any key but I still don't get a file generated. Apologies for being a pain but still a tad confused. Thanks Kevin
I use to use your batch file one time with success, but now I have the same problem as DrPhotoOnTour has and I no use IE :(
Hi again, I've been really stupid, realised I'd put all my mts files in their own folder within our working directory. It now works a treat :) Thanks a lot.
I'm having the same issue as DrPhotoOnTour where the batch runs but there is no joined file created?
Hi, is there a limitation to the number of file I can join using the batch file? In my case, it works fine with some 10 files. But I have 404 files to join. When starting the .bat, created with all 404 files, the process won't start and I get a message like "Windows Command Processor Doesnt Work" (sorry, I'm using a German Win10 PC. Don't know, whether the translation is correct).
Any idea, what's wrong?
I used Notepad++ to save the .bat. And in general it does work. Just not, when joining a large number of files.
Four years on and still using this, thanks!
Same here, i have been using it also for years. Best option available :)
Risto
Now that ea3cto handles Tru DH and DTS Master, does anyone know what to edit in the batch file to take advantage of the HD audio instead of just the core?
I've been using this for a few years and LOVE it! Thank you so much as this has been the only solution to put my files together. It's super easy and does it flawlessly. I don't know what I'd do if this page stopped working!
7? years on and STILL using it - thankyou!
Consider that one day this page may die - what then?
Is there any offline version or whatever?
November 22, 2019
Not computer savvy.
Managed to dump multiple video files onto the tsMuxerR GUI.exe Input box.
Read about this in an earlier post. However had to discover this best works if you slide the required video files from the source via a separate window. Not by clicking on ADD and them browse to the source. Can only do 1 at a time.
Also had to first move 1 file because ADD is only highlighted. But multiple moves possible when JOIN is activated after 1st is placed.
Surprised the completed joined video file retained retained audio from source. Not sure why. Maybe because the audio script is in the same folder?
Had trouble running the DOS Batch file. Still working on that, but now wonder if I have audio with the GUI, why bother.
Regardless, I very happy with this excellent software solution.
Thank you so much and many KUDOS to you. Great public service and outstanding contribution, particularly for us none-savvy computer users.
>Consider that one day this page may die - what then?
Is there any offline version or whatever
You can download this webpage with most browsers and it will still work if you open the page locally
This webpage stops working. I tried Chrome, Firefox and Edge. None of them work.
This webpage stops working. I tried Chrome, Firefox and Edge. None of them works.
Not working for me, says joined complete but there is no file, did everything step by step even downloaded old versions like shows in the video
Hey, still using this 9 or 10 years after first thanking you for it. Thanks again!
It works perfectly. Thank you very much for your work, from Alicante, Spain
I still use this in 2023, anyway to get the pgs date and timestamp from joined clip?
Post a Comment