Ffmpeg script

I have been going through the manual but just can't seem to get my head around scripts. What I'm wanting to do is select an *.mkv file, click a button, and have the audio converted within the file, from DTS to AC3 using the following command:

ffmpeg -i input.mkv -c:v copy -c:a ac3 -b:a 640k output.mkv

Obviously, I need the "input.mp4" and "output.mp4" to be the name of the file I'm selecting. Is this possible using Opus's scripting features?

Edit: the last sentence should read "input.mkv" and "output.mkv". I tried to edit my post but there seems to be no such option.

You can do that using simple commands. Scripting (as in VBScript or JScript) would be overkill.

{filepath} is probably what you want. (I'd be surprised if ffmpeg lets you send the output to the same file as the input, though.)

gpsoft.com.au/help/opus11/in ... enames.htm

Thanks Leo. I'll take a look and report back should I get stuck. In fact, I'll report back either way.

My post was perhaps worded a tad clumsily. A new mkv file will of course be created containing the converted AC3 audio.

I'm having a little trouble getting the output file to land in the right place. I'm wanting the mkv files with the converted audio to end up on my Desktop. Here's what I have so far:

C:\Windows\System32\ffmpeg -i {filepath} -c:v copy -c:a ac3 -b:a 640k

I'm not sure what command needs to go after "640k".

Maybe {alias|desktopdir}{file} if you want the same filename but in the desktop folder.

Thanks Leo, I'll give it a go in the morning.

That worked an absolute treat - thanks very much! :smiley:

So what did you eventually use TheSeeker?
I'm trying to make a button that extracts audio from video file using ffmpeg myself, but my scripting skill is nonexistent :frowning: