diff --git a/Changelog.md b/Changelog.md index 5cdefa54..369d5129 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1,13 +1,23 @@ -2.1.5.5 Beta (2020-12-??) +2.1.5.6 Beta (2020-12-??) +========================= + +2.1.5.5 Beta (2020-12-30) ========================= - Multiple AviSynth.dlls were included due to bug in release script. (stax76, 44vince44 [#407](/../../issues/407)) - Apple QuickTime library removed. - The apps dialog has a feature to copy the path to the clipboard. (stax76) - The apps dialog has a feature to edit the user PATH environment variable. (stax76 [#305](/../../issues/305)) -- mpv.net 5.4.8.6 +- VapourSynth CAS plugin added (LSFmod dependency). +- On Windows 10 Unicode for AviSynth is supported even when the default + code page is not UTF-8. This currently works for staxrip, mpv.net and x264. - aomenc bitrate UI fix (Dendraspis, 44vince44, [#375](/../../issues/375)) +- mpv.net 5.4.8.6 +- x264 M-0.161.3027-4121277-x64-gcc10.2.0 Patman +- x265 M-3.4+28 gcc10.2.0 Yuuki-Asuna/msg7086/DJATOM/Patman, + it supports direct AviSynth and VapourSynth input which can be + enabled in the encoder settings: Input/Output > Pipe > None 2.1.5.4 Beta (2020-12-27) diff --git a/Encoding/x264Enc.vb b/Encoding/x264Enc.vb index e178a9d0..c89c182d 100644 --- a/Encoding/x264Enc.vb +++ b/Encoding/x264Enc.vb @@ -46,7 +46,6 @@ Public Class x264Enc End Function Overrides Sub Encode() - p.Script.Synchronize() Encode("Video encoding", GetArgs(1, p.Script), s.ProcessPriority) If Params.Mode.Value = x264RateMode.TwoPass Then @@ -61,7 +60,7 @@ Public Class x264Enc End Sub Overloads Sub Encode(passName As String, commandLine As String, priority As ProcessPriorityClass) - p.Script.Synchronize() + p.Script.Synchronize(avsEncoding:=TextEncoding.EncodingOfProcess) Using proc As New Proc proc.Package = Package.x264 @@ -110,7 +109,7 @@ Public Class x264Enc script.Filters.Add(New VideoFilter("aaa", "aaa", code)) script.Path = (p.TempDir + p.TargetFile.Base + "_CompCheck." + script.FileType).ToShortFilePath - script.Synchronize() + script.Synchronize(avsEncoding:=TextEncoding.EncodingOfProcess) Log.WriteLine(BR + script.GetFullScript + BR) @@ -1078,7 +1077,7 @@ Public Class x264Params End If If includePaths Then - Dim input = If(pipeTool = "none", script.Path.ToShortFilePath.Escape, "-") + Dim input = If(pipeTool = "none", script.Path.Escape, "-") Dim dmx = Demuxer.ValueText If dmx = "automatic" Then diff --git a/Encoding/x265Enc.vb b/Encoding/x265Enc.vb index ace6278b..02b3c66f 100644 --- a/Encoding/x265Enc.vb +++ b/Encoding/x265Enc.vb @@ -117,8 +117,14 @@ Public Class x265Enc proc.Encoding = Encoding.UTF8 proc.Priority = priority proc.SkipString = "%] " - proc.File = "cmd.exe" - proc.Arguments = "/S /C """ + commandLine + """" + + If commandLine.Contains("|") Then + proc.File = "cmd.exe" + proc.Arguments = "/S /C """ + commandLine + """" + Else + proc.CommandLine = commandLine + End If + proc.Start() End Using End Sub diff --git a/Forms/CropForm.vb b/Forms/CropForm.vb index aa945472..6746882c 100644 --- a/Forms/CropForm.vb +++ b/Forms/CropForm.vb @@ -608,7 +608,7 @@ Public Class CropForm script.Engine = p.Script.Engine script.Path = (p.TempDir + p.TargetFile.Base + "_crop." + script.FileType).ToShortFilePath script.Filters.Add(p.Script.GetFilter("Source").GetCopy) - script.Synchronize(True, True, True) + script.Synchronize(True, True, True, TextEncoding.EncodingOfProcess) FrameServer = FrameServerFactory.Create(script.Path) Renderer = New VideoRenderer(pnVideo, FrameServer) diff --git a/Forms/MainForm.vb b/Forms/MainForm.vb index d2dc8046..2b743034 100644 --- a/Forms/MainForm.vb +++ b/Forms/MainForm.vb @@ -6,7 +6,7 @@ Imports System.Text Imports System.Text.RegularExpressions Imports System.Threading Imports System.Threading.Tasks - +Imports Microsoft.Win32 Imports StaxRip.UI Imports VB6 = Microsoft.VisualBasic @@ -2189,7 +2189,7 @@ Public Class MainForm If film >= 95 Then content = content.Replace("Field_Operation=0" + BR + "Frame_Rate=29970 (30000/1001)", "Field_Operation=1" + BR + "Frame_Rate=23976 (24000/1001)") - content.WriteFileDefault(p.SourceFile) + content.WriteFileSystemEncoding(p.SourceFile) End If End If End If @@ -2198,7 +2198,6 @@ Public Class MainForm Dim errorMsg = "" Try - p.SourceScript.Synchronize() errorMsg = p.SourceScript.GetError Catch ex As Exception errorMsg = ex.Message @@ -2292,7 +2291,7 @@ Public Class MainForm Dim isCropActive = p.Script.IsFilterActive("Crop") If isCropActive AndAlso (p.CropLeft Or p.CropTop Or p.CropRight Or p.CropBottom) = 0 Then - p.SourceScript.Synchronize(True, True, True) + p.SourceScript.Synchronize(True, True, True, TextEncoding.EncodingOfProcess) Using proc As New Proc proc.Header = "Auto Crop" @@ -2527,7 +2526,7 @@ Public Class MainForm If idxContent.Contains(VB6.ChrW(&HA) + VB6.ChrW(&H0) + VB6.ChrW(&HD) + VB6.ChrW(&HA)) Then idxContent = idxContent.FixBreak idxContent = idxContent.Replace(BR + VB6.ChrW(&H0) + BR, BR + "langidx: 0" + BR) - File.WriteAllText(path, idxContent, Encoding.Default) + idxContent.WriteFileSystemEncoding(path) End If Using proc As New Proc @@ -2587,7 +2586,7 @@ Public Class MainForm "CLOSE" Dim fileContent = p.TempDir + p.TargetFile.Base + "_vsrip.txt" - args.WriteFileDefault(fileContent) + args.WriteFileSystemEncoding(fileContent) Using proc As New Proc proc.Header = "Demux subtitles using VSRip" @@ -2799,6 +2798,22 @@ Public Class MainForm End If If Not p.BatchMode Then + If p.SourceFile <> "" Then + If p.Script.IsAviSynth AndAlso Not TextEncoding.IsSystemUTF8 AndAlso + Not (TextEncoding.AvsEncoderSupportsUTF8 AndAlso OSVersion.Current >= OSVersion.Windows10) AndAlso + Not TextEncoding.IsPathSupportedBySystemEncoding(p.SourceFile) Then + + If ProcessTip(If(OSVersion.Current >= OSVersion.Windows10, + "The current AviSynth video encoder does not support Unicode, consider to enable UTF-8 in the administrative language settings of Windows 10.", + "The current AviSynth video encoder does not support Unicode on systems older than Windows 10.")) Then + + gbAssistant.Text = "Text Encoding Limitation" + CanIgnoreTip = False + Return False + End If + End If + End If + If p.Script.Filters.Count = 0 OrElse Not p.Script.Filters(0).Active OrElse p.Script.Filters(0).Category <> "Source" Then @@ -2939,7 +2954,8 @@ Public Class MainForm End If If Not p.Script.IsFilterActive("Cutting") AndAlso Form.ActiveForm Is Me Then - If ProcessTip("The cutting filter settings don't match with the cutting settings used in the preview.") Then + If ProcessTip("The cutting filter settings don't match with the cutting settings used in the preview." + BR + + "This can usually be fixed by opening and closing the preview.") Then gbAssistant.Text = "Invalid Cutting Settings" CanIgnoreTip = False Return False @@ -3080,14 +3096,6 @@ Public Class MainForm Exit Sub End If - If System.Text.Encoding.Default.CodePage <> 65001 AndAlso - Not tb.Text.IsANSICompatible AndAlso p.Script.Engine = ScriptEngine.AviSynth Then - - MsgWarn(Strings.NoUnicode) - tb.Text = "" - Exit Sub - End If - If tb.Text.Contains(":\") OrElse tb.Text.StartsWith("\\") Then If tb.Text <> ap.File Then ap.File = tb.Text @@ -4703,7 +4711,7 @@ Public Class MainForm End If Regex.Replace(dialog.FileName.ReadAllText, "langidx: \d+", "langidx: " + - sb.SelectedValue.IndexIDX.ToString).WriteFileDefault(dialog.FileName) + sb.SelectedValue.IndexIDX.ToString).WriteFileSystemEncoding(dialog.FileName) End If p.AddHardcodedSubtitleFilter(dialog.FileName, True) diff --git a/Forms/MuxerForm.vb b/Forms/MuxerForm.vb index 1a06624f..662aa399 100644 --- a/Forms/MuxerForm.vb +++ b/Forms/MuxerForm.vb @@ -1122,7 +1122,7 @@ Public Class MuxerForm If st.Path.Ext = "idx" Then filepath = p.TempDir + p.TargetFile.Base + "_play.idx" Regex.Replace(st.Path.ReadAllText, "langidx: \d+", "langidx: " + - st.IndexIDX.ToString).WriteFileDefault(filepath) + st.IndexIDX.ToString).WriteFileSystemEncoding(filepath) FileHelp.Copy(st.Path.DirAndBase + ".sub", filepath.DirAndBase + ".sub") End If @@ -1351,7 +1351,7 @@ Public Class MuxerForm If fp.Ext = "idx" Then fp = p.TempDir + p.TargetFile.Base + "_temp.idx" - Regex.Replace(st.Path.ReadAllText, "langidx: \d+", "langidx: " + st.IndexIDX.ToString).WriteFileDefault(fp) + Regex.Replace(st.Path.ReadAllText, "langidx: \d+", "langidx: " + st.IndexIDX.ToString).WriteFileSystemEncoding(fp) FileHelp.Copy(st.Path.DirAndBase + ".sub", fp.DirAndBase + ".sub") End If @@ -1368,7 +1368,7 @@ Public Class MuxerForm If fp.ExtFull = ".idx" Then fp = p.TempDir + p.TargetFile.Base + "_temp.idx" - Regex.Replace(st.Path.ReadAllText, "langidx: \d+", "langidx: " + st.IndexIDX.ToString).WriteFileDefault(fp) + Regex.Replace(st.Path.ReadAllText, "langidx: \d+", "langidx: " + st.IndexIDX.ToString).WriteFileSystemEncoding(fp) FileHelp.Copy(st.Path.DirAndBase + ".sub", fp.DirAndBase + ".sub") End If diff --git a/Forms/PreviewForm.vb b/Forms/PreviewForm.vb index ebd036c6..0fa88585 100644 --- a/Forms/PreviewForm.vb +++ b/Forms/PreviewForm.vb @@ -987,7 +987,7 @@ Public Class PreviewForm Protected Overrides Sub OnLoad(args As EventArgs) MyBase.OnLoad(args) - PreviewScript.Synchronize(True, True, True) + PreviewScript.Synchronize(True, True, True, TextEncoding.EncodingOfProcess) FrameServer = FrameServerFactory.Create(PreviewScript.Path) Renderer = New VideoRenderer(pnVideo, FrameServer) Renderer.Info = PreviewScript.OriginalInfo diff --git a/Forms/VideoComparisonForm.vb b/Forms/VideoComparisonForm.vb index 9b3f1024..93b317e6 100644 --- a/Forms/VideoComparisonForm.vb +++ b/Forms/VideoComparisonForm.vb @@ -286,7 +286,7 @@ Public Class VideoComparisonForm script.Filters.Add(New VideoFilter("Crop(" & Form.CropLeft & ", " & Form.CropTop & ", -" & Form.CropRight & ", -" & Form.CropBottom & ")")) End If - script.Synchronize(True, True, True) + script.Synchronize(True, True, True, TextEncoding.EncodingOfProcess) Server = FrameServerFactory.Create(script.Path) Renderer = New VideoRenderer(VideoPanel, Server) diff --git a/General/CommandLine.vb b/General/CommandLine.vb index f723e992..13eabd70 100644 --- a/General/CommandLine.vb +++ b/General/CommandLine.vb @@ -80,14 +80,20 @@ Namespace CommandLine Exit Sub End If - p.Script.Synchronize() + Dim cl = GetCommandLine(True, True) + + If TextEncoding.AvsEncoderSupportsUTF8(cl) Then + p.Script.Synchronize(avsEncoding:=TextEncoding.EncodingOfProcess) + Else + p.Script.Synchronize() + End If If g.IsWindowsTerminalAvailable Then - Dim cl = "cmd.exe /S /K --% """ + GetCommandLine(True, True) + """" + cl = "cmd.exe /S /K --% """ + cl + """" Dim base64 = Convert.ToBase64String(Encoding.Unicode.GetBytes(cl)) 'UTF16LE g.Execute("wt.exe", "powershell.exe -NoLogo -NoExit -NoProfile -EncodedCommand """ + base64 + """") Else - g.Execute("cmd.exe", "/S /K """ + GetCommandLine(True, True) + """") + g.Execute("cmd.exe", "/S /K """ + cl + """") End If End Sub End Class diff --git a/General/Extensions.vb b/General/Extensions.vb index 0a388a21..9f085c25 100644 --- a/General/Extensions.vb +++ b/General/Extensions.vb @@ -142,23 +142,42 @@ Module StringExtensions End Function - Function IsDosCompatible(instance As String) As Boolean - If instance = "" Then - Return True - End If + Function IsASCIIEncodingCompatible(instance As String) As Boolean + For Each i In instance + If Convert.ToInt32(i) > 127 Then + Return False + End If + Next - Dim bytes = Encoding.Convert(Encoding.Unicode, Encoding.GetEncoding(ConsoleHelp.DosCodePage), Encoding.Unicode.GetBytes(instance)) - Return instance = Encoding.Unicode.GetString(Encoding.Convert(Encoding.GetEncoding(ConsoleHelp.DosCodePage), Encoding.Unicode, bytes)) + Return True End Function - Function IsANSICompatible(instance As String) As Boolean + Function IsSystemEncodingCompatible(instance As String) As Boolean If instance = "" Then Return True End If - Dim bytes = Encoding.Convert(Encoding.Unicode, Encoding.Default, Encoding.Unicode.GetBytes(instance)) - Return instance = Encoding.Unicode.GetString(Encoding.Convert(Encoding.Default, Encoding.Unicode, bytes)) + If IsASCIIEncodingCompatible(instance) Then + Return True + End If + + Dim bytes = Encoding.Convert(Encoding.Unicode, TextEncoding.EncodingOfSystem, Encoding.Unicode.GetBytes(instance)) + Return instance = Encoding.Unicode.GetString(Encoding.Convert(TextEncoding.EncodingOfSystem, Encoding.Unicode, bytes)) + End Function + + + Function IsProcessEncodingCompatible(instance As String) As Boolean + If instance = "" Then + Return True + End If + + If IsASCIIEncodingCompatible(instance) Then + Return True + End If + + Dim bytes = Encoding.Convert(Encoding.Unicode, TextEncoding.EncodingOfProcess, Encoding.Unicode.GetBytes(instance)) + Return instance = Encoding.Unicode.GetString(Encoding.Convert(TextEncoding.EncodingOfProcess, Encoding.Unicode, bytes)) End Function @@ -525,8 +544,13 @@ Module StringExtensions End Function - Sub WriteFileDefault(instance As String, path As String) - WriteFile(instance, path, Encoding.Default) + Sub WriteFileSystemEncoding(instance As String, path As String) + WriteFile(instance, path, TextEncoding.EncodingOfSystem) + End Sub + + + Sub WriteFileProcessEncoding(instance As String, path As String) + WriteFile(instance, path, TextEncoding.EncodingOfProcess) End Sub diff --git a/General/FrameServer.vb b/General/FrameServer.vb index e2371a1e..90841aec 100644 --- a/General/FrameServer.vb +++ b/General/FrameServer.vb @@ -153,7 +153,7 @@ Public Class FrameServerFactory Package.VapourSynth.Directory, Package.AviSynth.Directory, Package.FFTW.Directory, - Package.VisualCpp2019.Directory) + Folder.Startup + "Apps\Support\VC") If (path.Ext = "avs" AndAlso s.AviSynthMode = FrameServerMode.VFW) OrElse (path.Ext = "vpy" AndAlso s.VapourSynthMode = FrameServerMode.VFW) Then diff --git a/General/GlobalClass.vb b/General/GlobalClass.vb index 3c50e257..f85b96da 100644 --- a/General/GlobalClass.vb +++ b/General/GlobalClass.vb @@ -4,7 +4,6 @@ Imports System.Drawing.Imaging Imports System.Globalization Imports System.Management.Automation Imports System.Runtime.ExceptionServices -Imports System.Runtime.InteropServices Imports System.Security.Principal Imports System.Text Imports System.Text.RegularExpressions @@ -435,10 +434,8 @@ Public Class GlobalClass Function VerifySource(files As IEnumerable(Of String)) As Boolean For Each file In files - If Encoding.Default.CodePage <> 65001 AndAlso - Not file.IsANSICompatible AndAlso p.Script.Engine = ScriptEngine.AviSynth Then - - MsgError(Strings.NoUnicode) + If Not file.IsProcessEncodingCompatible AndAlso p.Script.Engine = ScriptEngine.AviSynth Then + ShowAviSynthUnicodeError() Return False End If Next @@ -446,6 +443,11 @@ Public Class GlobalClass Return True End Function + Sub ShowAviSynthUnicodeError() + MsgError($"Unicode filenames are not supported by AviSynth unless Windows 10 is used." + BR2 + + $"Rename the file or enable VapourSynth:{BR2}Filters > Filter Setup > VapourSynth") + End Sub + Sub PlayAudio(ap As AudioProfile) If FileTypes.AudioRaw.Contains(ap.File.Ext) Then g.ShellExecute(Package.mpvnet.Path, ap.File.Escape) @@ -513,7 +515,7 @@ Public Class GlobalClass Exit Sub End If - script.Synchronize() + script.Synchronize(avsEncoding:=TextEncoding.EncodingOfProcess) Dim args As String If script.Engine = ScriptEngine.VapourSynth Then @@ -1263,7 +1265,7 @@ Public Class GlobalClass End Sub Sub RunAutoCrop(progressAction As Action(Of Double)) - p.SourceScript.Synchronize(True, True, True) + p.SourceScript.Synchronize(True, True, True, TextEncoding.EncodingOfProcess) Using server = FrameServerFactory.Create(p.SourceScript.Path) Dim len = server.Info.FrameCount \ (s.CropFrameCount + 1) @@ -1534,4 +1536,10 @@ Public Class GlobalClass Return "clip = " + ret End If End Function + + Function ContainsPipeTool(value As String) As Boolean + If value <> "" Then + Return value.Contains("ffmpeg") OrElse value.Contains("avs2pipemod") OrElse value.Contains("vspipe") + End If + End Function End Class diff --git a/General/GlobalCommands.vb b/General/GlobalCommands.vb index 3faef511..bbe13639 100644 --- a/General/GlobalCommands.vb +++ b/General/GlobalCommands.vb @@ -937,6 +937,7 @@ Public Class GlobalCommands g.RunCommandInTerminal("powershell.exe") End Sub + 'TODO: remove Sub ExecuteBatchScript( "" Then + Return commandLine.Contains("x264") AndAlso commandLine.Contains(".avs") AndAlso Not g.ContainsPipeTool(commandLine) + End If + End Function +End Class diff --git a/General/Muxer.vb b/General/Muxer.vb index d84a63fa..a745ab94 100644 --- a/General/Muxer.vb +++ b/General/Muxer.vb @@ -173,7 +173,7 @@ Public MustInherit Class Muxer If v.Contains(VB6.ChrW(&HA) + VB6.ChrW(&H0) + VB6.ChrW(&HD) + VB6.ChrW(&HA)) Then v = v.FixBreak v = v.Replace(BR + VB6.ChrW(&H0) + BR, BR + "langidx: 0" + BR) - File.WriteAllText(fp, v, Encoding.Default) + v.WriteFileSystemEncoding(fp) End If End If @@ -486,26 +486,29 @@ Public Class BatchMuxer End Function Overrides Sub Mux() - Log.WriteHeader("Batch Muxing") + Log.WriteHeader("Command Line Muxing") - Dim batchPath = p.TempDir + p.TargetFile.Base + "_mux.bat" - Dim batchCode = Proc.WriteBatchFile(batchPath, Macro.Expand(CommandLines)) + For Each line In Macro.Expand(CommandLines.Trim).SplitLinesNoEmpty + Using proc As New Proc + proc.Header = "Command Line Muxing: " + Name - Using proc As New Proc - proc.Header = "Video encoding command line encoder: " + Name - proc.WriteLog(batchCode + BR2) - proc.File = "cmd.exe" - proc.Arguments = "/C call """ + batchPath + """" + If line.Contains("|") Then + proc.File = "cmd.exe" + proc.Arguments = "/S /C """ + line + """" + Else + proc.CommandLine = line + End If - Try - proc.Start() - Catch ex As AbortException - Throw ex - Catch ex As Exception - g.ShowException(ex) - Throw New AbortException - End Try - End Using + Try + proc.Start() + Catch ex As AbortException + Throw ex + Catch ex As Exception + g.ShowException(ex) + Throw New AbortException + End Try + End Using + Next End Sub Overrides Function Edit() As DialogResult diff --git a/General/Package.vb b/General/Package.vb index 6d955fc0..29e044cf 100644 --- a/General/Package.vb +++ b/General/Package.vb @@ -764,7 +764,7 @@ Public Class Package .DownloadURL = "https://github.com/realfinder/AVS-Stuff/blob/master/avs%202.5%20and%20up/LSFmod.avsi", .Description = "A LimitedSharpenFaster mod with a lot of new features and optimizations.", .AvsFilterNames = {"LSFmod"}, - .AvsFiltersFunc = Function() {New VideoFilter("Line", "Sharpen | LSFmod", "LSFmod(defaults=""slow"", strength=100, Smode=5, Smethod=3, kernel=11, preblur=""OFF"", secure=true, Szrp=16, Spwr=4, SdmpLo=4, SdmpHi=48, Lmode=4, overshoot=1, undershoot=1, Overshoot2=1, Undershoot2=1, soft=-2, soothe=true, keep=20, edgemode=0, edgemaskHQ=true, ss_x=1.50, ss_y=1.50, dest_x=%target_width%, dest_y=%target_height%, show=false, screenW=1280, screenH=1024)")}}) + .AvsFiltersFunc = Function() {New VideoFilter("Line", "Sharpen | LSFmod", "LSFmod(defaults=""slow"", strength=100, Smode=5, Smethod=3, kernel=11, secure=true, Szrp=16, Spwr=4, SdmpLo=4, SdmpHi=48, Lmode=4, overshoot=1, undershoot=1, Overshoot2=1, Undershoot2=1, soft=-2, soothe=true, keep=20, edgemode=0, edgemaskHQ=true, ss_x=1.50, ss_y=1.50, dest_x=%target_width%, dest_y=%target_height%, show=false, screenW=1280, screenH=1024)")}}) Shared Property TemporalDegrain2 As Package = Add(New PluginPackage With { .Name = "TemporalDegrain2", @@ -1574,6 +1574,14 @@ Public Class Package .Description = "znedi3 is a CPU-optimized version of nnedi.", .VSFilterNames = {"znedi3.nnedi3"}}) + Add(New PluginPackage With { + .Name = "CAS", + .Filename = "CAS.dll", + .WebURL = "https://github.com/HomeOfVapourSynthEvolution/VapourSynth-CAS", + .DownloadURL = "https://github.com/HomeOfVapourSynthEvolution/VapourSynth-CAS/releases", + .Description = "Contrast Adaptive Sharpening.", + .VSFilterNames = {"cas.CAS"}}) + Add(New PluginPackage With { .Name = "nnedi3cl", .Filename = "NNEDI3CL.dll", diff --git a/General/Proc.vb b/General/Proc.vb index e9e8ab7e..74a23679 100644 --- a/General/Proc.vb +++ b/General/Proc.vb @@ -143,31 +143,6 @@ Public Class Proc End If End Function - 'TODO: should probably be removed - Shared Function WriteBatchFile(path As String, content As String) As String - If OSVersion.Current = OSVersion.Windows7 Then - For Each i In content - If Convert.ToInt32(i) > 137 Then - Throw New ErrorAbortException("Unsupported Windows Version", - "Executing batch files with character '" & i & "' requires minimum Windows 8.") - End If - Next - End If - - If content.IsDosCompatible Then - content = "@echo off" + BR + content - IO.File.WriteAllText(path, content, Encoding.GetEncoding(ConsoleHelp.DosCodePage)) - ElseIf content.IsANSICompatible Then - content = "@echo off" + BR + "CHCP " & Encoding.Default.CodePage & BR + content - IO.File.WriteAllText(path, content, Encoding.Default) - Else - content = "@echo off" + BR + "CHCP 65001" + BR + content - IO.File.WriteAllText(path, content, New UTF8Encoding(False)) - End If - - Return content - End Function - Property File() As String Get Return Process.StartInfo.FileName @@ -474,9 +449,9 @@ Public Class Proc End If Next - Dim cppDir = Package.VisualCpp2019.Directory + Dim cppDir = Folder.Startup + "Apps\Support\VC" - If Not cppDir.PathStartsWith(Folder.System) AndAlso Not path.Contains(cppDir + ";") Then + If Not path.Contains(cppDir + ";") Then path = cppDir + ";" + path End If diff --git a/General/Project.vb b/General/Project.vb index e5e4db63..07deddd3 100644 --- a/General/Project.vb +++ b/General/Project.vb @@ -233,13 +233,6 @@ Public Class Project Exit Property End If - If Text.Encoding.Default.CodePage <> 65001 AndAlso - Not value.IsANSICompatible AndAlso Script.Engine = ScriptEngine.AviSynth Then - - MsgWarn(Strings.NoUnicode) - Exit Property - End If - TargetFileValue = value NotifyPropertyChanged() End If diff --git a/General/Strings.vb b/General/Strings.vb index 187331d5..8a5dc602 100644 --- a/General/Strings.vb +++ b/General/Strings.vb @@ -1,6 +1,5 @@ Public Class Strings Public Shared Muxer As String = "A muxer merges different video, audio and subtitle files into a single container file which is the actual output file." - Public Shared NoUnicode As String = $"Unicode filenames are not supported by AviSynth.{BR2}VapourSynth supports unicode, it can be enabled at:{BR2}Filters > Filter Setup > VapourSynth" Public Shared TaskDialogFooter As String = "[copymsg: Copy Message]" End Class diff --git a/General/VideoScript.vb b/General/VideoScript.vb index 103e123a..02f0572a 100644 --- a/General/VideoScript.vb +++ b/General/VideoScript.vb @@ -22,6 +22,18 @@ Public Class VideoScript RaiseEvent Changed(Me) End Sub + ReadOnly Property IsAviSynth As Boolean + Get + Return Engine = ScriptEngine.AviSynth + End Get + End Property + + ReadOnly Property IsVapourSynth As Boolean + Get + Return Engine = ScriptEngine.VapourSynth + End Get + End Property + Overridable ReadOnly Property FileType As String Get Return If(Engine = ScriptEngine.VapourSynth, "vpy", "avs") @@ -169,15 +181,22 @@ Public Class VideoScript Public LastCode As String Public LastPath As String + Public LastAvsCodePage As Integer - Sub Synchronize(Optional convertToRGB As Boolean = False, - Optional comparePath As Boolean = True, - Optional flipVertical As Boolean = False) + Sub Synchronize( + Optional convertToRGB As Boolean = False, + Optional comparePath As Boolean = True, + Optional flipVertical As Boolean = False, + Optional avsEncoding As Encoding = Nothing) If Path = "" Then Exit Sub End If + If avsEncoding Is Nothing Then + avsEncoding = TextEncoding.EncodingOfSystem + End If + Dim srcFilter = GetFilter("Source") If Not srcFilter Is Nothing AndAlso Not srcFilter.Script.Contains("(") Then @@ -230,12 +249,16 @@ clipname.set_output() End If End If - If Me.Error <> "" OrElse code <> LastCode OrElse (comparePath AndAlso Path <> LastPath) Then + Dim changedAvsEncoding = Engine = ScriptEngine.AviSynth AndAlso LastAvsCodePage <> avsEncoding.CodePage + + If Me.Error <> "" OrElse code <> LastCode OrElse + (comparePath AndAlso Path <> LastPath) OrElse changedAvsEncoding Then + If Path.Dir.DirExists Then If Engine = ScriptEngine.VapourSynth Then - ModifyScript(code, Engine).WriteFile(Path, Encoding.UTF8) + ModifyScript(code, Engine).WriteFileUTF8(Path) Else - ModifyScript(code, Engine).WriteFileDefault(Path) + ModifyScript(code, Engine).WriteFile(Path, TextEncoding.EncodingOfProcess) End If If Not Package.AviSynth.VerifyOK OrElse @@ -257,6 +280,14 @@ clipname.set_output() Me.Error = server.Error End Using + If Engine = ScriptEngine.AviSynth Then + If Not avsEncoding Is TextEncoding.EncodingOfProcess Then + ModifyScript(code, Engine).WriteFile(Path, avsEncoding) + End If + + LastAvsCodePage = avsEncoding.CodePage + End If + LastCode = code LastPath = Path End If @@ -532,12 +563,12 @@ clipname.set_output() End Function Function GetInfo() As ServerInfo - Synchronize(False, False) + Synchronize(False, False, avsEncoding:=TextEncoding.EncodingOfProcess) Return Info End Function Function GetError() As String - Synchronize(False, False) + Synchronize(False, False, avsEncoding:=TextEncoding.EncodingOfProcess) Return Me.Error End Function @@ -892,7 +923,7 @@ Public Class FilterCategory line.Filters.Add(New VideoFilter(line.Name, "Anti-Aliasing | ediAA", "clip = muvsfunc.ediaa(clip)")) line.Filters.Add(New VideoFilter(line.Name, "Anti-Aliasing | Santiag", "clip = havsfunc.santiag(c=clip, opencl=$select:msg:Use GPU Enabled Feature?;True;False$)")) line.Filters.Add(New VideoFilter(line.Name, "Anti-Aliasing | MAA", "clip = muvsfunc.maa(clip)")) - line.Filters.Add(New VideoFilter(line.Name, "Sharpen | LSFmod", "clip = havsfunc.LSFmod(clip, defaults='slow', strength=100, Smode=5, Smethod=3, kernel=11, preblur='OFF', secure=True, Szrp= 16, Spwr= 4, SdmpLo= 4, SdmpHi= 48, Lmode=4, overshoot=1, undershoot=1, soft=-2, soothe=True, keep=20, edgemode=0, edgemaskHQ=True, ss_x= 1.50, ss_y=1.50)")) + line.Filters.Add(New VideoFilter(line.Name, "Sharpen | LSFmod", "clip = havsfunc.LSFmod(clip, defaults='slow', strength=100, Smode=5, Smethod=3, kernel=11, secure=True, Szrp= 16, Spwr= 4, SdmpLo= 4, SdmpHi= 48, Lmode=4, overshoot=1, undershoot=1, soft=-2, soothe=True, keep=20, edgemode=0, edgemaskHQ=True, ss_x= 1.50, ss_y=1.50)")) line.Filters.Add(New VideoFilter(line.Name, "Sharpen | SharpAAMcmod", "clip = muvsfunc.SharpAAMcmod(clip)")) ret.Add(line) diff --git a/My Project/AssemblyInfo.vb b/My Project/AssemblyInfo.vb index 9bdf23f6..1f75f28a 100644 --- a/My Project/AssemblyInfo.vb +++ b/My Project/AssemblyInfo.vb @@ -7,6 +7,6 @@ Imports System.Runtime.InteropServices - - + + diff --git a/My Project/app.manifest b/My Project/app.manifest index 5c9fdeeb..635b6b72 100644 --- a/My Project/app.manifest +++ b/My Project/app.manifest @@ -25,7 +25,8 @@ true true PerMonitor - + UTF-8 + diff --git a/Tools/AutoCrop/AutoCrop.vbproj b/Tools/AutoCrop/AutoCrop.vbproj index 3843e4f6..3ad7779b 100644 --- a/Tools/AutoCrop/AutoCrop.vbproj +++ b/Tools/AutoCrop/AutoCrop.vbproj @@ -73,6 +73,9 @@ 41999,42016,42017,42018,42019,42020,42021,42022,42032,42036 MinimumRecommendedRules.ruleset + + My Project\app.manifest + @@ -123,6 +126,7 @@ + MyApplicationCodeGenerator Application.Designer.vb diff --git a/Tools/AutoCrop/My Project/AssemblyInfo.vb b/Tools/AutoCrop/My Project/AssemblyInfo.vb index 2b4da342..b001f626 100644 --- a/Tools/AutoCrop/My Project/AssemblyInfo.vb +++ b/Tools/AutoCrop/My Project/AssemblyInfo.vb @@ -31,5 +31,5 @@ Imports System.Runtime.InteropServices ' by using the '*' as shown below: ' - - + + diff --git a/Tools/AutoCrop/My Project/app.manifest b/Tools/AutoCrop/My Project/app.manifest new file mode 100644 index 00000000..2d0dc5f2 --- /dev/null +++ b/Tools/AutoCrop/My Project/app.manifest @@ -0,0 +1,38 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + true + true + PerMonitor + UTF-8 + + + + diff --git a/UI/ImageUtils.vb b/UI/ImageUtils.vb index a5e4431a..a01d1d35 100644 --- a/UI/ImageUtils.vb +++ b/UI/ImageUtils.vb @@ -1,4 +1,5 @@ -Imports System.Drawing.Drawing2D + +Imports System.Drawing.Drawing2D Imports System.Drawing.Imaging Imports System.Drawing.Text Imports System.Globalization @@ -15,28 +16,41 @@ Public Class ImageHelp End Function Shared Function GetSymbolImage(symbol As Symbol) As Image - If Not FontFilesExist Then Return Nothing + If Not FontFilesExist Then + Return Nothing + End If + Dim legacy = OSVersion.Current < OSVersion.Windows10 If Coll Is Nothing Then Coll = New PrivateFontCollection Coll.AddFontFile(AwesomePath) - If legacy Then Coll.AddFontFile(SegoePath) + + If legacy Then + Coll.AddFontFile(SegoePath) + End If End If Dim family As FontFamily If CInt(symbol) > 61400 Then - If Coll.Families.Count > 0 Then family = Coll.Families(0) + If Coll.Families.Count > 0 Then + family = Coll.Families(0) + End If Else If legacy Then - If Coll.Families.Count > 1 Then family = Coll.Families(1) + If Coll.Families.Count > 1 Then + family = Coll.Families(1) + End If Else family = New FontFamily("Segoe MDL2 Assets") End If End If - If family Is Nothing Then Return Nothing + If family Is Nothing Then + Return Nothing + End If + Dim font As New Font(family, 12) Dim fontHeight = font.Height Dim bitmap As New Bitmap(CInt(fontHeight * 1.1F), CInt(fontHeight * 1.1F)) @@ -110,7 +124,7 @@ Public Class Thumbnails Dim count = columnCount * rowCount Dim bitmaps As New List(Of Bitmap) - script.Synchronize(True, True, True) + script.Synchronize(True, True, True, TextEncoding.EncodingOfProcess) Using server = FrameServerFactory.Create(script.Path) Dim serverPos As Integer @@ -290,4 +304,4 @@ Public Class Thumbnails End Try End Using End Sub -End Class \ No newline at end of file +End Class diff --git a/UI/ToolStripRendererEx.vb b/UI/ToolStripRendererEx.vb index 979b5f7c..8d76dc26 100644 --- a/UI/ToolStripRendererEx.vb +++ b/UI/ToolStripRendererEx.vb @@ -355,6 +355,9 @@ Public Class ToolStripRendererEx If (RenderMode = ToolStripRenderModeEx.SystemDefault OrElse RenderMode = ToolStripRenderModeEx.SystemAuto) AndAlso - OSVersion.Current >= OSVersion.Windows8 Then Return True + OSVersion.Current >= OSVersion.Windows8 Then + + Return True + End If End Function End Class diff --git a/docs/generated/tools.rst b/docs/generated/tools.rst index cfa2e04e..02e100aa 100644 --- a/docs/generated/tools.rst +++ b/docs/generated/tools.rst @@ -102,7 +102,7 @@ Tools "Zs_RF_Shared","AviSynth Script","Zs_RF_Shared.avsi","1.127","2020-05-31" "7zip","Console App","7za.exe","19.0","2019-02-21" "aomenc","Console App","aomenc.exe","2.0.1-1118-gbe4ee75fd-x64-msvc1929 Patman","2020-12-23" - "AutoCrop","Console App","AutoCrop.exe","2.0.0.0","2020-08-02" + "AutoCrop","Console App","AutoCrop.exe","2.1.0.0","2020-12-30" "avs2pipemod","Console App","avs2pipemod64.exe","1.1.1","2016-08-14" "AVSMeter","Console App","AVSMeter64.exe","3.0.7.0","2020-11-16" "eac3to","Console App","eac3to.exe","3.34","2017-11-19" @@ -124,8 +124,8 @@ Tools "SVT-AV1","Console App","SvtAv1EncApp.exe","0.8.6","2020-11-29" "VCEEnc","Console App","VCEEncC64.exe","6.07","2020-11-23" "vspipe","Console App","vspipe.exe","r52","2020-08-20" - "x264","Console App","x264.exe","M-0.161.3018-0417-64-10.2.0","2020-09-06" - "x265","Console App","x265.exe","x265 3.4+53-ge4afbd100 2020-11-02 Yuuki-Asuna/qyot27","2020-11-02" + "x264","Console App","x264.exe","M-0.161.3027-4121277-x64-gcc10.2.0 Patman","2020-12-16" + "x265","Console App","x265.exe","M-3.4+28 gcc10.2.0 Yuuki-Asuna/msg7086/DJATOM/Patman","2020-12-30" "xvid_encraw","Console App","xvid_encraw.exe","1.3.7","" "BDSup2Sub++","GUI App","bdsup2sub++.exe","1.0.3","2018-05-09" "chapterEditor","GUI App","chapterEditor.exe","1.25","2020-10-04" @@ -135,10 +135,10 @@ Tools "MKVToolnix GUI","GUI App","mkvtoolnix-gui.exe","51.0.0","2020-10-04" "MPC-BE","GUI App","mpc-be64.exe","","" "MPC-HC","GUI App","mpc-hc64.exe","","2017-07-16" - "mpv.net","GUI App","mpvnet.exe","5.4.8.6","2020-12-28" + "mpv.net","GUI App","mpvnet.exe","5.4.8.6","2020-12-30" "Subtitle Edit","GUI App","SubtitleEdit.exe","3.5.18","2020-11-09" "VSRip","GUI App","VSRip.exe","1.0.0.7","2011-07-14" - "Apple QuickTime","Library","CoreAudioToolbox.dll",,"" + "Apple QuickTime","Library","CoreAudioToolbox.dll","","2020-05-06" "AviSynth","Library","AviSynth.dll","3.6.2 test 6","2020-12-10" "DirectX 9","Library","d3d9.dll","","2020-12-09" "FFTW","Library","libfftw3-3.dll","3.3.8","2018-12-20" @@ -152,6 +152,7 @@ Tools "AWarpSharp2","VapourSynth Plugin","libawarpsharp2.dll","2018-06-18","2019-01-01" "BM3D","VapourSynth Plugin","BM3D.dll","r8","2019-01-03" "Bwdif","VapourSynth Plugin","Bwdif.dll","r2","2020-06-19" + "CAS","VapourSynth Plugin","CAS.dll","r2","2020-07-05" "CNR2","VapourSynth Plugin","libcnr2.dll","2016-07-02","2019-01-01" "CTMF","VapourSynth Plugin","CTMF.dll","2017-06-02","2019-01-01" "d2vsource","VapourSynth Plugin","d2vsource.dll","1.2","2019-08-06" @@ -1504,6 +1505,16 @@ Filters: bwdif.Bwdif https://github.com/HomeOfVapourSynthEvolution/VapourSynth-Bwdif +CAS +~~~ + +Contrast Adaptive Sharpening. + +Filters: cas.CAS + +https://github.com/HomeOfVapourSynthEvolution/VapourSynth-CAS + + CNR2 ~~~~