From e0bddb98902ab4efa4ef38da8536c2fdaeb60589 Mon Sep 17 00:00:00 2001 From: MilesTEG Date: Sun, 31 Oct 2021 11:02:17 +0100 Subject: [PATCH] =?UTF-8?q?Petites=20corrections=20mineures,=20et=20ajour?= =?UTF-8?q?=20de=20messages=20de=20d=C3=A9but=20et=20de=20fin=20de=20trait?= =?UTF-8?q?ement=20de=20fichier.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...e one MKV Audio with another video MKV.ps1 | 41 ++++++++++++------- 1 file changed, 27 insertions(+), 14 deletions(-) diff --git a/Scripts-Divers/Batch Merge one MKV Audio with another video MKV.ps1 b/Scripts-Divers/Batch Merge one MKV Audio with another video MKV.ps1 index 4130703..821efa8 100644 --- a/Scripts-Divers/Batch Merge one MKV Audio with another video MKV.ps1 +++ b/Scripts-Divers/Batch Merge one MKV Audio with another video MKV.ps1 @@ -33,7 +33,7 @@ $sourceDirectory_2 = "PATH_TO_SOURCE_2" $destinationDirectory = "PATH_TO_DESTINATION" # Rename output file with this settings : -$chain_to_search = '(.*).S(\d*)E(\d*).(.*)H.264(.*)' +$chain_to_search = '(.*) - S(\d*)E(\d*) - (.*)x264(.*)' $chain__to_replace = '$1 - S$2E$3 - $4x265-10bits$5--Reencoded' # The filenames must be like : blabla.S00E00.blabla.H.264.blabla # They will be renamed to : blabla - S00E00 - blabla.x265-10bits.blabla--Reencoded @@ -42,7 +42,7 @@ $chain__to_replace = '$1 - S$2E$3 - $4x265-10bits$5--Reencoded' # Is there an external subtitle ? Set the number of .SRT (0 - 2) # It's exclusive, no internal SUB will be proceed.. -$NB_External_SUB = 0 +$NB_External_SUB = 2 # Extension without the . $MkvExtension = "mkv" @@ -57,10 +57,10 @@ $merged_SUFFIX_name = "False" # ================== AUDIO ================== # Track 1 = Audio n°1 # Name and language of Audio Track n°1 -$AudioTrackName_1 = "1:English - DDP 5.1" +$AudioTrackName_1 = "1:English - DTS-HD MA" $AudioLang_1 = "1:en" $AudioTrack_1_default = "1:yes" -$file_1_options = "--no-video" +#$file_1_options = "--no-video" @@ -96,7 +96,7 @@ if ( $NB_External_SUB -ne 0 ) { $track_order = "1:0,0:1,2:0" } elseif ( $NB_External_SUB -eq 2 ) { - $track_order = "1:0,0:1,2:0;3,0" + $track_order = "1:0,0:1,2:0,3:0" } } else { @@ -192,7 +192,7 @@ if ($Count_1 -eq $Count_2) { # Exit # } # ######################### - +$compteur = 1 # for ($i = $filename_ep_start; $i -lt $filename_ep_final+1; $i++) { Foreach ($MKV_1 in $MKV_1_List) { @@ -212,10 +212,10 @@ Foreach ($MKV_1 in $MKV_1_List) { $MKV_2 = $sourceDirectory_2 + "\" + $MKV_2_name + ".$MkvExtension" if ( $NB_External_SUB -ne 0 ) { - $SRT_1_Name = $MKV_1_name - $SRT_1 = $sourceDirectory_1 + "\" + $SRT_1_name + ".$SubExtension_1" + $SRT_1_Name = $MKV_1_name + ".$SubExtension_1" + $SRT_1 = $sourceDirectory_1 + "\" + $SRT_1_name $SRT_2_Name = $MKV_1_name + ".$SubExtension_2" - $SRT_2 = $sourceDirectory_1 + "\" + $SRT_2_name + ".$SubExtension_2" + $SRT_2 = $sourceDirectory_1 + "\" + $SRT_2_name } ######################################################### @@ -282,7 +282,7 @@ Foreach ($MKV_1 in $MKV_1_List) { # Title for the video track and for the destination file #$VideoTrackName = $MKV_1_name -replace '(.*).S(\d*)E(\d*).(.*)H.264(.*)', '$1 - S$2E$3 - $4x265-10bits$5--Reencoded' - $VideoTrackName_BIS = $MKV_1_name -replace $chain_to_search, $chain__to_replace + $VideoTrackName = $MKV_1_name -replace $chain_to_search, $chain__to_replace #Set Output File Name #$Output = $Name + '___MERGED' + '.mkv' @@ -295,7 +295,9 @@ Foreach ($MKV_1 in $MKV_1_List) { write-host "Should be set to True or False.`nScript is exiting now..." -foreground "white" Exit } - + # write-host "Output file will be :" -foreground "white" + # write-host "$Output" + # write-host "--" #Execute # Keep Audio/Subtitles/tags from MKV_1 + Only video from MKV_2 @@ -310,7 +312,10 @@ Foreach ($MKV_1 in $MKV_1_List) { --language "0:en" --track-name "0:$VideoTrackName" --default-track "0:yes" "$MKV_2" #> - + Write-Host "" -ForegroundColor "black" -BackgroundColor "white" + Write-Host "Traitement du fichier n° $compteur / $Count_1..." -ForegroundColor "black" -BackgroundColor "white" + Write-Host "" -ForegroundColor "black" -BackgroundColor "white" + if ( $NB_External_SUB -eq 1 ) { <# Command to edit & $MKVMerge --title "$VideoTrackName" --track-order "$track_order" -o "$Output" @@ -336,7 +341,7 @@ Foreach ($MKV_1 in $MKV_1_List) { --language "$AudioLang_2" --track-name "$AudioTrackName_2" --default-track "$AudioTrack_2_default" "$MKV_1" - -no-audio --no-track-tags --no-global-tags + --no-audio --no-track-tags --no-global-tags --language "0:en" --track-name "0:$VideoTrackName" --default-track "0:yes" "$MKV_2" --sub-charset "$Extsub_charset_1" --language "$ExtSubTrackLang_1" --track-name "$ExtSubTrackName_1" --default-track "$ExtSubTrack_1_default" @@ -345,7 +350,12 @@ Foreach ($MKV_1 in $MKV_1_List) { "$SRT_2" #> + # Write-Host "Commande qui va être lancée : " -foreground "green" + # Write-Host "MKVMerge --title "$VideoTrackName" --track-order "$track_order" -o "$Output" --no-video --no-subtitles --language "$AudioLang_1" --track-name "$AudioTrackName_1" --default-track "$AudioTrack_1_default" --language "$AudioLang_2" --track-name "$AudioTrackName_2" --default-track "$AudioTrack_2_default" "$MKV_1" --no-audio --no-track-tags --no-global-tags --language "0:en" --track-name "0:$VideoTrackName" --default-track "0:yes" "$MKV_2" --sub-charset "$ExtSub_charset_1" --language "$ExtSubTrackLang_1" --track-name "$ExtSubTrackName_1" --default-track "$ExtSubTrack_1_default" "$SRT_1"" -foreground "green" + + & $MKVMerge --title "$VideoTrackName" --track-order "$track_order" -o "$Output" --no-video --no-subtitles --language "$AudioLang_1" --track-name "$AudioTrackName_1" --default-track "$AudioTrack_1_default" --language "$AudioLang_1" --track-name "$AudioTrackName_1" --default-track "$AudioTrack_1_default" "$MKV_1" --no-audio --no-track-tags --no-global-tags --language "0:en" --track-name "0:$VideoTrackName" --default-track "0:yes" "$MKV_2" --sub-charset "$ExtSub_charset_1" --language "$ExtSubTrackLang_1" --track-name "$ExtSubTrackName_1" --default-track "$ExtSubTrack_1_default" "$SRT_1" --sub-charset "$ExtSub_charset_2" --language "$ExtSubTrackLang_2" --track-name "$ExtSubTrackName_2" --default-track "$ExtSubTrack_2_default" "$SRT_2" + } else { @@ -360,7 +370,10 @@ Foreach ($MKV_1 in $MKV_1_List) { } - + + Write-Host "" -ForegroundColor "black" -BackgroundColor "white" + Write-Host "Fin du traitement du fichier n° $compteur / $Count_1." -ForegroundColor "black" -BackgroundColor "white" + Write-Host "" -ForegroundColor "black" -BackgroundColor "white" If (Test-Path $Output) { #Clean Up