VideoHelp Forum
+ Reply to Thread
Results 1 to 6 of 6
Thread
  1. This is a script I have for demuxing an H264 AAC MKV and normalizing the audio then remuxing it:

    for %%a in ("*.mkv") do (

    "X:\Portable Installations\MKV Toolnix\mkvextract.exe" --ui-language en tracks "%%a" 0:"%%~na.h264" 1:"%%~na.gain0"

    for %%b in ("*.gain0") do "X:\Portable Installations\ffmpeg\bin\ffmpeg.exe" -i "%%b" -vn -c:a copy -absf aac_adtstoasc "J:\Temp\gain.m4a"

    "X:\Portable Installations\AAC Gain 1.9\aacgain.exe" -r -k -m 0 "J:\Temp\gain.m4a"

    "X:\Portable Installations\ffmpeg\bin\ffmpeg.exe" -i "J:\Temp\gain.m4a" -map 0:0 -vn -c:a copy "%%~da%%~pa%%~na.aac"

    "X:\Portable Installations\MKV Toolnix\mkvmerge.exe" -o "%%~da%%~pa%%~na.AAC.mkv" "--forced-track" "0:no" "-d" "0" "-A" "-S" "-T" "--no-global-tags" "--no-chapters" "(" "%%~na.h264" ")" "--language" "0:eng" "--forced-track" "0:no" "-a" "0" "-D" "-S" "-T" "--no-global-tags" "--no-chapters" "(" "%%~da%%~pa%%~na.aac" ")" "--track-order" "0:0,1:0"

    del "*.gain0"
    del "*.h264"
    del "*.aac"
    del "J:\Temp\gain.m4a"

    )

    "X:\Daves Folder\Sounds\VideoRedo Completed Sound Short.WAV"

    pause
    Does anyone have a script to do the same as the above but for a x265 video?
    Quote Quote  
  2. The same script should work for HEVC AAC MKV if it works for H.264 AAC MKV. (mkvmerge and mkvextract will ignore the .h264 file extension and detect it's actually HEVC)
    Quote Quote  
  3. My file is only 4 GB but when I use the script on it, it seems to go an unlimited size based on however much space is left on my hard drive. It went to 83 GB for example. When I try to play back the file, it won't play. MPC-HC says it can't render the file.
    Quote Quote  
  4. I haven't actually tested the script. But I see things that could pose problems. For example the outer for loop uses parentheses. Then there are parentheses within the loop but they aren't escaped.

    In the other thread you mentioned you want FLAC output. Is this also the case for these files? If you want FLAC output anyways I could give you a much simpler script.
    Quote Quote  
  5. Member Bernix's Avatar
    Join Date
    Apr 2016
    Location
    Europe
    Search Comp PM
    if it once worked, dont know. I would change h264 to h265, even it seems like nonsense. But if it worked before (already said) why it shouldn't work now?
    Sorry to said it, sneaker is expert on scripts, i don't like them much, but as said, parenthesis worked before so should now. Why not?

    Bernix
    Quote Quote  
  6. The script is obviously copied-and-pasted from somewhere, without comprehension.
    The mkvmerge line seems completely corrupted, with all arguments wrapped in quotes.
    Parentheses are matched, but some have been inserted in the mkvmerge line that aren't needed.
    Reformatting for readability (but not attempting to run),
    Code:
    set mkvextract="X:\Portable Installations\MKV Toolnix\mkvextract.exe"
    set mkvmerge="X:\Portable Installations\MKV Toolnix\mkvmerge.exe"
    set ffmpeg="X:\Portable Installations\ffmpeg\bin\ffmpeg.exe"
    set aacgain="X:\Portable Installations\AAC Gain 1.9\aacgain.exe"
    set tempx=J:\Temp
    
    for %%a in ("*.mkv") do (
    
    %mkvextract% --ui-language en ^
        tracks "%%a" 0:"%%~na.h264" 1:"%%~na.gain0"
    
    for %%b in ("*.gain0") do ^
        %ffmpeg% -i "%%b" -vn -c:a copy ^
        -absf aac_adtstoasc "%tempx%\gain.m4a"
    
    %aacgain% -r -k -m 0 "%tempx%\gain.m4a"
    
    %ffmpeg% -i "%tempx%\gain.m4a" ^
        -map 0:0 -vn -c:a copy "%%~da%%~pa%%~na.aac"
    
    :: %mkvmerge% &
    :: 	-o "%%~da%%~pa%%~na.AAC.mkv" "--forced-track" "0:no" ^
    :: 	"-d" "0" "-A" "-S" "-T" "--no-global-tags" ^
    :: 	"--no-chapters" "(" "%%~na.h264" ")" ^
    :: 	"--language" "0:eng" "--forced-track" "0:no" "-a" "0" "-D" "-S" "-T" ^
    :: 	"--no-global-tags" "--no-chapters" "(" "%%~da%%~pa%%~na.aac" ")" ^
    :: 	"--track-order" "0:0,1:0"
    
    mkvmerge
        -o "%%~da%%~pa%%~na.AAC.mkv" --forced-track 0:no ^
        -d 0 -A -S -T --no-global-tags ^
        --no-chapters "%%~na.h264" ^
        --language 0:eng --forced-track 0:no -a 0 -D -S -T ^
        --no-global-tags --no-chapters "%%~da%%~pa%%~na.aac" ^
        --track-order 0:0,1:0
    
    del "*.gain0"
    del "*.h264"
    del "*.aac"
    del "%tempx%\gain.m4a"
    
    )
    Last edited by raffriff42; 21st Jan 2018 at 10:42. Reason: typo
    Quote Quote  



Similar Threads

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