I have 2 scripts that I created with the help of phind because I don't understand programming. (powershell se)
First script extract all .ass subs and convert them to .srt subs.
Every day I need to convert .ass subtitles to .srt in a standard size that can be read and mux them all in the same .mkv fileCode:$path = Read-Host "Insira o caminho dos arquivos .mkv" $mkvFiles = Get-ChildItem -Path $path -Filter *.mkv foreach ($file in $mkvFiles) { $assFileName = Join-Path -Path $path -ChildPath ($file.BaseName + ".ass") & 'ffmpeg' -y -i $file.FullName -map 0:s:0 -c copy $assFileName } $assFiles = Get-ChildItem -Path $path -Filter *.ass foreach ($file in $assFiles) { $srtFileName = Join-Path -Path $path -ChildPath ($file.BaseName + ".srt") & 'ffmpeg' -y -i $file.FullName -f srt $srtFileName }
and delete all old .ass subtitles from this file
The problem is that the first script that extracts the subtitle is only working for the first subtitle and not all of them. The script should be able to identify all subtitles and do the same extract and convert process for all of them. I would also like the script to make the subtitles larger in standard size, because when converting the subtitles they become really tiny.
The second script should mux all the already converted subtitles into a copy of the .mkv file in case I need a backup and remove the old .ass subtitles, leaving only the new .srt ones. But it's not doing everything either, it's just muxing without deleting the old ones (.ass files).
Is there a way to fix it and make it work in a loop with all the videos in the folder? Automating this process would help me a lot. It's really tiring to do all this manually.Code:$path = Read-Host "Insira o caminho dos arquivos .mkv" $mkvFiles = Get-ChildItem -Path $path -Filter *.mkv foreach ($file in $mkvFiles) { $srtFileName = Join-Path -Path $path -ChildPath ($file.BaseName + ".srt") $outputFileName = Join-Path -Path $path -ChildPath ("new_" + $file.Name) & 'mkvmerge' -o $outputFileName --default-track 0:yes --language 0:eng $file.FullName $srtFileName }
Would it also be possible to run both scripts at once or do I need to do it in parts?
Please understand that I'm new to programming, I'm just looking for a way to automate this process.
+ Reply to Thread
Results 1 to 1 of 1
Similar Threads
-
ffmpeg Burn ASS Subtitle Batch Script
By Daringbaaz in forum Newbie / General discussionsReplies: 3Last Post: 12th Jun 2021, 01:45 -
ASS to SRT
By agon024 in forum SubtitleReplies: 6Last Post: 11th Apr 2021, 16:26 -
Convert 2 .srt languages in 1 .ass
By islogged in forum SubtitleReplies: 4Last Post: 24th Nov 2020, 12:16 -
Convert sub to srt/smi/psb/ssa/ass/son with Subresync
By FireWalker in forum User guidesReplies: 14Last Post: 12th Jul 2019, 01:03 -
Merge Two .ass Files in Aegisub
By Draculestia in forum SubtitleReplies: 2Last Post: 5th Mar 2019, 04:01