-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdovi_mp4_to_mkv.ps1
38 lines (32 loc) · 1.25 KB
/
dovi_mp4_to_mkv.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
$path = ""
$target = ""
$ffmpeg = "C:\Program Files\Jellyfin\Server"
while ($path -eq "" -or -not (Test-Path $path)) {
$path = Read-Host "Please enter a valid source path:"
$target = Read-Host "Please enter a valid target path:"
if (-not (Test-Path $path)) {
Write-Host "Invalid path. Please try again."
}
elseif (-not (Test-Path $target)){
Write-Host "Invalid path. Please try again."
}
else
{
$parentfolder = (Get-Item $path).Name
if ($target.EndsWith("\")) {
$targetFull = "$($target)$($parentfolder).dvmkv"
} else {
$targetFull = "$($target)\$($parentfolder).dvmkv"
}
#Write-Host "Creating new target directorty: $($targetFull)"
New-Item -ItemType Directory -Path "$targetFull"
$file_list = Get-ChildItem -Path $path -Include *.mp4 -File -Recurse -Exclude *dvmkv*
foreach($file in $file_list)
{
#Write-Host "$($file.FullName)"
$addon = "$($file.BaseName).dvmkv.mkv"
#Write-Host "$($targetFull)\$($addon)"
& $ffmpeg\ffmpeg.exe -y -i file:$($file.FullName) -map 0 -c copy -c:s srt -vtag hevc "$($targetFull)\$($addon)"
}
}
}