Direct transfer of audio/sub streams from input file

To avoid having to extract the full audio/sub streams to files first.
This commit is contained in:
Julian Maier
2021-03-03 16:00:48 +01:00
parent 504242dca7
commit 209844230e
4 changed files with 95 additions and 15 deletions

View File

@@ -180,9 +180,10 @@ namespace Flowframes
public static string GetAudioCodec(string path, int streamIndex = -1)
{
string stream = (streamIndex < 0) ? "a" : $"{streamIndex}";
string args = $" -v panic -show_streams -select_streams {stream} -show_entries stream=codec_name {path.Wrap()}";
string args = $"-v panic -show_streams -select_streams {stream} -show_entries stream=codec_name {path.Wrap()}";
string info = GetFfprobeOutput(args);
string[] entries = info.SplitIntoLines();
foreach (string entry in entries)
{
if (entry.Contains("codec_name="))
@@ -191,6 +192,22 @@ namespace Flowframes
return "";
}
public static List<string> GetAudioCodecs(string path, int streamIndex = -1)
{
List<string> codecNames = new List<string>();
string args = $"-loglevel panic -select_streams a -show_entries stream=codec_name {path.Wrap()}";
string info = GetFfprobeOutput(args);
string[] entries = info.SplitIntoLines();
foreach (string entry in entries)
{
if (entry.Contains("codec_name="))
codecNames.Add(entry.Remove("codec_name=").Trim());
}
return codecNames;
}
public static void DeleteSource(string path)
{
Logger.Log("[FFCmds] Deleting input file/dir: " + path, true);