php ffmpeg 覆盖输出文件(如果存在)

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/39788972/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-26 02:00:10  来源:igfitidea点击:

ffmpeg override output file if exists

phpffmpeg

提问by Muhammad Omer Aslam

I am creating a clip from an audio file .FLACwith a startand endtime, here is my command.

我创建从一个音频文件的剪辑.FLACstartend时间,这里是我的command

ffmpeg -i /audio/191079007530_1_01.flac 
       -t 51 
       -ss 69 
       /clips/44z274v23303t264y2z2s2s2746454t234_clip.mp3 
       2>&1 >> /ffmpegLogs.log

I use this command with my PHPcode and my question is,

我将此命令与我的PHP代码一起使用,我的问题是,

When i run the above command on the console it asks me to

当我在控制台上运行上述命令时,它要求我

override the output file if the output file already exists in the destination,

如果输出文件已存在于目标中,则覆盖输出文件,

what switchor extra commandshould I use to automatically override if the file exists.

如果文件存在,我应该使用什么switch或额外的东西command来自动覆盖。

回答by Veer

use option -ywith your command

将选项-y与您的命令一起使用

ffmpeg -y 
-i /audio/your_file_name.flac 
-t 51 
-ss 69 
/clips/your_clip_name.mp3 2>&1 >> /ffmpegLogs.log

回答by Muhammad Omer Aslam

I need to add the -yglobal switch before specifying the output file to accomplish this

我需要-y在指定输出文件之前添加全局开关来完成这个

ffmpeg -i /audio/191079007530_1_01.flac -t 51 -ss 69 -y /clips/44z274v23303t264y2z2s2s2746454t234_clip.mp3 2>&1 >> /ffmpegLogs.log

Alternatively, you can use the -noption to deny overriding the file.

或者,您可以使用该-n选项拒绝覆盖文件。