diff --git a/DownKyi.Core/FFMpeg/FFMpeg.cs b/DownKyi.Core/FFMpeg/FFMpeg.cs index b4e72fd..ecff8d9 100644 --- a/DownKyi.Core/FFMpeg/FFMpeg.cs +++ b/DownKyi.Core/FFMpeg/FFMpeg.cs @@ -32,15 +32,38 @@ public class FFMpeg public bool MergeVideo(string audio, string video, string destVideo) { if (!File.Exists(audio) && !File.Exists(video)) return false; - FFMpegArguments + + var arguments = FFMpegArguments .FromFileInput(audio) .AddFileInput(video) .OutputToFile(destVideo, true, options => options + .WithCustomArgument("-strict -2") .WithAudioCodec("copy") .WithVideoCodec("copy") .ForceFormat("mp4") - ) - .NotifyOnError(s => LogManager.Debug("ffmpeg", s)) + ); + if (audio == null || !File.Exists(audio)) + { + arguments = FFMpegArguments.FromFileInput(video).OutputToFile( + destVideo, + true, + options => options.WithCustomArgument("-strict -2").WithVideoCodec("copy").WithAudioCodec("copy").ForceFormat("mp4") + ); + } + + if (video == null || !File.Exists(video)) + { + arguments = FFMpegArguments.FromFileInput(audio).OutputToFile( + destVideo, + true, + options => options.WithCustomArgument("-strict -2").DisableChannel(Channel.Video).WithAudioCodec("copy") + ); + } + + LogManager.Debug(Tag, arguments.Arguments); + + arguments + .NotifyOnError(s => LogManager.Debug(Tag, s)) .ProcessSynchronously(); try { diff --git a/README.md b/README.md index 3314839..7f3db12 100644 --- a/README.md +++ b/README.md @@ -4,8 +4,8 @@ [![GitHub Repo stars](https://img.shields.io/github/stars/yaobiao131/downkyicore)](https://github.com/yaobiao131/downkyicore/stargazers) [![GitHub forks](https://img.shields.io/github/forks/yaobiao131/downkyicore)](https://github.com/yaobiao131/downkyicore/network) -[![GitHub forks](https://img.shields.io/github/issues/yaobiao131/downkyicore)](https://github.com/yaobiao131/downkyicore/issues) -[![GitHub forks](https://img.shields.io/github/license/yaobiao131/downkyicore)](https://github.com/yaobiao131/downkyicore/blob/main/LICENSE) +[![GitHub issues](https://img.shields.io/github/issues/yaobiao131/downkyicore)](https://github.com/yaobiao131/downkyicore/issues) +[![LICENSE](https://img.shields.io/github/license/yaobiao131/downkyicore)](https://github.com/yaobiao131/downkyicore/blob/main/LICENSE)