So, I want to create a Powershell or Batch file (whichever works best for the task), that I can paste in a folder and after executing it, will start to use FFmpeg to encode all videos
The part that works (in .bat):
for %%a in ("*.mkv") do(
ffmpeg -i "%%a" -c:v libx265 -c:a copy -x265-params crf=25 "%%a [encoded].mkv"
pause)
This works, but in some folders, I already have [encoded] files. I'd like for the script to skip these files. I asked in reddit and received the following script:
for %%a in ("*.mkv") do (
if not exist "%%a [encoded].mkv" ffmpeg -i "%%a" -c:v libx265 -c:a copy -x265-params crf=25 "%%a [encoded].mkv"
pause)
I tried the script, but every file got encoded, even if it had the [encoded] in it. After I pointed that out, they told me that I should probably switch to PowerShell and gave a link to a StackOverflow question:
You probably need to switch to PowerShell Find files which does not contains selected string Then do a foreach in what is returned to execute the ffmpeg command on it.
but I don't know how to code in PowerShell (never used it before) Would a .bat file even work? If yes, how could I write it? And if a PowerShell script would be the better option, how would I code it?
Any help and answers are appreciated.