-3

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

Marcin Orlowski
  • 72,056
  • 11
  • 123
  • 141
Bigman
  • 3
  • 2
  • yes, for a bat file with parameters take a look at https://stackoverflow.com/questions/26551/how-can-i-pass-arguments-to-a-batch-file you can basically access the first and second parameter with `%1` and `%2`, then you call it like `./myBatchFile.bat Parameter1 Parameter2` from the console –  Jun 09 '22 at 11:15

1 Answers1

0

Create a batch 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 which 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
Mofi
  • 46,139
  • 17
  • 80
  • 143