0

I am running the following script

ffmpeg -i $Args[0] -vcodec copy -acodec copy -movflags +faststart $Args[1]

Which essentially is overwriting the original file, how can I force this to override so my powershell script doesn't error out?

File './cache/videos/1556749678654.mp4' already exists. Overwrite ? [y/N] Not overwriting - exiting

Edit I am executing this script as follows within node.js

 var spawn = require("child_process").spawn,
        child;

      response.data.pipe(file);

      child = spawn("powershell.exe", [
        "./script.ps1",
        `./cache/videos/${tempFileName + "."}${videoType}`,
        ` ./cache/converted_videos/${tempFileName + "."}${videoType}`
      ]);
Snoopy
  • 1,257
  • 2
  • 19
  • 32
  • 1
    What are you trying to do? If ffmpeg doesn't support something similar to a `-force` option you could always move / rename the file in Powershell then create one with the same name, then delete the old file. Would this be something that you could do? – Riley Carney May 01 '19 at 22:34
  • Also did you create your own function for ffmpeg? Otherwise how is it running? Usually you need to have something similar to `& "C:\pathtoexec\ffmpeg.exe" -i $Args[0] -vcodec copy -acodec copy -movflags +faststart $Args[1]` – Riley Carney May 01 '19 at 22:37
  • I ended up just making an entirely new folder. I just wanted to save some space. But pretty much I was getting an error saying `moov atom not found` so I saw I needed to run this script to move the "moov atom" in the file. So I made a cache folder to hold the original video and then I made a cache folder to hold the converted video. That being said I would've liked to just override the original file itself to save space. It seems like using a new folder would help with overhead...I could be wrong though – Snoopy May 01 '19 at 22:38
  • @RileyCarney i'm running this on my client side. So i'm using the root folder to run these scripts. There's a library with Node.js called `child_process` that i'm using to call my PowerShell Script var spawn = require("child_process").spawn, child; response.data.pipe(file); child = spawn("powershell.exe", [ "./script.ps1", `./cache/videos/${tempFileName + "."}${videoType}`, ` ./cache/converted_videos/${tempFileName + "."}${videoType}` ]); – Snoopy May 01 '19 at 22:40
  • Just found answer :) hopefully this works for you: https://stackoverflow.com/questions/39788972/ffmpeg-override-output-file-if-exists – Riley Carney May 01 '19 at 22:53
  • 1
    Possible duplicate of [ffmpeg override output file if exists](https://stackoverflow.com/questions/39788972/ffmpeg-override-output-file-if-exists) – Riley Carney May 01 '19 at 22:53

0 Answers0