BrianDMG / conv2mp4

This Powershell script will recursively search through a user-defined file path and convert all videos of user-specified file types to MP4 with H264 video and AAC audio using ffmpeg. The purpose of this script is to reduce transcoding CPU load on a media server like Plex or Emby and increase video compatibility across platforms.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ERROR: Cannot bind argument to parameter 'Path' because it is an empty string.

alekdavis opened this issue · comments

At the very beginning of the run, the script generates this error:

Test-Path : Cannot bind argument to parameter 'Path' because it is an empty string.
At C:\conv2mp4\files\func\validate\ValidateOutPath.ps1:7 char:25
+     If (-Not (Test-Path $Path)) {                                                                                     +                         ~~~~~                                                                                             + CategoryInfo          : InvalidData: (:) [Test-Path], ParameterBindingValidationException                             + FullyQualifiedErrorId : ParameterArgumentValidationErrorEmptyStringNotAllowed,Microsoft.PowerShell.Commands.Test     PathCommand

I think it tries to validate the output path, which is empty (I assume that output path is only needed if the output file goes to a special folder, and I want conversion to be in place). So my config file is this:

use_out_path=false
out_path=

Bug? Feature? (I'm using v4.1.2 of the script)

P.S. Btw, instructions in the issue template suggest labeling bugs as such, but I think only repository owner can do this. I know I can label issues in my repositories, but I cannot in this one.

commented

Pinpointed this as an issue with the outPath validation, working on a fix as I type this.

Sweet. I also noticed that after a run, I am left with a lot of _NEW.mp4 files next to the original videos. The mp4 files seem to be final (i.e. they play fine), but for some reason the old files are not cleaned up. It does not happen always (some do get cleaned up), so not sure if this is related to something else or one of the bugs I reported.

commented

Just pushed a fix for this to develop branch, test that out and see if it resolves your issue. I would presume the files not being cleaned up properly is related to the outPath issue. This issue never cropped up on my personal machine because I have a placeholder path set for outPath, despite useOutPath being false, so I believe you having that value as empty is what was causing this issue. It's a bug either way, so thanks for taking the time to point it out.

Seems to be working now. No errors so far.