6 changed files with 113 additions and 27 deletions
@ -0,0 +1,51 @@ |
|||||
|
using Apewer; |
||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.IO; |
||||
|
using System.Text; |
||||
|
|
||||
|
namespace Apewer.Run |
||||
|
{ |
||||
|
|
||||
|
public class Batch |
||||
|
{ |
||||
|
|
||||
|
public Batch() => ConvertBreakingBad(); |
||||
|
|
||||
|
public void ConvertBreakingBad() |
||||
|
{ |
||||
|
var paths = StorageUtility.GetSubFiles(@"E:\Breaking Bad"); |
||||
|
var outdir = @"D:\temp\bb"; |
||||
|
foreach (var path in paths) |
||||
|
{ |
||||
|
var name = Path.GetFileName(path); |
||||
|
Console.Title = name; |
||||
|
Console.Clear(); |
||||
|
|
||||
|
if (name.EndsWith(".mkv")) |
||||
|
{ |
||||
|
var mp4path = Path.Combine(outdir, name.Replace(".mkv", ".mp4")); |
||||
|
if (StorageUtility.FileExists(mp4path)) continue; |
||||
|
|
||||
|
var cmd = "ffmpeg.exe"; |
||||
|
var arg = $"-i \"{path}\" -vcodec copy -acodec copy \"{mp4path}\""; |
||||
|
WindowsUtility.RunConsole(cmd, arg, (s) => Console.WriteLine(s)); |
||||
|
continue; |
||||
|
} |
||||
|
|
||||
|
if (name.EndsWith(".srt")) |
||||
|
{ |
||||
|
continue; |
||||
|
var srtpath = Path.Combine(outdir, name); |
||||
|
var vttpath = Path.Combine(outdir, name.Replace(".srt", ".vtt")); |
||||
|
var text = StorageUtility.ReadFile(path).ToText(Encoding.Default); |
||||
|
StorageUtility.WriteFile(srtpath, text.ToBinary()); |
||||
|
WindowsUtility.RunConsole("ffmpeg.exe", $"-i \"{srtpath}\" \"{vttpath}\"", (s) => Console.WriteLine(s)); |
||||
|
continue; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
|
||||
|
} |
Loading…
Reference in new issue