Page 1 of 1
MKV to M2TS Script
Posted: April 7th, 2009, 12:55 am
by johoja
Not sure if this is usefull for anyone here but it is for me, since I have an Xbox and I extend files to it and M2TS is the fatest/best way to keep h.264 video and ac3 audio.
So i wrote this script and borrowed some ideas from:
http://forum.handbrake.fr/viewtopic.php?f=10&t=6075,
but changed the script around quite a bit.
You will need tsmuxer for this to work.
I've reuploaded it :
http://www.mediafire.com/download.php?kzhwnemxzmj
Also you have to change the path to proc.cmd, in script.cmd it requires the ful path.
This also deletes the original mkv so be careful.
you can test it by runnin script.cmd "c:\files-here\"
I'll probably add some sort of fail check as well so that it doesn't delete the *.mkv file if the *.m2ts doesnt exist or something along those lines for now I'd recomend commenting out the del %infile% /q line.
Re: MKV to M2TS Script
Posted: April 8th, 2009, 9:51 am
by belfbri
The download link doesn't appear to be working.
Re: MKV to M2TS Script
Posted: April 8th, 2009, 12:01 pm
by johoja
*edited first post*
Re: MKV to M2TS Script
Posted: June 3rd, 2009, 8:35 pm
by Chugalug
Anyway to get this to work on Mac, I would like something like this.
Re: MKV to M2TS Script
Posted: June 5th, 2009, 3:11 am
by bandshark
Thank you, I really appreciate this script.
Re: MKV to M2TS Script
Posted: July 31st, 2009, 9:28 pm
by ssc
Can you, or someone, please reupload the script again.. or actually just post the code here?
Much appreciated!
Thanks!
/S
Re: MKV to M2TS Script
Posted: August 1st, 2009, 9:34 am
by johoja
Hey, here's the script. There are some limitations that someone could probably fix if they want to (dont check for dts audio for one, shouldn't be that hard) I dont use it anymore since I can just play MKV's fine on my setup.
I've made some updates to it but forgot to upload them, such as checking if tsmuxer completed successfully and if it didn't dont delete the mkv file and keep the logs. You still need tsmuxer for this to work and setup the paths for your system in the two *.cmd files.
start script.cmd
Code: Select all
cd /d %1
for /F "tokens=*" %%a in ('dir /b *.mkv') do call f:\scripts\proc.cmd %%~na
end script.cmd
start proc.cmd
Code: Select all
@echo off
SET flag=0
set track=0
set metafile=%*.meta
set infile=%*.mkv
set outfile2=%*.m2ts
@echo **********************
@echo %infile%
@echo **********************
tsmuxer "%infile%" > log.txt
for /F "tokens=*" %%a in (log.txt) DO (call :s_do_sums "%%a")
@echo Creating %metafile%
@echo MUXOPT --no-pcr-on-video-pid --new-audio-pes --vbr --vbv-len=500 > "%metafile%"
@echo V_MPEG4/ISO/AVC, "%infile%", insertSEI, contSPS, track=%video%, lang=eng >> "%metafile%"
@echo A_AC3, "%infile%", track=%audio%, lang=eng >> "%metafile%"
@echo **********************************
@echo Creating %outfile2%
tsMuxeR.exe "%metafile%" "%outfile2%" > "%*".log
@echo **********************************
for /F "tokens=*" %%a in ('find "successful" "%*".log') DO (call :check "%%a")
if %flag% == 1 (
del *.sfv /q
del *.log /q
del *.nzb /q
del *.meta /q
del log.txt /q
del "%infile%" /q
) else (
@echo **********************************
echo There was a failure! Keeping log files. )
@echo **********************************
GOTO :eof
:s_do_sums
::echo %1*
if %1 == "Track ID: 1" (
set track=1)
if %1 == "Track ID: 2" (
set track=2)
if %1 == "Track ID: 3" (
set track=3)
if %1 == "Track ID: 4" (
set track=4)
if %1 == "Stream type: H.264" (
echo Video is at Track:%track%
set video=%track% )
if %1 == "Stream type: AC3" (
echo Audio is at Track:%track%
set audio=%track% )
GOTO :eof
:check
if %1 == "Mux successful complete." (
echo Muxing was succesful
@echo **********************************
set flag=1 )
GOTO :eof
end proc.cmd
Re: MKV to M2TS Script
Posted: August 2nd, 2009, 3:25 am
by ssc
Thanks! I'm moving from running all my stuff on Xbmc (live USB) to running a central Windows 7 MCE with some 360s as extenders so need to change format to M2TS. Out of curiosity, what are you running?
/S
Re: MKV to M2TS Script
Posted: August 4th, 2009, 3:51 am
by daniel_owen_uk
Why not get a proper extender? Something like a popcornhour that wouldn't require you convert anything (plays mkv natively).
Re: MKV to M2TS Script
Posted: August 4th, 2009, 4:02 am
by ssc
Cause I want to be able to watch and record TV as well. Plus I'm tired of having two devices. I had the popcorn hour for about 3 months before I sold it. Since then I have been using an Aopen Mini PC with Xbmc (which is absolutely amazing apart from the missing TV functionality). So for now it looks like 360s (even tho they sound like jet engines =) as extenders.. until I find a good ION media center I guess. If sab can convert the MKV automatically it doesn't really bother me.. what will annoy me however is that I can't play ISO movies through MCE/360. BAH! Nothings perfect!
Re: MKV to M2TS Script
Posted: August 4th, 2009, 8:18 am
by daniel_owen_uk
You could have gone down the GBPVR route with the PCH.]
But it sounds like you have most bases covered, I just couldn't deal with the noise of the 360.
Re: MKV to M2TS Script
Posted: August 4th, 2009, 10:13 am
by johoja
ssc wrote:
Cause I want to be able to watch and record TV as well. Plus I'm tired of having two devices. I had the popcorn hour for about 3 months before I sold it. Since then I have been using an Aopen Mini PC with Xbmc (which is absolutely amazing apart from the missing TV functionality). So for now it looks like 360s (even tho they sound like jet engines =) as extenders.. until I find a good ION media center I guess. If sab can convert the MKV automatically it doesn't really bother me.. what will annoy me however is that I can't play ISO movies through MCE/360. BAH! Nothings perfect!
Sure you can, use MediaBrowser its a cool plugin for MCE (works with extenders). It will mount the *.iso. On top of that it's really good with metadata content for mkv's and tv series.
I actually stopped using this script once the DIVX MKV for W7 came out. It lets you play MKV's on the XBOX without needing to transcode it. Only for Windows 7 though.
I've been looking a this ION PC looks pretty good :
http://www.asrock.com/nettop/spec/ION%20330.asp
You can get it for about 300sh USD. Once I get this I wont use the 360 as an extender anymore probably, and just use the ION pc, with MediaBrowser it keeps watched statues synced across MCE machines.