diff --git a/Changelog.md b/Changelog.md index 772ddccb..db790c97 100644 --- a/Changelog.md +++ b/Changelog.md @@ -22,6 +22,7 @@ v2.11.0 (not published yet) - Raise x265 atc-sei parameter upper limit ([#815](/../../issues/815)) - Optimize Check for Updates - Show also the path of the project when it's not found +- Add "Demux Attachments" to project options - Update tools - MKVToolNix v66.0 - NVEnc v5.46 diff --git a/Source/Forms/MainForm.vb b/Source/Forms/MainForm.vb index fab17cfd..89a1486e 100644 --- a/Source/Forms/MainForm.vb +++ b/Source/Forms/MainForm.vb @@ -4719,6 +4719,15 @@ Public Class MainForm b.SaveAction = Sub(value) p.ExtractTimestampsVfrOnly = value + ' ---------------------------------------------------------------- + Dim attachmentsPage = ui.CreateFlowPage("Attachments") + + b = ui.AddBool(attachmentsPage) + b.Text = "Demux Attachments" + b.Checked = p.DemuxAttachments + b.SaveAction = Sub(val) p.DemuxAttachments = val + + ' ---------------------------------------------------------------- ui.CreateFlowPage("Thumbnails", True) diff --git a/Source/General/Demux.vb b/Source/General/Demux.vb index aaa757b1..e8713051 100644 --- a/Source/General/Demux.vb +++ b/Source/General/Demux.vb @@ -457,14 +457,15 @@ Public Class MP4BoxDemuxer Overrides Sub Run(proj As Project) Dim audioStreams As List(Of AudioStream) Dim subtitles As List(Of Subtitle) + Dim attachments = GetAttachments(proj.SourceFile) Dim demuxAudio = Not (TypeOf proj.Audio0 Is NullAudioProfile AndAlso TypeOf proj.Audio1 Is NullAudioProfile) AndAlso MediaInfo.GetAudioCount(proj.SourceFile) > 0 Dim demuxSubtitles = MediaInfo.GetSubtitleCount(proj.SourceFile) > 0 - Dim attachments = GetAttachments(proj.SourceFile) Dim demuxChapters = proj.DemuxChapters + Dim demuxAttachments = proj.DemuxAttachments _videoDemuxing = proj.DemuxVideo If Not proj.NoDialogs AndAlso Not proj.BatchMode AndAlso @@ -559,7 +560,7 @@ Public Class MP4BoxDemuxer Next End If - If Not attachments.NothingOrEmpty AndAlso attachments(0).Enabled Then + If demuxAttachments AndAlso Not attachments.NothingOrEmpty AndAlso attachments(0).Enabled Then Using proc As New Proc proc.Project = proj proc.SkipString = "|" @@ -721,13 +722,15 @@ Public Class mkvDemuxer Dim stdout = ProcessHelp.GetConsoleOutput(Package.mkvmerge.Path, "--identify --ui-language en " + proj.SourceFile.Escape) + Dim attachments = GetAttachments(stdout) + Dim demuxAudio = (Not (TypeOf proj.Audio0 Is NullAudioProfile AndAlso TypeOf proj.Audio1 Is NullAudioProfile)) AndAlso MediaInfo.GetAudioCount(proj.SourceFile) > 0 Dim demuxSubtitles = MediaInfo.GetSubtitleCount(proj.SourceFile) > 0 - Dim attachments = GetAttachments(stdout) Dim demuxChapters = proj.DemuxChapters + Dim demuxAttachments = proj.DemuxAttachments Dim _videoDemuxing = proj.DemuxVideo If Not proj.NoDialogs AndAlso Not proj.BatchMode AndAlso @@ -787,23 +790,6 @@ Public Class mkvDemuxer End Using End If - Dim enabledAttachments = attachments.Where(Function(val) val.Enabled) - - If enabledAttachments.Count > 0 Then - Using proc As New Proc - proc.Project = proj - proc.Header = "Demux attachments" - proc.SkipString = "Progress: " - proc.WriteLog(stdout + BR) - proc.Encoding = Encoding.UTF8 - proc.Package = Package.mkvextract - proc.Arguments = proj.SourceFile.Escape + " --ui-language en attachments " + enabledAttachments.Select( - Function(val) val.ID & ":" + GetAttachmentPath(proj, val.Name).Escape).Join(" ") - proc.AllowedExitCodes = {0, 1, 2} - proc.Start() - End Using - End If - If p.ExtractTimestamps Then If Not p.ExtractTimestampsVfrOnly OrElse MediaInfo.GetVideo(proj.SourceFile, "FrameRate_Mode") = "VFR" Then Dim streamOrder = MediaInfo.GetVideo(proj.SourceFile, "StreamOrder").ToInt @@ -821,6 +807,25 @@ Public Class mkvDemuxer End If End If + If demuxAttachments Then + Dim enabledAttachments = attachments.Where(Function(val) val.Enabled) + + If enabledAttachments.Count > 0 Then + Using proc As New Proc + proc.Project = proj + proc.Header = "Demux attachments" + proc.SkipString = "Progress: " + proc.WriteLog(stdout + BR) + proc.Encoding = Encoding.UTF8 + proc.Package = Package.mkvextract + proc.Arguments = proj.SourceFile.Escape + " --ui-language en attachments " + enabledAttachments.Select( + Function(val) val.ID & ":" + GetAttachmentPath(proj, val.Name).Escape).Join(" ") + proc.AllowedExitCodes = {0, 1, 2} + proc.Start() + End Using + End If + End If + Log.Save(proj) End Sub diff --git a/Source/General/Project.vb b/Source/General/Project.vb index 7e59bd1f..2cb31e77 100644 --- a/Source/General/Project.vb +++ b/Source/General/Project.vb @@ -41,6 +41,7 @@ Public Class Project Public DefaultSubtitle As DefaultSubtitleMode Public DefaultTargetFolder As String = "" Public DefaultTargetName As String = "" + Public DemuxAttachments As Boolean = True Public DemuxAudio As DemuxMode = DemuxMode.All Public DemuxChapters As Boolean = True Public DemuxVideo As Boolean = False diff --git a/Source/My Project/AssemblyInfo.vb b/Source/My Project/AssemblyInfo.vb index 5115c678..82fad556 100644 --- a/Source/My Project/AssemblyInfo.vb +++ b/Source/My Project/AssemblyInfo.vb @@ -7,6 +7,6 @@ Imports System.Runtime.InteropServices - - + +