Add "Demux Attachments" to project options

This commit is contained in:
Dendraspis
2022-03-26 18:45:48 +01:00
parent 59211c743b
commit c737eb9580
5 changed files with 38 additions and 22 deletions
+1
View File
@@ -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
+9
View File
@@ -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)
+25 -20
View File
@@ -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
+1
View File
@@ -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
+2 -2
View File
@@ -7,6 +7,6 @@ Imports System.Runtime.InteropServices
<Assembly: AssemblyCopyright("Copyright (C) 2002-2022 StaxRip Authors")>
<Assembly: ComVisible(False)>
<Assembly: Guid("54d5dc0f-6ba7-42f0-a82f-9c71d561cb8b")>
<Assembly: AssemblyVersion("2.10.18")>
<Assembly: AssemblyFileVersion("2.10.18")>
<Assembly: AssemblyVersion("2.10.19")>
<Assembly: AssemblyFileVersion("2.10.19")>
<Assembly: AssemblyDescription("Video encoding app")>