VideoHelp Forum
+ Reply to Thread
Results 1 to 3 of 3
Thread
  1. Rancid User ron spencer's Avatar
    Join Date
    May 2005
    Location
    Ish-ka-bibble
    Search Comp PM
    I am trying to write a batch file that will convert MTS files to M2TS via tsmuxer.

    for /f %%a in ('dir /b *.mts') do (
    set batFile=".\00.bat"
    set metaFile=".\00.meta"

    set tsCommand1=MUXOPT --no-pcr-on-video-pid --new-audio-pes --vbr --vbv-len=500
    set tsCommand2=V_MPEG4/ISO/AVC
    set tsCommand3=fps=, insertSEI, contSPS, track=4113
    set tsCommand4=A_LPCM, %%a, track=4352

    echo %tsCommand1% > %metaFile%
    echo %tsCommand2%, %%a, %tsCommand3% >> %metaFile%
    echo %tsCommand4% >> %metaFile%
    )
    I am getting a syntax error on the first line...what am I missing?
    'Do I look absolutely divine and regal, and yet at the same time very pretty and rather accessible?' - Queenie
    Quote Quote  
  2. first thing before you do anything else (did not check the script, its function, not checking meta file), I'd call a function to avoid parentheses, because batch script does weird things within parentheses, shortly it loads all lines at first then executes them and some other stuff ...

    dir /b is for directories, you want filename I guess,

    Code:
    SET tsmuxer="C:\tools\tsMuxeR\tsMuxeR.exe"
    for /f %%a in ("*.mts") do call :make_ts "%%a"
    echo DONE & pause
    goto :eof
    
    
    :make_ts
    set metaFile=".\00.meta"
    set tsCommand1=MUXOPT --no-pcr-on-video-pid --new-audio-pes --vbr --vbv-len=500
    set tsCommand2=V_MPEG4/ISO/AVC
    set tsCommand3=insertSEI, contSPS, track=4113
    set tsCommand4=A_LPCM, "%~1", track=4352
    
    echo %tsCommand1% > %metaFile%
    echo %tsCommand2%, "%~1", %tsCommand3% >> %metaFile%
    echo %tsCommand4% >> %metaFile%
    %tsmuxer% "%metaFile%"  "new_%~n1.m2ts"
    goto :eof
    I remember tsMuxeR did not like quotes for output file, not sure if it is going to be a problem
    Last edited by _Al_; 20th Apr 2016 at 18:32.
    Quote Quote  
  3. Rancid User ron spencer's Avatar
    Join Date
    May 2005
    Location
    Ish-ka-bibble
    Search Comp PM
    Thanks for your post...I really appreciate it!!!

    The only this is you need the dir /b command in single quotes to pass file names properly

    for /f %%a in ('dir /b *.mts') do call :make_ts "%%a"
    thanks again!!
    'Do I look absolutely divine and regal, and yet at the same time very pretty and rather accessible?' - Queenie
    Quote Quote  



Similar Threads

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