News:

--

Main Menu

Batch audio shift.

Started by danielbb, August 18, 2013, 11:44:44 AM

Previous topic - Next topic

danielbb

I have a bunch of MP4s in a folder for which the audio is out of sync by -850 on all.

The gui works perfectly but i cant get the audio delay command to work using a bat file :( I can only get it to output a copy, ive tried soooooo may permitations lol My latest is below, and i have give up.

Quoteset avidemux="C:\Program Files (x86)\Avidemux 2.6\avidemux.exe"

for %%f in (*.mp4) do %avidemux% --load "%%f" --video-process --video-codec COPY --audio-process --audio-delay -850 --audio-codec COPY --save  "D:\output\corrected\%%f.mp4"  --quit

Can someone tell me what i am doing wrong please. Thanks.

tuxutat

#1
You don't have to use Avidemux for a task like this. FFmpeg is more reliable in producing proper output and the commandline will look similar to yours.

danielbb

Thanks, but im not starting again with another command line based app.

I have no idea why ppl in 2013 still still create software which require the use of command lines, as well as supplying crap documentation for it.

Ill do them one by one using the gui, will be faster than trying to get this to work lol.

thany

Agreed. Sort of. The commandline is fine for small tools, but huge & complicated programs need a GUI. Full stop.

If your files may become MKV, you can achieve this with mkvtoolnix, and using mmg.exe. It's a GUI for a couple of bundled tools. It can read MP4 among many other containers, but it can only write MKV.

danielbb

I figured it out from another forum post. There really needs to be better documentation. So fo anyone having the same problem follow the instructions below.

To batch shift a set of MP4 videos quickly in Copy mode.


Create a file called project.py

#PY  <- Needed to identify #
#--automatically built--

adm = Avidemux()

adm.videoCodec("copy")

adm.audioClearTracks()

adm.audioAddTrack(0)

adm.audioCodec(0, "copy");

adm.audioSetDrc(0, 0)

adm.audioSetShift(0, 1,-450)

adm.setContainer("MP4", "muxerType=0", "useAlternateMp3Tag=True")


Change -450 to the shift amount.

Create a .bat file and put it in the same folder as the above file and the video files

set avidemux="C:\Program Files (x86)\Avidemux 2.6\avidemux.exe"

%avidemux%

for %%f in (*.mp4) do %avidemux% --force-alt-h264 --load "%%f" --run project.py --save "D:\output\corrected\%%f.mp4" --quit


Change D:\output\corrected\ to the folder where you want them saved to.

Now run the .bat file. Close the first instance of avidmux that pops up. Then the process will start.