Home > front end >  How can use .bat file or should I use other automation for this?
How can use .bat file or should I use other automation for this?

Time:06-09

I have mp4 files that I want to run an ffmpeg command on, where the command is formatted like this:

ffmpeg -i "video.mp4" -filter_complex "[0:v]setpts=0.8*PTS[v];[0:a]atempo=1.25[a] " -map "[v]" -map "[a]" faster.mp4

How can I either define a function or something to make this simpler, for example in Python logic I would've done something like this

def speed_up(ogvideo, newvidname):
     ffmpeg -i ogvideo -filter_complex "[0:v]setpts=0.8*PTS[v];[0:a]atempo=1.25[a] " -map "[v]" -map "[a]" newvidname

Can I do this with a .bat file to then drag and drop videos onto it? Can i define a command in my CMD interface so I can just type:

speed_up(video.mp4, newvid.mp4)

Any ideas are welcome Thanks

CodePudding user response:

Create a bat file named converter.bat and put it in the same folder where you have your video.

Notice I have changed the input and output filenames with %1 and %2 wich refer to the first and second parameters passed to the bat file.

Content of converter.bat

ffmpeg -i %1 -filter_complex "[0:v]setpts=0.8*PTS[v];[0:a]atempo=1.25[a] " -map "[v]" -map "[a]" %2

Then from the console call it with:

./converter.bat video.mp4 faster.mp4
  • Related