VideoHelp Forum
+ Reply to Thread
Page 1 of 2
1 2 LastLast
Results 1 to 30 of 32
Thread
  1. Below is my existing script which uses MKVMerge to remux the AC3 and h264 as shown in the underlined section below to an MKV.

    Could you please tell me what script I should use to use TSMuxer to Mux to TS instead?

    Code:
    "X:\Portable Installations\MKV Toolnix\mkvextract.exe"  --ui-language en tracks %1 0:"video.h264" 1:"gain0.m4a"
    
    "X:\Portable Installations\ffmpeg\bin\ffmpeg.exe" -i "gain0.m4a" -vn -c:a copy -absf aac_adtstoasc "gain.m4a"
    
    "X:\Portable Installations\AAC Gain 1.9\aacgain" -r -k -m 0 gain.m4a
    
    "X:\Portable Installations\ffmpeg\bin\ffmpeg.exe" -i gain.m4a -map 0:0 -vn -c:a copy "%~d1%~p1%~n1.aac" -map 0:0 -vn -c:a ac3 -b:a 128k "output.ac3"
    
    "X:\Portable Installations\MKV Toolnix\mkvmerge.exe" -o "%~d1%~p1%~n1.AC3.mkv" "--forced-track" "0:no" "-d" "0" "-A" "-S" "-T" "--no-global-tags" "--no-chapters" "(" "video.h264" ")" "--language" "0:eng" "--forced-track" "0:no" "-a" "0" "-D" "-S" "-T" "--no-global-tags" "--no-chapters" "(" "output.ac3" ")" "--track-order" "0:0,1:0"
    
    del gain.m4a
    del gain0.m4a
    del video.h264
    del output.ac3
    
    "X:\Daves Folder\Sounds\VideoRedo Completed Sound Short.WAV"
    
    pause
    Last edited by VideoFanatic; 3rd Oct 2014 at 17:56.
    Quote Quote  
  2. tsmuxer needs meta file first to do its thing,
    Code:
    SET tsmuxer="C:\.... SET YOUR PATH TO TSMUXER   ... \tsMuxeR.exe"
    echo MUXOPT --no-pcr-on-video-pid --vbr  --vbv-len=500         > remux.meta       
    echo V_MPEG4/ISO/AVC, "video.h264", insertSEI, contSPS        >> remux.meta   
    echo A_AC3, "output.ac3"                                      >> remux.meta
    %tsmuxer% remux.meta out.ts
    DEL /Q remux.meta
    Quote Quote  
  3. Thanks mate it works perfectly. Just one thing, it outputs a file called "out.ts". Is there any way to have it output "Original Filename.AC3.ts"?
    Quote Quote  
  4. out.ts replace with "%~n1.AC3.ts" or better "%~d1%~p1%~n1.AC3.ts" if batch program is not "active" in the directory you want to store that TS, most probably your case, because batch script has "active" directory of dropped file, not where that batch script is
    or you can use :
    "E:\my output folder\%~n1.AC3.ts" to get specifically output files there, like even to extra hardisk, where it can speed up muxing, but that directory has to exist

    use those quotation marks, because without them it would not work if there is a space somewhere along the path or name

    in the first line you used %1, that is your input filename that could be expanded to drive letter %~d1, path %~p1, name %~n1 and extension %~x1, it could be dropped file or just name variable if this part of your script is called by some function (perhaps not your case)

    note %1 is exactly the same as %~d1%~p1%~n1%~x1 or %~f1 , except %1 would automatically add quotes by batch program if space character is present
    more
    Last edited by _Al_; 4th Oct 2014 at 09:15.
    Quote Quote  
  5. Member
    Join Date
    Sep 2012
    Location
    Australia
    Search Comp PM
    "%~dpn1.AC3.ts"

    ???????
    Quote Quote  
  6. yes I wanted to stress that expanding part, like

    Code:
    E:\special directory\%~n1%~x1
    or to create those temp files
    Code:
    "%temp_folder%\%~n1.gain.m4a"
    if temp_folder could be defined first and all those temp files
    Code:
    SET temp_folder=H:\temp_folder
    if not exist %temp_folder% MD %temp_folder%
    extra hardisk can be used, not SSD or system disk, using all hardisk one has in a PC in process might be beneficial,
    and then just delete temp_folder instead of deleting all files separately
    RMDIR "%temp_folder%" /S /Q
    Last edited by _Al_; 4th Oct 2014 at 10:05.
    Quote Quote  
  7. OK your script works for Right-clicking a file and choosing Send To.

    I'd also like to do the following: I have a folder of files and I want to double-click on the batch file and then it does the same as before, one file at a time. I've got most of the script done but I'm not sure what to do for the TSMuxer part:
    Code:
    for %%a in ("*.mkv") do (
    
    "X:\Portable Installations\MKV Toolnix\mkvextract.exe" --ui-language en tracks "%%a" 0:"E:\2 = New\Temp\video.h264" 1:"E:\2 = New\Temp\gain0.m4a"
    
    "X:\Portable Installations\ffmpeg\bin\ffmpeg.exe" -i "E:\2 = New\Temp\gain0.m4a" -vn -c:a copy -absf aac_adtstoasc "E:\2 = New\Temp\gain.m4a"
    
    "X:\Portable Installations\AAC Gain 1.9\aacgain.exe" -r -k -m 0 "E:\2 = New\Temp\gain.m4a"
    
    "X:\Portable Installations\ffmpeg\bin\ffmpeg.exe" -i "E:\2 = New\Temp\gain.m4a" -map 0:0 -vn -c:a copy "%%~da%%~pa%%~na.aac" -map 0:0 -vn -c:a ac3 -b:a 128k "E:\2 = New\Temp\output.ac3"
    
    SET tsmuxer="X:\Portable Installations\tsMuxeR_1.10.6\tsMuxeR.exe"
    echo MUXOPT --no-pcr-on-video-pid --vbr  --vbv-len=500         > remux.meta       
    echo V_MPEG4/ISO/AVC, "video.h264", insertSEI, contSPS        >> remux.meta   
    echo A_AC3, "output.ac3"                                      >> remux.meta
    %tsmuxer% remux.meta "%%~da%%~pa%%~na.AC3.ts"
    DEL /Q remux.meta
    
    del "E:\2 = New\Temp\gain0.m4a"
    del "E:\2 = New\Temp\gain.m4a"
    del "E:\2 = New\Temp\video.h264"
    del "E:\2 = New\Temp\output.ac3"
    
    )
    
    "X:\Daves Folder\Sounds\VideoRedo Completed Sound Short.WAV"
    
    pause
    Quote Quote  
  8. I'd just make it look cleaner somehow, then I'd call subroutine that makes TS, it makes things look easier, and more flexible if scripts get even more complicated. That subroutine passes always when it is called, %%a, that is actually video name and extension, that %%a variable always becomes %1 variable in that calling subroutine. I did not test it for syntax errors, hopefully it works.

    Code:
    @echo off
    SET tsmuxer="X:\Portable Installations\tsMuxeR_1.10.6\tsMuxeR.exe"
    SET mkvextract="X:\Portable Installations\MKV Toolnix\mkvextract.exe"
    SET ffmpeg="X:\Portable Installations\ffmpeg\bin\ffmpeg.exe"
    SET aacgain="X:\Portable Installations\AAC Gain 1.9\aacgain.exe"
    SET temp_folder=E:\2 = New\Temp
    SET destination=E:\2 = New\TS
    if not exist %temp_folder% MD %temp_folder%
    if not exist %destination% MD %destination%
    
    
    for %%a in ("*.mkv") do (call :MAKE_TS %%a)
    RMDIR "%temp_folder%" /S /Q
    "X:\Daves Folder\Sounds\VideoRedo Completed Sound Short.WAV"
    pause 
    exit
    
    
    :MAKE_TS
    %mkvextract% --ui-language en tracks %1 0:"%temp_folder%\%~n1.h264" 1:"%temp_folder%\%~n1.gain0.m4a"
    %ffmpeg% -i "%temp_folder%\%~n1.gain0.m4a" -vn -c:a copy -absf aac_adtstoasc "%temp_folder%\%~n1.gain.m4a"
    %aacgain% -r -k -m 0 "%temp_folder%\%~n1.gain.m4a"
    %ffmpeg% -i "%temp_folder%\%~n1.gain.m4a" -map 0:0 -vn -c:a copy "%destination%\%~n1.aac" -map 0:0 -vn -c:a ac3 -b:a 128k "%temp_folder%\%~n1.ac3"
    
    echo MUXOPT --no-pcr-on-video-pid --vbr  --vbv-len=500                       > "%temp_folder%\remux.meta"       
    echo V_MPEG4/ISO/AVC, "%temp_folder%\%~n1.h264", insertSEI, contSPS        >> "%temp_folder%\remux.meta"   
    echo A_AC3, "%temp_folder%\%~n1.ac3"                                        >> "%temp_folder%\remux.meta"
    
    %tsmuxer% "%temp_folder%\remux.meta" "destination%\%~n1.AC3.ts"
    
    goto :eof
    Last edited by _Al_; 4th Oct 2014 at 13:47.
    Quote Quote  
  9. Tried that but the script fails saying this: https://docs.google.com/document/d/1OlFuehIssbrsiP3LltOs9JkehR5I7o43LyHAMulxGhc/edit

    Appreciate what you're trying to do but that seems way more complicated than what it was! I'm familiar with the old script. Could you possible give me a batch file using the old script but fix the TSmuxer part please?
    Quote Quote  
  10. copy the script again, you were too quick ...
    Quote Quote  
  11. Same thing but different result: https://docs.google.com/document/d/1OlFuehIssbrsiP3LltOs9JkehR5I7o43LyHAMulxGhc/edit

    Could you please use the old script in post 7 as I understand that and I'm familiar with it. But could you change the TSMuxer part please.
    Quote Quote  
  12. Originally Posted by VideoFanatic View Post
    using the old script but fix the TSmuxer part please?
    you can write the whole paths in that remux.meta file
    Code:
     for %%a in ("*.mkv") do (
    
    "X:\Portable Installations\MKV Toolnix\mkvextract.exe" --ui-language en tracks "%%a" 0:"E:\2 = New\Temp\video.h264" 1:"E:\2 = New\Temp\gain0.m4a"
    
    "X:\Portable Installations\ffmpeg\bin\ffmpeg.exe" -i "E:\2 = New\Temp\gain0.m4a" -vn -c:a copy -absf aac_adtstoasc "E:\2 = New\Temp\gain.m4a"
    
    "X:\Portable Installations\AAC Gain 1.9\aacgain.exe" -r -k -m 0 "E:\2 = New\Temp\gain.m4a"
    
    "X:\Portable Installations\ffmpeg\bin\ffmpeg.exe" -i "E:\2 = New\Temp\gain.m4a" -map 0:0 -vn -c:a copy "%%~da%%~pa%%~na.aac" -map 0:0 -vn -c:a ac3 -b:a 128k "E:\2 = New\Temp\output.ac3"
    
    SET tsmuxer="X:\Portable Installations\tsMuxeR_1.10.6\tsMuxeR.exe"
    echo MUXOPT --no-pcr-on-video-pid --vbr  --vbv-len=500                   > remux.meta       
    echo V_MPEG4/ISO/AVC, "E:\2 = New\Temp\video.h264", insertSEI, contSPS        >> remux.meta   
    echo A_AC3, "E:\2 = New\Temp\output.ac3"                                      >> remux.meta
    %tsmuxer% remux.meta "%%~da%%~pa%%~na.AC3.ts"
    DEL /Q remux.meta
    
    del "E:\2 = New\Temp\gain0.m4a"
    del "E:\2 = New\Temp\gain.m4a"
    del "E:\2 = New\Temp\video.h264"
    del "E:\2 = New\Temp\output.ac3"
    
    )
    
    "X:\Daves Folder\Sounds\VideoRedo Completed Sound Short.WAV"
    
    pause
    Quote Quote  
  13. What do you mean? That file doesn't exist until the script is run.
    Quote Quote  
  14. Originally Posted by VideoFanatic View Post
    What do you mean? That file doesn't exist until the script is run.
    yes, in that last script that i posted in post #12 , that script of yours, I just changed filenames, while meta file is being created each time, to include their full paths, I just modified these lines from your script to this:
    Code:
    echo V_MPEG4/ISO/AVC, "E:\2 = New\Temp\video.h264", insertSEI, contSPS        >> remux.meta   
    echo A_AC3, "E:\2 = New\Temp\output.ac3"                                      >> remux.meta
    It still doesn't work?
    Quote Quote  
  15. Tried your script from post 12. No it doesn't work. It doesn't give any error messages. The only file I get is the demuxed AAC.
    Quote Quote  
  16. so after running script ,this file "E:\2 = New\Temp\gain0.m4a" exists and following in the process that should be created "E:\2 = New\Temp\gain.m4a" does not?
    Why do you name folders like that, I'd avoid "=" character if I could. Not saying this is a problem, just a start.
    Quote Quote  
  17. I name folders like that so I can get them to appear at the top of the folder (alphabetical order). I ran your script and I get a demuxed AAC file but no TS file.

    All these files are created in the Temp directory.

    gain.m4a
    gain0.m4a
    output.ac3
    video.h264
    Quote Quote  
  18. CAN you just delete that = and try it? It takes you like 1 minute to test it, maybe tsmuxer does not like it. That is what troubleshooting is, small steps ...

    edit: I just checked, tsmuxer does not like spaces in filename, what do you know, so get those spaces out of directory names,
    if you try to list something on the top , use "_" character like _2_new, and it will be listed on top
    Last edited by _Al_; 4th Oct 2014 at 20:45.
    Quote Quote  
  19. Did that and got the same as before. Didn't really notice before but as the script runs a window says "Windows can't open this file: remux.meta". What do you want to do? Use the web service to find the correct program. OR Select a program from the list of installed programs. I just cancelled it and got the same result as before.
    Quote Quote  
  20. try to put remux.meta into temp folder as well, replacing all:
    remux.meta
    with
    "E:\2 = New\Temp\remux.meta"

    .. but no spaces in those directories, whatever you had change it to
    Quote Quote  
  21. Member
    Join Date
    Sep 2012
    Location
    Australia
    Search Comp PM
    It's been so long since I wrote my TSMuxer batch that I don't really know the details but
    Code:
    echo MUXOPT --no-pcr-on-video-pid --new-audio-pes --vbr  --vbv-len=500>%MetFile%
    	if NOT "%VDTrack%%VDCodec%"=="" echo %VDCodec%, "%FullName%", fps=%VDFPS%, track=%VDTrack%, lang=eng>>%MetFile%
    	if NOT "%AUTrack%%AUCodec%"=="" echo %AUCodec%, "%FullName%", track=%AUTrack%, lang=eng>>%MetFile%
    Makes a script that looks something like this:

    Code:
    MUXOPT --no-pcr-on-video-pid --new-audio-pes --vbr  --vbv-len=500
    V_MS/VFW/WVC1, "D:\Make\DW.mkv", fps=25.000, track=1, lang=eng
    A_DTS, "D:\Make\DW.mkv", track=2, lang=eng
    And it handles spaces fine (in fact I've never had it fail on a file yet).
    Quote Quote  
  22. Tried this and replaced the lines you said but it's still asking me what to do with the remux.meta file.

    Code:
    for %%a in ("*.mkv") do (
    
    "X:\Portable Installations\MKV Toolnix\mkvextract.exe" --ui-language en tracks "%%a" 0:"E:\video.h264" 1:"E:\gain0.m4a"
    
    "X:\Portable Installations\ffmpeg\bin\ffmpeg.exe" -i "E:\gain0.m4a" -vn -c:a copy -absf aac_adtstoasc "E:\gain.m4a"
    
    "X:\Portable Installations\AAC Gain 1.9\aacgain.exe" -r -k -m 0 "E:\gain.m4a"
    
    "X:\Portable Installations\ffmpeg\bin\ffmpeg.exe" -i "E:\gain.m4a" -map 0:0 -vn -c:a copy "%%~da%%~pa%%~na.aac" -map 0:0 -vn -c:a ac3 -b:a 128k "E:\output.ac3"
    
    SET tsmuxer="X:\Portable Installations\tsMuxeR_1.10.6\tsMuxeR.exe"
    echo MUXOPT --no-pcr-on-video-pid --vbr  --vbv-len=500                   > E:\remux.meta     
    echo V_MPEG4/ISO/AVC, "E:\video.h264", insertSEI, contSPS        >> E:\remux.meta 
    echo A_AC3, "E:\output.ac3"                                      >> E:\remux.meta
    %tsmuxer% E:\remux.meta "%%~da%%~pa%%~na.AC3.ts"
    DEL /Q E:\remux.meta
    
    gain.m4a
    gain0.m4a
    output.ac3
    video.h264
    
    )
    
    "X:\Daves Folder\Sounds\VideoRedo Completed Sound Short.WAV"
    
    pause
    Quote Quote  
  23. ndjamena tried your script but nothing happens when I run it. I added the SET tsmuxer="X:\Portable Installations\tsMuxeR_1.10.6\tsMuxeR.exe" line before it as well. Everything else in the script is the same as the above apart from the TSmuxer stuff.
    Quote Quote  
  24. So remux.meta is not even created, not a single line in it? If exists, try to open it with notepad, what lines are in it?
    Or some association problem in your windows? Not sure. Replace E:\remux.meta with E:\temp.txt and just before actual muxing include line:
    REN E:\remux.txt remux.meta
    Quote Quote  
  25. When I run the script and the window pops up asking what to do with the file, I chose to Open in Notepad. This is what's inside the file:

    MUXOPT --no-pcr-on-video-pid --vbr --vbv-len=500
    V_MPEG4/ISO/AVC, "E:\video.h264", insertSEI, contSPS
    A_AC3, "E:\output.ac3"
    Quote Quote  
  26. Member
    Join Date
    Sep 2012
    Location
    Australia
    Search Comp PM
    Of course not, that was only a part of my script... every time someone accuses the cat guy of overcomplicating his batch scripts I think about my batch folder and feel a little guilty.

    All my scripts are based around the MediaInfo interface program I wrote though and wouldn't be much use to anyone else.

    It's just for comparison.
    Quote Quote  
  27. ok remux.meta is alright, it seems your batch script has no idea what %tsmuxer% variable is, and windows is trying to actually open remux.meta then,...,is tsmuxer path actually correct or it is in you PC on that address?

    SET tsmuxer="X:\Portable Installations\tsMuxeR_1.10.6\tsMuxeR.exe"

    edit: you seem to have old version as well, I have 2.6.11, last one is 2.6.12, you use some very old version, download from here
    Last edited by _Al_; 4th Oct 2014 at 21:46.
    Quote Quote  
  28. Any idea what part of this is wrong then? Yes the location in the first line is correct.

    Code:
    SET tsmuxer="X:\Portable Installations\tsMuxeR_1.10.6\tsMuxeR.exe"
    echo MUXOPT --no-pcr-on-video-pid --vbr  --vbv-len=500                   > E:\remux.meta     
    echo V_MPEG4/ISO/AVC, "E:\video.h264", insertSEI, contSPS        >> E:\remux.meta 
    echo A_AC3, "E:\output.ac3"                                      >> E:\remux.meta
    %tsmuxer% E:\remux.meta "%%~da%%~pa%%~na.AC3.ts"
    DEL /Q E:\remux.meta
    Quote Quote  
  29. script works, it is something with tsmuxer or wrong path, I'd download latest version first, see my edited post above
    Quote Quote  
  30. Tried the download you said. No difference. Window still pops up asking me what to do with the file.
    Quote Quote  
Visit our sponsor! Try DVDFab and backup Blu-rays!