You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: media/Join-TsFile.ps1
+23-8Lines changed: 23 additions & 8 deletions
Original file line number
Diff line number
Diff line change
@@ -1,19 +1,22 @@
1
1
functionJoin-TsFile {
2
2
<#
3
3
.SYNOPSIS
4
-
Helper script for concatenating .ts files
4
+
Concatenates .ts video files in a specified location into a single output file
5
5
6
6
.DESCRIPTION
7
-
This script will join *.ts files from a given directory or list of files passed as an argument
7
+
This cmdlet concatenates .ts video files from a specified directory or a list of files into a single output file. The files are processed in chunks to avoid command line length limitations, making the script suitable for handling a large number of files. If a FilesLocation is provided, it sorts the .ts files by creation time. If Files are provided, it uses that list instead. The output file is named "out.ts" by default.
8
8
9
9
.PARAMETERFilesLocation
10
-
Location of the folder where your DLLs live.
10
+
The path to the directory containing the .ts files to concatenate. If not specified, the cmdlet will use the files provided in the -Files parameter.
11
11
12
12
.PARAMETERFiles
13
-
Location of the folder where your DLLs live.
13
+
An array of System.IO.FileInfo objects representing the .ts files to concatenate. If specified, this parameter overrides FilesLocation.
14
14
15
15
.PARAMETEROutFile
16
-
Location of the folder where your DLLs live.
16
+
The name of the output file. By default, this is set to "out.ts".
17
+
18
+
.PARAMETERChunkSize
19
+
The number of files to process in each chunk. This helps to avoid exceeding the command line length limit when concatenating files.
17
20
18
21
.EXAMPLE
19
22
Join-TsFile "c:\test\"
@@ -22,14 +25,21 @@ Joins all *.ts files found in a "c:\test\" directory
22
25
.EXAMPLE
23
26
Join-TsFile -Files (gci "c:\test\2")
24
27
Joins all files passed as with Files argument
28
+
29
+
.NOTES
30
+
The cmdlet changes the current location to the directory specified by FilesLocation and restores the original location after the operation is complete.
31
+
If the total command length is too long for the cmd /c copy operation, reducing the ChunkSize may help avoid errors.
32
+
25
33
#>
26
34
param (
27
35
[Parameter(Mandatory=$false,Position=0)]
28
36
[string]$FilesLocation,
29
37
[Parameter(Mandatory=$false,Position=1)]
30
38
[System.IO.FileInfo[]]$Files,
31
39
[Parameter(Mandatory=$false,Position=2)]
32
-
[string]$OutFile="out.ts"
40
+
[string]$OutFile="out.ts",
41
+
[Parameter(Mandatory=$false,Position=3)]
42
+
[int]$ChunkSize=1000
33
43
)
34
44
35
45
$location=Get-Location
@@ -42,9 +52,14 @@ Joins all files passed as with Files argument
0 commit comments