GithubHelp home page GithubHelp logo

briandmg / conv2mp4 Goto Github PK

View Code? Open in Web Editor NEW
126.0 18.0 23.0 403 KB

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.

PowerShell 85.36% Dockerfile 4.20% CSS 10.43%
plex-server ffmpeg handbrakecli plex-library powershell-script ffprobe video plex plex-media-server aac

conv2mp4's People

Contributors

briandmg avatar spacefanatic avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

conv2mp4's Issues

Option to not keep subtitles?

Wondering if an option could be added that would allow the user to decide if subtitles are kept or not when running the script?

Adding brackets to file names breaks deletion of old file?

So I started putting brackets in the file names to organize it more and now it won't delete the old file.

It says it deletes the file but it doesn't and it's not because it was in use or anything like that, also says 'same file size' but as you can see they're different.

shot_170802_124131

Spaces Not Handled in FFmpeg Path

Apologies as I'm not very familiar with GitHub etiquette. I have found a bug and can suggest code modification but couldn't seem to figure out how to start a pull request.

It appears that spaces are not properly handed in the FFmpeg path variable. In digging through the code, spaces in the Handbrake path are properly handled.

My FFmpeg path is set to C:\Program Files (x86)\VideoProc

At line 39 in Get-Codec.ps1, this code will fail:
$ffprobeCMD = cmd.exe /c "$ffprobe $ffprobeArgs"

The error indicates a problem with incorrect path quoting .
cmd.exe : 'C:\Program' is not recognized as an internal or external command,

Updating the code to this allows the path to be properly quoted:
$ffprobeCMD = cmd.exe /c ""$ffprobe" $ffprobeArgs"

Line 120 in ConvertFile.ps1 should be updated to
$ffCMD = cmd.exe /c ""$ffmpeg" $ffArgs"

Line 14 in GetAudioStreams.ps1 should be updated to

[int[]] $audioStreamArray = cmd.exe /c ""$ffprobe" $ffprobeArgs"

The post is stripping out the escape characters, but quoting the reply will show their placement...

use_out_path option not working correctly

First time submitting an issue on github - please excuse any errors.

When an output path is specified in the config file, the source file is deleted but the target file never gets created due to the out_path variable having no value.

See the below log file.

image

In the conv2mp4-ps.ps1 file - line 49 reads

$cfg.out_path = $baseout_path + $fileSubDirs;

When I changed it to

$cfg.out_path = $cfg.out_path + $fileSubDirs;

It works as expected.

Great script though - thanks for your hard work! :)

Could you add a way to call audio filters in the script?

So I've been digging around and finally found that ffmpeg can do audio normalization and it can be done using audio filters

https://ffmpeg.org/ffmpeg-filters.html#Audio-Filters

One such filter I'd like to be able to do is loudnorm

https://ffmpeg.org/ffmpeg-filters.html#loudnorm

If you don't want to implement this or if its just to much trouble I'll understand of course, just thought it'd be a nice feature as I've run across tons of files that just don't get loud enough or are too loud.

All I'm really wondering is if there'd be a way to add a section in the variables where I could add something like 'loudnorm -i -25' and it'd pass that to ffmpeg's audio filter.

Option for script to make new log file not overwrite existing?

I have this running automatically everyday and it's been awesome so far but I was thinking it'd be nice if I could see log files from previous script runs. I don't know if anyone would find that useful but I think I'd be nice.

If it's a bunch of work to rewrite stuff though then its fine, just a thought.

move already encoded mp4 video

hi i'm sorry to asking you this your code is absolutely perfect but, if someday you have some free time is it possible to modify the code a bit so that if an output path is specified it move already encoded video instead of skipping them ? thanks a lot i gave you a star because your code is absolutely incredible

Multiple errors when running latest version of script.

The below error's are presented when attempting to convert any files.

`ConvertFile : Cannot process argument transformation on parameter 'KeepSubs'. Cannot convert
value "System.String" to type "System.Management.Automation.SwitchParameter". Boolean parameters
accept only Boolean values and numbers, such as $True, $False, 1 or 0.
At C:\Scripts\FFMPEG\conv2mp4-ps-master\conv2mp4-ps.ps1:104 char:54

  • ... ConvertFile -ConvertType Audio -KeepSubs:$cfg.keep_subtitles
  •                                                   ~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : InvalidData: (:) [ConvertFile], ParameterBindingArgumentTransformat
      ionException
    • FullyQualifiedErrorId : ParameterArgumentTransformationError,ConvertFile

cmd.exe : '-i' is not recognized as an internal or external command,
At C:\Scripts\FFMPEG\conv2mp4-ps-master\files\func\GetAudioStreams.ps1:11 char:33

  • [int[]] $audioStreamArray = cmd.exe /c "$ffprobe $ffprobeArgs"
    
  •                             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : NotSpecified: ('-i' is not rec...ternal command,:String) [], Remote
      Exception
    • FullyQualifiedErrorId : NativeCommandError

operable program or batch file.
Cannot index into a null array.
At C:\Scripts\FFMPEG\conv2mp4-ps-master\files\func\GetAudioStreams.ps1:14 char:9

  • If ($audioStreamArray[$audioStreamArray.Length-1] -ne 2) {
    
  •     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : InvalidOperation: (:) [], RuntimeException
    • FullyQualifiedErrorId : NullArra`

Extract embedded subtitles?

Looks like the script does not care about embedded subtitle tracks as it is now, any chance it could extract them as .srt files or maybe even embed them back into the new files?

EDIT: Looks like multiple audiotracks isn't working either.

Customize Handbreak Settings

Is the script modifiable in a way we can change Handbrake settings to our liking (ie. I want to encode files to H265 instead of H264)?

Error running on Raspberry Pi

Love your script. I have it running on one of my windows boxes right now. I was trying to get it up and running on an R-Pi that I have and keep getting an error that I can't quite figure out.
The script starts up and catalogs all the shows then presents this error.

06/19/2017 19:29:31 Processing - //home/pi/Shared/DESKTOP-2/Tvshows/A Series of Unfortunate Events/A Series of Unfortunate Events - 1x02 - The Bad Beginning Part Two.mkv
06/19/2017 19:29:31 File 1 of 1298 - Total queue 0.08%

Traceback (most recent call last):
File "/home/pi/Documents/Plex Media Convert/conv2mp4-py.py", line 411, in
codec_discovery()
File "/home/pi/Documents/Plex Media Convert/conv2mp4-py.py", line 161, in codec_discovery
get_duration_temp = humanize_time(head)
File "/home/pi/Documents/Plex Media Convert/conv2mp4-py.py", line 129, in humanize_time
mins, secs = divmod(int(secs), 60)
ValueError: invalid literal for int() with base 10: ''

I have attached both the script and the output.

Regards,
Eric

code.txt
error.txt

MKV deleted without successful conversion

I have found an issue where ffmpeg fails to do the conversion. It fails over to handbrake. However, during the process handbrake crashes and the script believes the conversion completed. However, the MP4 was not created and the MKV is deleted. Should add a check if the MP4 actually exists.

10/25/16 09:36:32 Processing - E:\Video Files\Movies\Zootopia.2016.1080p.BluRay.x264.DTS-HD.MA7.1-iFT\Zootopia.2016.1080p.BluRay.x264.DTS-HD.MA7.1-iFT.mkv
10/25/16 09:36:32 File 156 of 167 - 93.41%
10/25/16 09:36:33 ffmpeg completed
10/25/16 09:36:33 Plex library refreshed
10/25/16 09:36:33 EXCEPTION: New file is over 25% smaller (-12576MB). E:\Video Files\Movies\Zootopia.2016.1080p.BluRay.x264.DTS-HD.MA7.1-iFT\Zootopia.2016.1080p.BluRay.x264.DTS-HD.MA7.1-iFT.mp4 deleted.
10/25/16 09:36:33 FAILOVER: Re-encoding E:\Video Files\Movies\Zootopia.2016.1080p.BluRay.x264.DTS-HD.MA7.1-iFT\Zootopia.2016.1080p.BluRay.x264.DTS-HD.MA7.1-iFT.mkv with Handbrake.
10/25/16 09:51:07 Handbrake finished.
10/25/16 09:51:07 E:\Video Files\Movies\Zootopia.2016.1080p.BluRay.x264.DTS-HD.MA7.1-iFT\Zootopia.2016.1080p.BluRay.x264.DTS-HD.MA7.1-iFT.mkv deleted.

Here is the crash

Log Name: Application
Source: Windows Error Reporting
Date: 10/25/2016 9:51:07 AM
Event ID: 1001
Task Category: None
Level: Information
Keywords: Classic
User: N/A
Computer: deepspace9
Description:
Fault bucket 120410669831, type 4
Event Name: APPCRASH
Response: Not available
Cab Id: 0

Problem signature:
P1: HandBrakeCLI.exe
P2: 0.0.0.0
P3: 56bcf887
P4: HandBrakeCLI.exe
P5: 0.0.0.0
P6: 56bcf887
P7: c0000005
P8: 000000000010a863
P9:
P10:

Attached files:
?\C:\ProgramData\Microsoft\Windows\WER\Temp\WER867F.tmp.WERInternalMetadata.xml

These files may be available here:
C:\ProgramData\Microsoft\Windows\WER\ReportArchive\AppCrash_HandBrakeCLI.exe_372f4be685e78be3b774a8b0646045e287a5f24d_3933a9e0_62bfd5f7

Analysis symbol:
Rechecking for solution: 0
Report Id: fe37c6ce-709e-4ff2-b39f-bf09cb52bc4c
Report Status: 0
Hashed bucket: 2b835bf7d5f95ae3ebb89458c69cfd71
Event Xml:



1001
4
0
0x80000000000000

30261
Application
deepspace9



120410669831
4
APPCRASH
Not available
0
HandBrakeCLI.exe
0.0.0.0
56bcf887
HandBrakeCLI.exe
0.0.0.0
56bcf887
c0000005
000000000010a863





?\C:\ProgramData\Microsoft\Windows\WER\Temp\WER867F.tmp.WERInternalMetadata.xml
C:\ProgramData\Microsoft\Windows\WER\ReportArchive\AppCrash_HandBrakeCLI.exe_372f4be685e78be3b774a8b0646045e287a5f24d_3933a9e0_62bfd5f7


0
fe37c6ce-709e-4ff2-b39f-bf09cb52bc4c
0
2b835bf7d5f95ae3ebb89458c69cfd71

Force additional AAC (stereo) audio stream?

I'm curious if there's a way to make sure it always creates a Stereo audio stream to be chosen. Was watching at my girlfriend's place through TV speakers and the quality was not so great with the only 5.1 stream, obviously. Love the script! Thanks!

ConvertFrom-Yaml

ConvertFrom-Yaml : The term 'ConvertFrom-Yaml' is not recognized as the name of a cmdlet, function, script file, or
operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try
again.
At E:\Temp\conv2mp4-5.1.0\conv2mp4-5.1.0\conv2mp4.ps1:14 char:35
+ $prop = Get-Content "$propFile" | ConvertFrom-Yaml
+                                   ~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (ConvertFrom-Yaml:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

Convert-Path : Cannot bind argument to parameter 'Path' because it is an empty string.
At E:\Temp\conv2mp4-5.1.0\conv2mp4-5.1.0\conv2mp4.ps1:18 char:25
+ $cfgFile = Convert-Path "$($prop.paths.files.cfg)"
+                         ~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidData: (:) [Convert-Path], ParameterBindingValidationException
    + FullyQualifiedErrorId : ParameterArgumentValidationErrorEmptyStringNotAllowed,Microsoft.PowerShell.Commands.Conv
   ertPathCommand

ConvertFrom-Yaml : The term 'ConvertFrom-Yaml' is not recognized as the name of a cmdlet, function, script file, or
operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try
again.
At E:\Temp\conv2mp4-5.1.0\conv2mp4-5.1.0\conv2mp4.ps1:19 char:33
+ $cfg = Get-Content "$cfgFile" | ConvertFrom-Yaml
+                                 ~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (ConvertFrom-Yaml:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

Remove-Variable : Cannot find a variable with the name 'cfgFile'.
At E:\Temp\conv2mp4-5.1.0\conv2mp4-5.1.0\conv2mp4.ps1:20 char:1
+ Remove-Variable -Name cfgFile
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (cfgFile:String) [Remove-Variable], ItemNotFoundException
    + FullyQualifiedErrorId : VariableNotFound,Microsoft.PowerShell.Commands.RemoveVariableCommand

Convert-Path : Cannot bind argument to parameter 'Path' because it is an empty string.
At E:\Temp\conv2mp4-5.1.0\conv2mp4-5.1.0\conv2mp4.ps1:32 char:31
+ $preflightPath = Convert-Path "$($prop.paths.init.preflight)"
+                               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidData: (:) [Convert-Path], ParameterBindingValidationException
    + FullyQualifiedErrorId : ParameterArgumentValidationErrorEmptyStringNotAllowed,Microsoft.PowerShell.Commands.Conv
   ertPathCommand

The expression after '.' in a pipeline element produced an object that was not valid. It must result in a command
name, a script block, or a CommandInfo object.
At E:\Temp\conv2mp4-5.1.0\conv2mp4-5.1.0\conv2mp4.ps1:33 char:3
+ . $preflightPath
+   ~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : BadExpression

Convert-Path : Cannot bind argument to parameter 'Path' because it is an empty string.
At E:\Temp\conv2mp4-5.1.0\conv2mp4-5.1.0\conv2mp4.ps1:36 char:32
+ $buildQueuePath = Convert-Path "$($prop.paths.init.buildqueue)"
+                                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidData: (:) [Convert-Path], ParameterBindingValidationException
    + FullyQualifiedErrorId : ParameterArgumentValidationErrorEmptyStringNotAllowed,Microsoft.PowerShell.Commands.Conv
   ertPathCommand

The expression after '.' in a pipeline element produced an object that was not valid. It must result in a command
name, a script block, or a CommandInfo object.
At E:\Temp\conv2mp4-5.1.0\conv2mp4-5.1.0\conv2mp4.ps1:37 char:3
+ . $buildQueuePath
+   ~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : BadExpression

Write-Statistics : The term 'Write-Statistics' is not recognized as the name of a cmdlet, function, script file, or
operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try
again.
At E:\Temp\conv2mp4-5.1.0\conv2mp4-5.1.0\conv2mp4.ps1:224 char:1
+ Write-Statistics
+ ~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (Write-Statistics:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

Write-Failures : The term 'Write-Failures' is not recognized as the name of a cmdlet, function, script file, or
operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try
again.
At E:\Temp\conv2mp4-5.1.0\conv2mp4-5.1.0\conv2mp4.ps1:225 char:1
+ Write-Failures
+ ~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (Write-Failures:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException


Finished
Remove-LockFile : The term 'Remove-LockFile' is not recognized as the name of a cmdlet, function, script file, or
operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try
again.
At E:\Temp\conv2mp4-5.1.0\conv2mp4-5.1.0\conv2mp4.ps1:232 char:1
+ Remove-LockFile
+ ~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (Remove-LockFile:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

Laggy / Stuttering .mp4 file. Tried the Previous release too.

Log File:

12/04/16 12:06:00 Processing - C:\Users\Zack\Desktop\Encode\Monsters (2010).avi
12/04/16 12:06:00 File 1 of 1 - 100%
12/04/16 12:12:16 ffmpeg completed
12/04/16 12:12:17 Plex library refreshed
12/04/16 12:12:18 New file is 34MB smaller. C:\Users\Zack\Desktop\Encode\Monsters (2010).avi deleted.

  1. Why didn't it use Handbrake? Or did it?

  2. Stutter looks like this: https://youtu.be/za88hVrILYo
    Codec information about the file: http://i.imgur.com/G9tn4nM.png

To work with Emby

Hi Brian

Just found your great script - will be testing later.

Small request - as i don't use Plex but Emby could you add a switch to "disable" the plex options?
I can comment out the plex options for now.

Emby has real time monitoring so don't need to kick the server to notice things have changed :)

"Past duration 0.999992 too large" repeated many times

Just discovered your great tool - thanks for your hard work in putting this together.

I'm running v3.0 Snapshot 04122017. It's been working well, but today the following error showed up and repeated quite a few times. I was able to capture some of the output just before it stopped.

https://pastebin.com/WHyPdSwS

I believe ffmpeg displays this to inform about "possible rate control distortion", but I'm not sure if it was caused by the script, the media file or ffmpeg.

Feature Request

I'm not sure where to post this. I was wondering if a similar script could be created to do the following:

  1. Check folder for .mp4, if exist, then ignore
  2. Convert mkv to 720p mp4 with AAC audio
  3. If 1080p exist in mkv filename, replace with 720p for new mp4 filename, if not exist, add 720p in new filename.
  4. Keep all files
  5. Option to remove non-English subs if exist

Clarification on which files get deleted?

Hi Brian

Do the original video files that get encoded always get deleted as well as any file extension(s) matching files you specify in the config file?

Or is it only the file extension(s) matching file types specified in the config file?

No errors in conversion but the generated file is not playable

I am not sure if this is a problem with ffmpeg or with the way it gets called, but I just converted one MKV file and conversion went fine:

>>>>> New Session (started 11/24/20 14:23:45)

There are 1 file(s) in the queue:

1. \\NAS\Share\XXX.mkv

------------------------------------------------------------------------------------
11/24/20 14:23:45 Processing - \\NAS\Share\XXX.mkv
11/24/20 14:23:45 File 1 of 1 - Total queue 100%
11/24/20 14:23:48 Video: H264, Audio: AC3. Encoding audio to AAC
11/24/20 14:38:47 Plex libraries refreshed
11/24/20 14:38:50 \\NAS\Share\XXX.mkv deleted.
11/24/20 14:38:50 \\NAS\Share\XXX.mp4 created.
11/24/20 14:38:50 New file is 474.20MB smaller.
11/24/20 14:38:50 Current cumulative storage difference: -474.20MB

____________________________________________________________________________________

11/24/20 14:38:50 Total cumulative storage difference: -474.20MB

02:14:58 of video processed in 00:15:05
Average conversion speed of 8.94x

Audio-only encodes: 1

The original file was fine, but when I tried to play the MP4, it would not work with any video player (tried Plex, VLC). I checked MediaInfo and all streams are gone (the MKV has one video stream, three audio streams, and five subtitle streams). Tried to run the converter twice just in case and the result was the same.

Refactor encoding functions

There is a lot of duplicate code in the 5 encoding functions which makes it tough to add more functionality on the use of ffmpeg. I combined them into a single encoding function that also got rid of the numbered arguments (ie $ffArg01, $ffArg02) which also makes it tough to handle ffmpeg options. This will help resolve issue #16 & issue #21 . I also moved the functions to the top of the script which is standard for powershell scripts since its a forward declaration language. With the new encoding function, I was able to set the 'title' metadata with ffmpeg which sometimes causes issues with Plex when the title gets set to something like "Kingsman.The.Golden.Circle.2017.1080p.BluRay.x264-SPARK", it would instead be set to "Kingsman The Golden Circle"

Pull request #34

Question: Is this lossless?

Haven't seen a straightforward answer to this anywhere. Been trying to parse through your code to see if I can find an answer to this, but it looks like it would take a decent understanding of the ffmpeg and Handbrake CLIs to really figure it out that way. In the hopes that this will get me my answer quicker, I decided to just ask.

Is the ffmpeg conversion lossless? (I assume it is when possible. If not always possible, some information on when it wouldn't be would be helpful.)

What are possible triggers for "conversion failure" that would cause Handbrake to kick in?

Is the Handbrake conversion lossless? (I assume it is not, since my limited experience in Handbrake is that lossless encoding would increase the filesize dramatically.)

Request - Queuing

Could you build queuing into your script?
So say the script is already running and it gets started again, the new script will wait until the other exits to continue?
or it saves the path that the other one wanted to process and process that path once its done with its files.

This would prevent the script from running two+ instances of ffmpeg or handbrake

Same 3 files fail to convert every single time I run the script.

I have 3 files that consistently fail to convert; what can be done to correct this as I have the script running as a scheduled task and it goes through the attempt to convert these 3 files every single time, resulting in failure and wasted time to get to the actual files that need to be converted to .mp4.

01/16/18 22:06:04 EXCEPTION: New file is over 25% smaller (-457.88MB) .mp4 deleted. 01/16/18 22:06:04 FAILOVER: Re-encoding .mkv with Handbrake. 01/16/18 22:08:08 Handbrake finished. 01/16/18 22:08:08 ERROR: New file was too small (-603.24MB). 01/16/18 22:08:08 Deleted new file and retained .mkv.

Function Comments Incorrect

All Encoding Functions have the same description - likely copied/pasted without being updated :)

If a file video codec is already H264, but audio codec is not AAC, use these arguments

Function EncodeBoth

If a file video codec is already H264, but audio codec is not AAC, use these arguments

Function EncodeVideo

If a file video codec is already H264, but audio codec is not AAC, use these arguments

Function EncodeAudio

Can't automate with task scheduler anymore

So maybe I'm just being really dumb today but I noticed the script hasnt run at all through task scheduler since I upgraded to this new version, I was using a .vbs script to run it so no window would pop up and that doesn't work anymore.

I also tried to do it exactly how you suggest on the in the readme and still no luck.

Is it working for anyone or did you change something that might be messing with it?

Only changes I know of is the optional subtitles and the addition of the config file but I don't see why those would cause problems.

Request - Creating Multiple Outputs

FFmpeg supports multiple outputs for a single input like so:

ffmpeg -i input \
-s 1280x720 -acodec … -vcodec … output1 \
-s 640x480 -acodec … -vcodec … output2 \
-s 320x240 -acodec … -vcodec … output3

It would be very comfortable to have this option in conv2mp4 to encode videos in multiple resolutions at once. We could produce optimized versions for different devices, like TV and mobile. Is this possible?

No files to convert found, log file still written?

So the new option to continue to write to the same log file instead of overwriting it is awesome so thank you for that quick implementation.

But I noticed that when nothing is found for conversion a section is still added to the log file and if your like me and have this running automatically every hour, half the file is literally just the script saying there was no files found for conversion.

For someone who just runs this manually I can see where the script saying it found nothing is very helpful, but in an automatic setup it doesn't really serve a purpose as far as I can tell.

v3.1.2 - Still same file size

I don't know why but it's still saying same file size even though the old and new file are 1GB in difference.

shot_171031_182942

shot_171031_183156

Another example.

shot_171031_183553

shot_171031_183610

BTW the log for the script is running upside down on purpose Newest entry is on top, oldest on bottom.

Prevent reencoding the same file twice.

Hi,

is there an option to check if the file is already in the correct format?
So if I let it run on my videos it won't reconvert them the next day when I run it again.

Doesn't grab file size after encoding handbrake

Will fail after encoding with Handbrake because the file size is still set for the when it failed during ffmpeg.exe encoding.

Below is code to fix it.

<#----------------------------------------------------------------------------------
Begin Handbrake encode (lossy)
----------------------------------------------------------------------------------#>
EncodeHandbrake
$fileOld = Get-Item $oldFile
$fileNew = Get-Item $newFile

The script leaves the original file, does not rename the .mp4.conv2mp4 file.

I was trying to convert five video files. Three got converted fine, but for original fourth file remained in the folder along with the generated .mp4.conv2mp4 file (the fifth file got converted fine, too). So it looks like the renaming/purging step failed for the fourth file, but there was no error message. I manually renamed the .mp4.conv2mp4 file to .mp4 and it seems to be working fine (also deleted the original .mkv file). I suspect that maybe non-English letters in the file name are the culprit. Here is the log:

>>>>> New Session (started 09/12/20 19:26:50)

There are 5 file(s) in the queue:

1. \\MYNAS\Video\STAGED\Video 1 (2008)\Video 1 (2008).mkv
2. \\MYNAS\Video\STAGED\Video 2 (2015)\Video 2 (2015).mkv
3. \\MYNAS\Video\STAGED\Video 3 (2014)\Video 3 (2014).mkv
4. \\MYNAS\Video\STAGED\Video 4 (2017) [Xxxxxöx éx xéxxxxöx]\Video 4 (2017) [Xxxxxöx éx xéxxxxöx].mkv
5. \\MYNAS\Video\STAGED\Video 5 (1997)\Video 5 (1997).mkv

------------------------------------------------------------------------------------
09/12/20 19:26:50 Processing - \\MYNAS\Video\STAGED\Video 1 (2008)\Video 1 (2008).mkv
09/12/20 19:26:50 File 1 of 5 - Total queue 20%
09/12/20 19:26:54 Video: H264, Audio: DTS. Encoding audio to AAC
09/12/20 19:57:12 Plex libraries refreshed
09/12/20 19:57:14 \\MYNAS\Video\STAGED\Video 1 (2008)\Video 1 (2008).mkv deleted.
09/12/20 19:57:14 \\MYNAS\Video\STAGED\Video 1 (2008)\Video 1 (2008).mp4 created.
09/12/20 19:57:14 New file is 1207.96MB smaller.
09/12/20 19:57:14 Current cumulative storage difference: -1.18GB
------------------------------------------------------------------------------------
09/12/20 19:57:14 Processing - \\MYNAS\Video\STAGED\Video 2 (2015)\Video 2 (2015).mkv
09/12/20 19:57:14 File 2 of 5 - Total queue 40%
09/12/20 19:57:16 Video: H264, Audio: AC3. Encoding audio to AAC
09/12/20 20:37:12 Plex libraries refreshed
09/12/20 20:37:14 \\MYNAS\Video\STAGED\Video 2 (2015)\Video 2 (2015).mkv deleted.
09/12/20 20:37:14 \\MYNAS\Video\STAGED\Video 2 (2015)\Video 2 (2015).mp4 created.
09/12/20 20:37:14 New file is 156.15MB smaller.
09/12/20 20:37:14 Current cumulative storage difference: -1.33GB
------------------------------------------------------------------------------------
09/12/20 20:37:14 Processing - \\MYNAS\Video\STAGED\Video 3 (2014)\Video 3 (2014).mkv
09/12/20 20:37:14 File 3 of 5 - Total queue 60%
09/12/20 20:37:15 Video: H264, Audio: AC3. Encoding audio to AAC
09/12/20 21:13:42 Plex libraries refreshed
09/12/20 21:13:44 \\MYNAS\Video\STAGED\Video 3 (2014)\Video 3 (2014).mkv deleted.
09/12/20 21:13:44 \\MYNAS\Video\STAGED\Video 3 (2014)\Video 3 (2014).mp4 created.
09/12/20 21:13:44 New file is 216.86MB smaller.
09/12/20 21:13:44 Current cumulative storage difference: -1.54GB
------------------------------------------------------------------------------------
09/12/20 21:13:45 Processing - \\MYNAS\Video\STAGED\Video 4 (2017) [Xxxxxöx éx xéxxxxöx]\Video 4 (2017) [Xxxxxöx éx xéxxxxöx].mkv
09/12/20 21:13:45 File 4 of 5 - Total queue 80%
09/12/20 21:13:45 Video: H264, Audio: AC3. Encoding audio to AAC
09/12/20 21:36:33 Plex libraries refreshed
09/12/20 21:36:34 Same file size.
09/12/20 21:36:34 \\MYNAS\Video\STAGED\Video 4 (2017) [Xxxxxöx éx xéxxxxöx]\Video 4 (2017) [Xxxxxöx éx xéxxxxöx].mkv deleted.
09/12/20 21:36:34 \\MYNAS\Video\STAGED\Video 4 (2017) [Xxxxxöx éx xéxxxxöx]\Video 4 (2017) [Xxxxxöx éx xéxxxxöx].mp4 created.
------------------------------------------------------------------------------------
09/12/20 21:36:34 Processing - \\MYNAS\Video\STAGED\Video 5 (1997)\Video 5 (1997).mkv
09/12/20 21:36:34 File 5 of 5 - Total queue 100%
09/12/20 21:36:35 Video: H264, Audio: DTS. Encoding audio to AAC
09/12/20 22:41:19 Plex libraries refreshed
09/12/20 22:41:21 \\MYNAS\Video\STAGED\Video 5 (1997)\Video 5 (1997).mkv deleted.
09/12/20 22:41:21 \\MYNAS\Video\STAGED\Video 5 (1997)\Video 5 (1997).mp4 created.
09/12/20 22:41:21 New file is 3918.40MB smaller.
09/12/20 22:41:21 Current cumulative storage difference: -5.37GB

Invoke-WebRequest error

I run this script from Sonarr, and it runs as the System profile.
Because ive never run internet explorer before as the system profile, I get the below error.

Looks like adding -UseBasicParsing will fix this error.

17-4-12 12:27:05.4|Error|powershell.exe|Invoke-WebRequest : The response content cannot be parsed because the Internet 
17-4-12 12:27:05.4|Error|powershell.exe|Explorer engine is not available, or Internet Explorer's first-launch 
17-4-12 12:27:05.4|Error|powershell.exe|configuration is not complete. Specify the UseBasicParsing parameter and try 
17-4-12 12:27:05.4|Error|powershell.exe|again. 
17-4-12 12:27:05.4|Error|powershell.exe|At E:\HandbrakeCLI\convertRadarr.ps1:627 char:5
17-4-12 12:27:05.4|Error|powershell.exe|+                 Invoke-WebRequest $plexURL
17-4-12 12:27:05.4|Error|powershell.exe|+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~
17-4-12 12:27:05.4|Error|powershell.exe|    + CategoryInfo          : NotImplemented: (:) [Invoke-WebRequest], NotSupp 
17-4-12 12:27:05.4|Error|powershell.exe|   ortedException
17-4-12 12:27:05.4|Error|powershell.exe|    + FullyQualifiedErrorId : WebCmdletIEDomNotSupportedException,Microsoft.Po 
17-4-12 12:27:05.4|Error|powershell.exe|   werShell.Commands.InvokeWebRequestCommand

Add normalize dB level in audio using ffmpeg?

I'm not exactly sure if ffmpeg does this, looking around some people say it can but I can't find much on it myself.

I've noticed some low volume in movies from time to time and I was wondering if it'd be possible to have an option for ffmpeg to normalize the peak volume to a certain dB level? Like 80dB or whatever we decide.

Just not working

Here is an output when I run it, I am using powershell and a scheduled task.
Building file list, please wait. This may take a while, especially for large libraries.

Found 6 files so far...conv2mp4-ps v3.1.2.3 RELEASE - https://github.com/BrianDMG/conv2mp4-ps

There are 6 files in the queue:

  1. Z:\movies\Ralph Breaks the Internet (2018)\Ralph Breaks the Internet (2018).avi
  2. Z:\movies\The House with a Clock in Its Walls (2018)\The House with a Clock in Its Walls (2018).mkv
  3. Z:\movies\Night School (2018)\Night School (2018).avi
  4. Z:\tvshows\The Blacklist\Season 6\The Blacklist - S06E01 - Dr. Hans Koehler.mkv
  5. Z:\tvshows\The Orville\Season 2\The Orville - S02E01 - Ja'loja.mkv
  6. Z:\tvshows\The Orville\Season 2\The Orville - S02E02 - Primal Urges.mkv

01/04/19 20:04:26 Processing - Z:\movies\Ralph Breaks the Internet (2018)\Ralph Breaks the Internet (2018).avi
01/04/19 20:04:26 File 1 of 6 - Total queue 16.67%
01/04/19 20:04:27 Video: MPEG4, Audio: AC3. Encoding video to H264 and audio to AAC.
ffmpeg version N-92644-gfe0416f8a1 Copyright (c) 2000-2018 the FFmpeg developers
built with gcc 8.2.1 (GCC) 20181201
configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libmfx --enable-amf --enable-ffnvcodec --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth --enable-libopenmpt
libavutil 56. 24.101 / 56. 24.101
libavcodec 58. 41.102 / 58. 41.102
libavformat 58. 23.102 / 58. 23.102
libavdevice 58. 6.101 / 58. 6.101
libavfilter 7. 46.101 / 7. 46.101
libswscale 5. 4.100 / 5. 4.100
libswresample 3. 4.100 / 3. 4.100
libpostproc 55. 4.100 / 55. 4.100
Input #0, avi, from 'Z:\movies\Ralph Breaks the Internet (2018)\Ralph Breaks the Internet (2018).avi':
Metadata:
encoder : VirtualDubMod 1.5.10.2 (build 2542/release)
Duration: 01:50:25.36, start: 0.000000, bitrate: 1951 kb/s
Stream #0:0: Video: mpeg4 (Advanced Simple Profile) (XVID / 0x44495658), yuv420p, 720x304 [SAR 1:1 DAR 45:19], 1749 kb/s, 25 fps, 25 tbr, 25 tbn, 25 tbc
Stream #0:1: Audio: ac3 ([0] [0][0] / 0x2000), 48000 Hz, stereo, fltp, 192 kb/s
Z:\movies\Ralph Breaks the Internet (2018)\Ralph Breaks the Internet (2018).mp4: Permission denied
01/04/19 20:04:27 ffmpeg completed
Get-Item : Cannot find path 'Z:\movies\Ralph Breaks the Internet (2018)\Ralph Breaks the Internet (2018).mp4' because it does not exist.
At C:\Sysinternals\conv2mp4\conv2mp4-ps.ps1:831 char:16

  •             $fileNew = Get-Item $newFile
    
  •                        ~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : ObjectNotFound: (Z:\movies\Ralph...rnet (2018).mp4:String) [Get-Item], ItemNotFoundException
    • FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.GetItemCommand

01/04/19 20:04:27 ERROR: Z:\movies\Ralph Breaks the Internet (2018)\Ralph Breaks the Internet (2018).mp4 could not be deleted. Full error below.
Cannot find path 'Z:\movies\Ralph Breaks the Internet (2018)\Ralph Breaks the Internet (2018).mp4' because it does not exist.
[20:04:27] hb_init: starting libhb thread
[20:04:27] thread 5b8e440 started ("libhb")
HandBrake 1.1.2 (2018090500) - MinGW x86_64 - https://handbrake.fr
16 CPUs detected
Opening Z:\movies\Ralph Breaks the Internet (2018)\Ralph Breaks the Internet (2018).avi...
[20:04:27] CPU:
[20:04:27] - logical processor count: 16
[20:04:27] Intel Quick Sync Video support: no
[20:04:27] hb_scan: path=Z:\movies\Ralph Breaks the Internet (2018)\Ralph Breaks the Internet (2018).avi, title_index=1
udfread ERROR: ECMA 167 Volume Recognition failed
src/libbluray/disc/disc.c:323: failed opening UDF image Z:\movies\Ralph Breaks the Internet (2018)\Ralph Breaks the Internet (2018).avi
src/libbluray/disc/disc.c:424: error opening file BDMV\index.bdmv
src/libbluray/disc/disc.c:424: error opening file BDMV\BACKUP\index.bdmv
[20:04:27] bd: not a bd - trying as a stream/file instead
libdvdnav: Using dvdnav version 6.0.0
libdvdread: Encrypted DVD support unavailable.
libdvdread:DVDOpenFileUDF:UDFFindFile /VIDEO_TS/VIDEO_TS.IFO failed
libdvdread:DVDOpenFileUDF:UDFFindFile /VIDEO_TS/VIDEO_TS.BUP failed
libdvdread: Can't open file VIDEO_TS.IFO.
libdvdnav: vm: failed to read VIDEO_TS.IFO
[20:04:27] dvd: not a dvd - trying as a stream/file instead
Input #0, avi, from 'Z:\movies\Ralph Breaks the Internet (2018)\Ralph Breaks the Internet (2018).avi':
Metadata:
encoder : VirtualDubMod 1.5.10.2 (build 2542/release)
Duration: 01:50:25.36, start: 0.000000, bitrate: 1951 kb/s
Stream #0:0: Video: mpeg4 (Advanced Simple Profile) [XVID / 0x44495658]
yuv420p, 720x304 [PAR 1:1 DAR 45:19]
25 fps, 25 tbn
Stream #0:1: Audio: ac3 [[0] [0][0] / 0x2000]
48000 Hz, stereo, fltp, 192 kb/s
[20:04:27] scan: decoding previews for title 1
Scanning title 1 of 1, preview 1, 0.00 %[ac3 @ 00000000060806c0] frame sync error
[ac3 @ 00000000060806c0] frame sync error
[20:04:28] scan: audio 0x1: ac3, rate=48000Hz, bitrate=192000 Unknown (AC3) (2.0 ch)
[20:04:28] scan: 10 previews, 720x304, 25.000 fps, autocrop = 0/0/0/0, aspect 2.37:1, PAR 1:1
[20:04:28] libhb: scan thread found 1 valid title(s)

  • Using preset: CLI Default
  • title 1:
    • stream: Z:\movies\Ralph Breaks the Internet (2018)\Ralph Breaks the Internet (2018).avi
    • duration: 01:50:25
    • size: 720x304, pixel aspect: 1/1, display aspect: 2.37, 25.000 fps
    • autocrop: 0/0/0/0
    • chapters:
      • 1: cells 0->0, 0 blocks, duration 01:50:25
    • audio tracks:
      • 1, Unknown (AC3) (2.0 ch) (iso639-2: und), 48000Hz, 192000bps
    • subtitle tracks:
      Warning: Could not find audio track 2, skipped
      Warning: Could not find audio track 3, skipped
      Warning: Could not find audio track 4, skipped
      Warning: Could not find audio track 5, skipped
      Warning: Could not find audio track 6, skipped
      Warning: Could not find audio track 7, skipped
      Warning: Could not find audio track 8, skipped
      Warning: Could not find audio track 9, skipped
      Warning: Could not find audio track 10, skipped
      [20:04:28] 1 job(s) to process
      [20:04:28] json job:
      {
      "Audio": {
      "AudioList": [
      {
      "Encoder": 65536,
      "Track": 0
      }
      ],
      "CopyMask": [
      "copy:aac"
      ],
      "FallbackEncoder": "av_aac"
      },
      "Destination": {
      "AlignAVStart": false,
      "ChapterList": [
      {
      "Name": ""
      }
      ],
      "ChapterMarkers": false,
      "File": "Z:\movies\Ralph Breaks the Internet (2018)\Ralph Breaks the Internet (2018).mp4",
      "InlineParameterSets": false,
      "Mp4Options": {
      "IpodAtom": false,
      "Mp4Optimize": false
      },
      "Mux": "m4v"
      },
      "Filters": {
      "FilterList": [
      {
      "ID": 4,
      "Settings": {
      "mode": "7"
      }
      },
      {
      "ID": 6,
      "Settings": {
      "mode": 0
      }
      },
      {
      "ID": 11,
      "Settings": {
      "crop-bottom": 0,
      "crop-left": 0,
      "crop-right": 0,
      "crop-top": 0,
      "height": 304,
      "width": 720
      }
      }
      ]
      },
      "Metadata": {},
      "PAR": {
      "Den": 1,
      "Num": 1
      },
      "SequenceID": 0,
      "Source": {
      "Angle": 0,
      "Path": "Z:\movies\Ralph Breaks the Internet (2018)\Ralph Breaks the Internet (2018).avi",
      "Range": {
      "End": 1,
      "Start": 1,
      "Type": "chapter"
      },
      "Title": 1
      },
      "Subtitle": {
      "Search": {
      "Burn": true,
      "Default": false,
      "Enable": false,
      "Forced": false
      },
      "SubtitleList": []
      },
      "Video": {
      "ColorMatrixCode": 0,
      "Encoder": "x264",
      "Level": "4.1",
      "Options": "",
      "Preset": "slow",
      "Profile": "high",
      "QSV": {
      "AsyncDepth": 4,
      "Decode": false
      },
      "Quality": 18.0,
      "Tune": "",
      "Turbo": false,
      "TwoPass": false
      }
      }
      [20:04:28] starting job
      [20:04:28] yadif thread started for segment 0
      [20:04:28] yadif thread started for segment 1
      [20:04:28] yadif thread started for segment 2
      [20:04:28] work: mixdown not specified, track 1 setting mixdown Stereo
      [20:04:28] yadif thread started for segment 3
      [20:04:28] yadif thread started for segment 4
      [20:04:28] yadif thread started for segment 5
      [20:04:28] yadif thread started for segment 6
      [20:04:28] work: bitrate not specified, track 1 setting bitrate 160 Kbps
      [20:04:28] yadif thread started for segment 7
      [20:04:28] yadif thread started for segment 8
      [20:04:28] yadif thread started for segment 9
      [20:04:28] yadif thread started for segment 10
      [20:04:28] yadif thread started for segment 11
      [20:04:28] yadif thread started for segment 12
      [20:04:28] job configuration:
      [20:04:28] yadif thread started for segment 13
      [20:04:28] yadif thread started for segment 14
      [20:04:28] yadif thread started for segment 15
      [20:04:28] * source
      [20:04:28] + Z:\movies\Ralph Breaks the Internet (2018)\Ralph Breaks the Internet (2018).avi
      [20:04:28] + title 1, chapter(s) 1 to 1
      [20:04:28] + container: avi
      [20:04:28] + data rate: 1951 kbps
      [20:04:28] * destination
      [20:04:28] + Z:\movies\Ralph Breaks the Internet (2018)\Ralph Breaks the Internet (2018).mp4
      [20:04:28] + container: MPEG-4 (libavformat)
      [20:04:28] * video track
      [20:04:28] + decoder: mpeg4
      [20:04:28] + filters
      [20:04:28] + Decomb (mode=7)
      [20:04:28] + Framerate Shaper (mode=0)
      [20:04:28] + frame rate: same as source (around 25.000 fps)
      [20:04:28] + Crop and Scale (width=720:height=304:crop-top=0:crop-bottom=0:crop-left=0:crop-right=0)
      [20:04:28] + source: 720 * 304, crop (0/0/0/0): 720 * 304, scale: 720 * 304
      [20:04:28] + Output geometry
      [20:04:28] + storage dimensions: 720 x 304
      [20:04:28] + pixel aspect ratio: 1 : 1
      [20:04:28] + display dimensions: 720 x 304
      [20:04:28] + encoder: H.264 (libx264)
      [20:04:28] + preset: slow
      [20:04:28] + profile: high
      [20:04:28] + level: 4.1
      [20:04:28] + quality: 18.00 (RF)
      [20:04:28] * audio track 1
      [20:04:28] + decoder: Unknown (AC3) (2.0 ch) (track 1, id 0x1)
      [20:04:28] + bitrate: 192 kbps, samplerate: 48000 Hz
      [20:04:28] + mixdown: Stereo
      [20:04:28] + encoder: AAC (libavcodec)
      [20:04:28] + bitrate: 160 kbps, samplerate: 48000 Hz
      [20:04:28] sync: expecting 165634 video frames
      [20:04:28] encx264: encoding at constant RF 18.000000
      [20:04:28] encx264: unparsed options: level=4.1:ref=5:direct=auto:subme=8:trellis=2:vbv-bufsize=78125:vbv-maxrate=62500:rc-lookahead=50
      x264 [info]: using SAR=1/1
      x264 [info]: using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
      x264 [info]: profile High, level 4.1
      ERROR: avio_open2 failed, errno -13
      [20:04:28] work: average encoding speed for job is 0.000000 fps
      [20:04:28] decomb: deinterlaced 0 | blended 0 | unfiltered 0 | total 0
      [20:04:28] vfr: lost time: 0 (0 frames)
      [20:04:28] vfr: gained time: 0 (0 frames) (0 not accounted for)
      [20:04:28] ac3-decoder done: 0 frames, 0 decoder errors
      [20:04:28] mpeg4-decoder done: 0 frames, 0 decoder errors
      [20:04:28] sync: got 0 frames, 165634 expected
      [20:04:28] libhb: work result = 3

Encode failed (error 3).
HandBrake has exited.

Encoding: task 1 of 1, 0.00 %
01/04/19 20:04:28 Handbrake finished.
Get-Item : Cannot find path 'Z:\movies\Ralph Breaks the Internet (2018)\Ralph Breaks the Internet (2018).mp4' because it does not exist.
At C:\Sysinternals\conv2mp4\conv2mp4-ps.ps1:855 char:20

  •                             $fileNew = Get-Item $newFile
    
  •                                        ~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : ObjectNotFound: (Z:\movies\Ralph...rnet (2018).mp4:String) [Get-Item], ItemNotFoundException
    • FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.GetItemCommand

01/04/19 20:04:28 ERROR: New file was too small (-1541.41MB). Retained Z:\movies\Ralph Breaks the Internet (2018)\Ralph Breaks the Internet (2018).avi.
01/04/19 20:04:28 ERROR: Z:\movies\Ralph Breaks the Internet (2018)\Ralph Breaks the Internet (2018).mp4 could not be deleted. Full error below.
Cannot find path 'Z:\movies\Ralph Breaks the Internet (2018)\Ralph Breaks the Internet (2018).mp4' because it does not exist.
cfg_conv2mp4-ps - Copy.txt

Keep folder structure when saving to a new location?

Would it be possible to save the folder structure of the files being converted (ie TV Show/Season/Filename) and create those folders in the new location so that everything stays organized? Also possibly delete the old folder and all the contents?

I host my server on a Pi but convert all the files on my PC with a much better cpu. I currently store files that need converting on my PC then save to a folder on the Pi for the converted files. The garbage system is great but it leaves behind a bunch of empty folders on the PC that I have to manually delete so I know what has already been converted and what hasn't.

ERROR: The regular expression pattern ) is not valid.

When the script tries to process a file, it generates this error:

05/10/20 14:09:23 Processing - \\MYNAS\DIR\PATH\Video (2012)\Video (2012).mkv
05/10/20 14:09:23 File 4 of 14 - Total queue 28.57%
05/10/20 14:09:24 Video: H264, Audio: AC3. Encoding audio to AAC
The regular expression pattern ) is not valid.
At C:\conv2mp4\files\func\ConvertFile.ps1:76 char:13
+             $title = $title -replace "$remove",''
+             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: ():String) [], RuntimeException
    + FullyQualifiedErrorId : InvalidRegularExpression

Using v4.1.2 of the script.

Script is already running in another instance. Waiting...

"Created a backup of C:\Users\User\Desktop\conv2mp4-ps-3.1.2\cfg_conv2mp4-ps.ps1
Script is already running in another instance. Waiting..."

Hey, I got this working perfectly last night then Windows upgraded to 1903 overnight. Not sure if previous script finished or not but now I'm left with this when starting the script.

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

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.