mirror of
https://github.com/revenz/FileFlowsPlugins.git
synced 2026-01-06 11:09:31 -06:00
FF-273 - added auto crop image node
fixed issue with mp4 image based subtitles
This commit is contained in:
@@ -25,7 +25,14 @@
|
||||
break;
|
||||
case "mp4":
|
||||
{
|
||||
results.Add("mov_text");
|
||||
if (Helpers.SubtitleHelper.IsImageSubtitle(Stream.Codec))
|
||||
{
|
||||
results.Add("copy");
|
||||
}
|
||||
else
|
||||
{
|
||||
results.Add("mov_text");
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
||||
21
VideoNodes/Helpers/SubtitleHelper.cs
Normal file
21
VideoNodes/Helpers/SubtitleHelper.cs
Normal file
@@ -0,0 +1,21 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace FileFlows.VideoNodes.Helpers;
|
||||
|
||||
/// <summary>
|
||||
/// Helper for Subtitles
|
||||
/// </summary>
|
||||
internal class SubtitleHelper
|
||||
{
|
||||
/// <summary>
|
||||
/// Tests if a subtitle is an image based subtitle
|
||||
/// </summary>
|
||||
/// <param name="codec">the subtitle codec</param>
|
||||
/// <returns>true if the subtitle is an image based subtitle</returns>
|
||||
internal static bool IsImageSubtitle(string codec)
|
||||
=> Regex.IsMatch(codec.Replace("_", ""), "dvbsub|dvdsub|pgs|xsub", RegexOptions.IgnoreCase);
|
||||
}
|
||||
@@ -277,7 +277,9 @@ namespace FileFlows.VideoNodes
|
||||
audio.Title = "";
|
||||
// this isnt type index, this is overall index
|
||||
audio.TypeIndex = int.Parse(Regex.Match(line, @"#([\d]+):([\d]+)").Groups[2].Value) - 1;
|
||||
audio.Codec = parts[0].Substring(parts[0].IndexOf("Audio: ") + "Audio: ".Length).Trim().Split(' ').First().ToLower() ?? "";
|
||||
audio.Codec = parts[0].Substring(parts[0].IndexOf("Audio: ") + "Audio: ".Length).Trim().Split(' ').First().ToLower() ?? string.Empty;
|
||||
if (audio.Codec.EndsWith(","))
|
||||
audio.Codec = audio.Codec[..^1].Trim();
|
||||
|
||||
audio.Language = GetLanguage(line);
|
||||
if (info.IndexOf("0 channels") >= 0)
|
||||
@@ -336,6 +338,8 @@ namespace FileFlows.VideoNodes
|
||||
SubtitleStream sub = new SubtitleStream();
|
||||
sub.TypeIndex = int.Parse(Regex.Match(line, @"#([\d]+):([\d]+)").Groups[2].Value);
|
||||
sub.Codec = line.Substring(line.IndexOf("Subtitle: ") + "Subtitle: ".Length).Trim().Split(' ').First().ToLower();
|
||||
if (sub.Codec.EndsWith(","))
|
||||
sub.Codec = sub.Codec[..^1].Trim();
|
||||
sub.Language = GetLanguage(line);
|
||||
|
||||
if (rgxTitle.IsMatch(info))
|
||||
|
||||
Reference in New Issue
Block a user