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

Refactor encoding functions

djgrijalva opened this issue · comments

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

commented

Hey @djgrijalva, thanks so much for looking into this! I apologize for the (considerable) delay in my response, but my wife and I just had a baby in November, so as you can imagine I've been pretty preoccupied with that lately. I'll take a look at your code and address the pull request, I just need to make sure I can integrate it with some other updates I've been working on for quite a while. Thanks again for your effort!

commented

Merged your pull request #34 into the development branch (merged from feature/refactor). Thanks again!