I understood the instructions, I just didn't know what serial meant. When the script is run nothing happens.
+ Reply to Thread
Results 121 to 150 of 199
-
-
I'm sure it works. I just tested it (again). Make sure you have the paths correct. Make sure the .bat is in the same directory as the folder of mkv's. Note the "%" are double "%%"
I copied your original test file and renamed it "a.mkv", made a copy of that file : "b.mkv"
After the batch file, you're left with your orignal files a.mkv, b.mkv ; plus a.aac, a.AC3.mkv, b.aac, b.AC3.mkv
Unless this is a different batch of h.264/aac/mkv's ? maybe those ones have problems ? -
What's the purpose of those percentage signs. Am I supposed to put the directory the files are in? Or do I just put that in ("*.mkv")? Do I leave the asterisk?
-
-
OK I ran the exact script you gave me again the same way as before by double-clicking on it when it's in a directory of MKVs. The script fails saying no such file or directory with regards to .m4a I think.
-
Then set a specific path for your temp files
Code:for %%a in ("*.mkv") do ( "X:\Portable Installations\ffmpeg\bin\ffmpeg.exe" -i %%a -map 0:0 -map 0:1 -c:v copy -bsf:v h264_mp4toannexb -an "PATH\video.h264" -vn -c:a copy -absf aac_adtstoasc "PATH\gain.m4a" "X:\Portable Installations\AAC Gain 1.9\aacgain" -r -k -m 0 "PATH\gain.m4a" "X:\Portable Installations\ffmpeg\bin\ffmpeg.exe" -i "PATH\gain.m4a" -map 0:0 -vn -c:a copy "%%~da%%~pa%%~na.aac" -map 0:0 -vn -c:a ac3 -b:a 128k "PATH\output.ac3" "X:\Portable Installations\MKV Toolnix\mkvmerge.exe" -o "%%~da%%~pa%%~na.AC3.mkv" "--forced-track" "0:no" "-d" "0" "-A" "-S" "-T" "--no-global-tags" "--no-chapters" "(" "PATH\video.h264" ")" "--language" "0:eng" "--forced-track" "0:no" "-a" "0" "-D" "-S" "-T" "--no-global-tags" "--no-chapters" "(" "PATH\output.ac3" ")" "--track-order" "0:0,1:0" del "PATH\gain.m4a" del "PATH\video.h264" del "PATH\output.ac3" ) "X:\Daves Folder\Sounds\VideoRedo Completed Sound Short.WAV" pause
You should actually do all that in the beginning of the script (setting all your variables and paths, temp folders), so you only have to do it once. It keeps scripts better organized, important for when you do more complex scripts later
Or Is this a different set of MKV's ? Maybe they have problems ? -
OK tried the script and I added the path but got the same thing as before. The script fails and says no such file or directory:
Code:for %%a in ("*.mkv") do ( "X:\Portable Installations\ffmpeg\bin\ffmpeg.exe" -i %%a -map 0:0 -map 0:1 -c:v copy -bsf:v h264_mp4toannexb -an "E:\2 = New\Temp\video.h264" -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 gain.m4a -map 0:0 -vn -c:a copy "%%~da%%~pa%%~na.aac" -map 0:0 -vn -c:a ac3 -b:a 128k "output.ac3" "X:\Portable Installations\MKV Toolnix\mkvmerge.exe" -o "%%~da%%~pa%%~na.AC3.mkv" "--forced-track" "0:no" "-d" "0" "-A" "-S" "-T" "--no-global-tags" "--no-chapters" "(" "E:\2 = New\Temp\video.h264" ")" "--language" "0:eng" "--forced-track" "0:no" "-a" "0" "-D" "-S" "-T" "--no-global-tags" "--no-chapters" "(" "E:\2 = New\Temp\output.ac3" ")" "--track-order" "0:0,1:0" 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
-
Post the exact error message verbatim
You shouldn't need to add those paths for the temp files, because the way the script was, it would use the same directory as the video files (everything, temp files included will occur in the mkv folder directory)
Are you sure the .bat file is in the same directory ?
I tested on your original sample mkv, are you using different files? - perhaps they have different characteristics? -
http://pastebin.com/FuhsciHV
Tested on two copies of the following MKV with AAC file: https://www.dropbox.com/s/29oab5n5s9b12n0/2%20Test.mkv
Yes the MKV and batch file are in the same directory. I just double-click on the batch file and it fails giving the above error message. Tried it with temp paths as well and the same thing happened. -
Notice your input has "-i %a" , not "-i %%a"
Also, because you have spaces in your filenames it needs quotation marks. So the 1st line should be this
"X:\Portable Installations\ffmpeg\bin\ffmpeg.exe" -i "%%a" -map 0:0 -map 0:1 -c:v copy -bsf:v h264_mp4toannexb -an "E:\2 = New\Temp\video.h264" -vn -c:a copy -absf aac_adtstoasc "E:\2 = New\Temp\gain.m4a"
-
Adjusted the 2nd line in my script like this but the script still fails: "X:\Portable Installations\ffmpeg\bin\ffmpeg.exe" -i "%%a"
Here's the CMD output: http://pastebin.com/M4uQNJEn -
Either use the 1st version of original script, without the extra paths or add the path that you're missing to the 2nd ffmpeg line . Check the template on post 126 again. You're missing the "PATH" for the input file on the 2nd ffmpeg line
"X:\Portable Installations\ffmpeg\bin\ffmpeg.exe" -i gain.m4a
Notice "gain.m4a" doesn't have the same path you specified earlier , so ffmpeg can't find it
-i "E:\2 = New\Temp\gain.m4a"
You're also missing the path for output.ac3
If you omit all those inserted "PATH" from the 2nd version in post 126, they will just use the same directory as the temp file -
Thanks it's working now. Here's the working batch script:
Code:for %%a in ("*.mkv") do ( "X:\Portable Installations\ffmpeg\bin\ffmpeg.exe" -i "%%a" -map 0:0 -map 0:1 -c:v copy -bsf:v h264_mp4toannexb -an "E:\2 = New\Temp\video.h264" -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" "X:\Portable Installations\MKV Toolnix\mkvmerge.exe" -o "%%~da%%~pa%%~na.AC3.mkv" "--forced-track" "0:no" "-d" "0" "-A" "-S" "-T" "--no-global-tags" "--no-chapters" "(" "E:\2 = New\Temp\video.h264" ")" "--language" "0:eng" "--forced-track" "0:no" "-a" "0" "-D" "-S" "-T" "--no-global-tags" "--no-chapters" "(" "E:\2 = New\Temp\output.ac3" ")" "--track-order" "0:0,1:0" 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
What script should I use for the Batch script above but with MKV Extract? -
Not sure, it probably slows it down
To use mkvextract , you do it the same way, but instead of the 1st ffmpeg line, use mkvextract
Code:"PATH\mkvextract.exe" --ui-language en tracks "%%a" 0:"PATH\video.h264" 1:"PATH\gain.m4a"
Or you can use eac3to like you did before -
Thanks that's working too.
What about for the script you gave me to right-click a file and select "Sent To" the script?
Here's the first line at the moment:
"X:\Portable Installations\ffmpeg\bin\ffmpeg.exe" -i %1 -map 0:0 -map 0:1 -c:v copy -bsf:v h264_mp4toannexb -an "video.h264" -vn -c:a copy -absf aac_adtstoasc "gain.m4a"
What would it be instead if I wanted to use mkvextract? -
Use the same mvkextract command, but change the %%a to %1
Code:"PATH\mkvextract.exe" --ui-language en tracks %1 0:"PATH\video.h264" 1:"PATH\gain.m4a"
-
Here's the MKVExtract script that I just run manually one at a time (Not the batch script):
Code:"X:\Portable Installations\MKV Toolnix\mkvextract.exe" --ui-language en tracks %1 0:"video.h264" 1:"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 video.h264 del output.ac3 "X:\Daves Folder\Sounds\VideoRedo Completed Sound Short.WAV" pause
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\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" "X:\Portable Installations\MKV Toolnix\mkvmerge.exe" -o "%%~da%%~pa%%~na.AC3.mkv" "--forced-track" "0:no" "-d" "0" "-A" "-S" "-T" "--no-global-tags" "--no-chapters" "(" "E:\2 = New\Temp\video.h264" ")" "--language" "0:eng" "--forced-track" "0:no" "-a" "0" "-D" "-S" "-T" "--no-global-tags" "--no-chapters" "(" "E:\2 = New\Temp\output.ac3" ")" "--track-order" "0:0,1:0" 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
-
You need to fix the header with ffmpeg, -absf aac_adtstoasc similar to the ffmpeg example. Because mkvextract extracts raw AAC with ADTS headers before each packet. AACgain cannot process it like that
So it's another step, slower. I colored in red what was added/changed
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 gain0.m4a del gain.m4a del video.h264 del output.ac3 "X:\Daves Folder\Sounds\VideoRedo Completed Sound Short.WAV" pause
-
Bonus! The mkvextract method is actually 20 seconds quicker than the FFMPEG method! Just wondering, why are 2 m4a files created in the mkvextract script?
Should I add the same red text to the batch script version that processes all files in a folder? -
Maybe it's slower because of those error messages? 2 m4a files are required, because ffmpeg doesn't allow in-place editing of files. (it can't read from a file and write to the same file at the same time).
Should I add the same red text to the batch script version that processes all files in a folder?Last edited by poisondeathray; 8th Aug 2014 at 15:09.
-
You gave me a script to mux an MPEG2 with MPA to MPEG2 with AC3 (AC3 is re-encoded) and to demux the MPA source. I'm trying to change it so that it does the same thing but so it works with an AAC source and normalizes it. I tried this script I made but it only gives me an a demuxed AAC and no MPEG2 file. Do you know how to fix it please?
Code:"X:\Portable Installations\ffmpeg\bin\ffmpeg.exe" -i %1 -map 0:0 -map 0:1 -map 0:1 -c:v copy -an "copy.m2v" -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\MJPEG Tools\bin\mplex.exe" -o "%~d1%~p1%~n1.AC3.mpg" "copy.m2v" "128kbps_ac3.ac3" -f 3 del "copy.m2v" del "128kbps_ac3.ac3" "X:\Daves Folder\Sounds\VideoRedo Completed Sound Short.WAV" pause
-
Notice in the 3rd line, it's called "output.ac3" , but in the 4th line it's called "128kbps_ac3.ac3" . The muxer in line 4 is looking for ""128kbps_ac3.ac3" but can't find it. Change them so they are matching . eg.. change "output.ac3" in the 3rd line to "128kbps_ac3.ac3"
In the 1st line, you only need as many map statements, as you have output audio & video streams. So if you only have 1 video, 1 audio for output, you only need -map 0:0 (for video), and -map 0:1 (for audio) -
OK I'm trying this Batch script for Muxing TS to TS but re-encode audio to AC3 and demux AAC source. It's not working. Any idea what I did wrong?
Code:for %%a in ("*.ts") do ( "X:\Portable Installations\eac3to\eac3to.exe" %1 1:"E:\2 = New\Temp\video.h264" "X:\Portable Installations\FFMPEG\bin\ffmpeg.exe" -i %1 -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" "X:\Portable Installations\MKV Toolnix\mkvmerge.exe" -o "%%~da%%~pa%%~na.AC3.mkv" "--forced-track" "0:no" "-d" "0" "-A" "-S" "-T" "--no-global-tags" "--no-chapters" "(" "E:\2 = New\Temp\video.h264" ")" "--language" "0:eng" "--forced-track" "0:no" "-a" "0" "-D" "-S" "-T" "--no-global-tags" "--no-chapters" "(" "E:\2 = New\Temp\output.ac3" ")" "--track-order" "0:0,1:0" 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
-
Use the old template for batch. You've got to change all the inputs which say %1 to something else (hint : "%%a")
-
I tried that but it didn't work. Here's my MKV Batch script:
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" "X:\Portable Installations\MKV Toolnix\mkvmerge.exe" -o "%%~da%%~pa%%~na.AC3.mkv" "--forced-track" "0:no" "-d" "0" "-A" "-S" "-T" "--no-global-tags" "--no-chapters" "(" "E:\2 = New\Temp\video.h264" ")" "--language" "0:eng" "--forced-track" "0:no" "-a" "0" "-D" "-S" "-T" "--no-global-tags" "--no-chapters" "(" "E:\2 = New\Temp\output.ac3" ")" "--track-order" "0:0,1:0" 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
"X:\Portable Installations\eac3to\eac3to.exe" %%a 1:"E:\2 = New\Temp\video.h264"
I tried adding that but it didn't work. Any idea what the batch script should be for TS AAC to MKV but re-encode to AC3 and demux AAC?
MPEG2 Script
This script is MPEG2 AAC to MPEG2 AC3 128 + Demux AAC. However I've just realised that VideoRedo doesn't allow converting from AC3/WAV to AAC so I have to manually demux it then convert the file with DBPoweramp to AAC then remux before using below script which is time consuming. What should I add to the script so that before the below script runs the script will first convert AC3/MP2 to AAC?
Code:"X:\Portable Installations\ffmpeg\bin\ffmpeg.exe" -i %1 -map 0:0 -map 0:1 -c:v copy -an "copy.m2v" -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 "128kbps_ac3.ac3" "X:\Portable Installations\MJPEG Tools\bin\mplex.exe" -o "%~d1%~p1%~n1.AC3.mpg" "copy.m2v" "128kbps_ac3.ac3" -f 3 del "copy.m2v" del "128kbps_ac3.ac3" del "gain.m4a" "X:\Daves Folder\Sounds\VideoRedo Completed Sound Short.WAV" pause
-
1) If it's failing on the 1st line with mkvextract, use ffmpeg to extract from the TS instead (both audio & video) . Use one of the earlier examples as a template. I'm guessing you'll get those same errors but it will still work fine. Post the log file if you don't know where the problem is. If you can't figure it out after making some honest attempts, ask again
2)
What should I add to the script so that before the below script runs the script will first convert AC3/MP2 to AAC?
I don't understand how videoredo fits , and what you're trying to do ? You have a separate AC3 or MP2 file that you are trying to convert to AC3 before that conversion ? -
This works for me. You have to edit the paths. If you're using a different batch of .ts files with different characteristics than your earlier examples, then post a sample
Code:for %%a in ("*.ts") do ( eac3to "%%a" 1:"video.h264" ffmpeg -i "%%a" -vn -c:a copy -absf aac_adtstoasc "gain.m4a" aacgain -r -k -m 0 "gain.m4a" ffmpeg -i "gain.m4a" -map 0:0 -map 0:0 -vn -c:a copy "%%~da%%~pa%%~na.aac" -vn -c:a ac3 -b:a 128k "output.ac3" mkvmerge -o "%%~da%%~pa%%~na.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 "video.h264" del "output.ac3" ) pause