调整依赖exe程序

croire 3 years ago
parent e37b9d0e76
commit ad5e3c2f70

@ -354,6 +354,20 @@
<SubType>Designer</SubType>
</Page>
</ItemGroup>
<ItemGroup>
<Content Include="aria2c.exe">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="aria2_COPYING.txt">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="ffmpeg.exe">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="FFmpeg_LICENSE.txt">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="..\packages\Brotli.NET.2.1.1\build\Brotli.NET.targets" Condition="Exists('..\packages\Brotli.NET.2.1.1\build\Brotli.NET.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">

@ -9,6 +9,23 @@ namespace DownKyi.Core.FFmpeg
{
private const string Tag = "FFmpegHelper";
private static readonly bool is64Bit = false;
private static readonly string exec = "";
static FFmpegHelper()
{
is64Bit = IntPtr.Size == 8;
if (is64Bit)
{
exec = Path.Combine(Environment.CurrentDirectory, "ffmpeg.exe");
}
else
{
exec = Path.Combine(Environment.CurrentDirectory, "ffmpeg.exe");
}
}
/// <summary>
/// 合并音频和视频
/// </summary>
@ -37,7 +54,7 @@ namespace DownKyi.Core.FFmpeg
return false;
}
ExcuteProcess("ffmpeg.exe", param, null, (s, e) => Console.WriteLine(e.Data));
ExcuteProcess(exec, param, null, (s, e) => Console.WriteLine(e.Data));
try
{
@ -92,7 +109,7 @@ namespace DownKyi.Core.FFmpeg
// ffmpeg -y -f concat -safe 0 -i filelist.txt -c copy output.mkv
// 加上-y表示如果有同名文件则默认覆盖
string param = $"-y -f concat -safe 0 -i {concatFileName} -c copy \"{destVideo}\" -y";
ExcuteProcess("ffmpeg.exe", param, workingDirectory, (s, e) => Console.WriteLine(e.Data));
ExcuteProcess(exec, param, workingDirectory, (s, e) => Console.WriteLine(e.Data));
// 删除临时文件
try
@ -128,7 +145,7 @@ namespace DownKyi.Core.FFmpeg
{
// ffmpeg -y -i "video.mp4" -vf delogo=x=1670:y=50:w=180:h=70:show=1 "delogo.mp4"
string param = $"-y -i \"{video}\" -vf delogo=x={x}:y={y}:w={width}:h={height}:show=0 \"{destVideo}\" -hide_banner";
ExcuteProcess("ffmpeg.exe", param, null, (s, e) =>
ExcuteProcess(exec, param, null, (s, e) =>
{
Console.WriteLine(e.Data);
action.Invoke(e.Data);
@ -147,7 +164,7 @@ namespace DownKyi.Core.FFmpeg
// ffmpeg -i 3.mp4 -vn -y -acodec copy 3.aac
// ffmpeg -i 3.mp4 -vn -y -acodec copy 3.m4a
string param = $"-i \"{video}\" -vn -y -acodec copy \"{audio}\" -hide_banner";
ExcuteProcess("ffmpeg.exe", param,
ExcuteProcess(exec, param,
null, (s, e) =>
{
Console.WriteLine(e.Data);
@ -166,7 +183,7 @@ namespace DownKyi.Core.FFmpeg
// 提取视频 Extract Video
// ffmpeg -i Life.of.Pi.has.subtitles.mkv -vcodec copy an videoNoAudioSubtitle.mp4
string param = $"-i \"{video}\" -y -vcodec copy -an \"{destVideo}\" -hide_banner";
ExcuteProcess("ffmpeg.exe", param,
ExcuteProcess(exec, param,
null, (s, e) =>
{
Console.WriteLine(e.Data);
@ -185,7 +202,7 @@ namespace DownKyi.Core.FFmpeg
// 提取帧
// ffmpeg -i caiyilin.wmv -vframes 1 wm.bmp
string param = $"-i \"{video}\" -y -vframes {number} \"{image}\"";
ExcuteProcess("ffmpeg.exe", param, null, (s, e) => Console.WriteLine(e.Data));
ExcuteProcess(exec, param, null, (s, e) => Console.WriteLine(e.Data));
}

Binary file not shown.

@ -558,18 +558,6 @@
<Resource Include="Resources\no-data.png" />
</ItemGroup>
<ItemGroup>
<Content Include="aria2c.exe">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="aria2_COPYING.txt">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="ffmpeg.exe">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="FFmpeg_LICENSE.txt">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Resource Include="Resources\checked.png" />
<Resource Include="Resources\nodata02.png" />
<Resource Include="Resources\backgound\9-绿荫秘境.png" />

Binary file not shown.
Loading…
Cancel
Save