Package: batchypegger
batchypeggerApply ffmpeg in a simpler batchy way.Easily shrink a video, or a folder of videos.Turn that 50 gig TV series into a 5 gig folder. Turn that silly-sized screen recording into something you can upload.Cleans up the filenames too.InstallFirst install:ffmpeg (and put it in your system path)Python 3Then install it with thepipcommand:pip install batchypeggerRun it once to automatically create the config file~/.batchypegger.yamland you're ready to go!ExamplesShrink all videos in the current folder to 360p:batchypegger 360p .Shrink all the videos in the current folder without scaling them:batchypegger .What about just a file?batchypegger 480p somevideo.mkvDo a dry run to examine everything and make sure the filenames are right and the subtitles are picked up and stuff (good idea to do one first):batchypegger . dryMake a few different sizes:batchypegger 360p 480p 720p 1080p .Make a few different sizes but only the first 5 minutes (taster mode):batchypegger taster 360p 480p 720p 1080p .BTW, mode switchestasteranddrycan appear anywhere. These are all the same:batchypegger 720p . drybatchypegger 720p . dry tasterbatchypegger taster dry 720p .different schemes can be defined in the config file and then specified. This one will output 3 videos:batchypegger x265 1080p 720p x264 360p somevideo.webmOutputs: 
    somevideo__x265_720p.mkv
    somevideo__x265_1080p.mkv
    somevideo__x264_360p.mp4SubtitlesIf there is an.srtor.vttfile with the same exact filename as the video, only difference being the extension, then it will include the subtitles in the output.If you do a dry run, you can see if it picked up the subtitles or not.DVD SubtitlesIf there is an.idxand.subfile with the same exact filename as the video, only difference being the extension, then it will pick them up.However, with DVD subtitles you need to use one of thedvdsubsprofiles:x264dvdsubsorx265dvdsubsOr use your own custom profile that uses-c:s dvdsubsin the codec args and maps what you need, examine the config yaml for insight.If you do a dry run, you can see if it picked up the subtitles or not.Cleaning FilenamesIt cleans the filenames. Someday this will be more configurable.It will replace most characters with underscores and remove entire phrases that you've specified in the configuration sectionjust_erase.For example if you had filenames like:KittyShow 1x03 Freddy's birds (1080p BRrip x265 BooYeah).mkv, just paste(1080p BRrip x265 BooYeah)intojust_erasein the config yaml, and do a dry run to make sure it got them. The output filenames would then look something like:KittyShow_1x03_Freddy_s_birds__x264_360p.mp4Ignoring a fileRename the file to end with__keep, likesomevideo__keep.webm, and it won't be processed.I want advanced ffmpeg argumentsGo ahead and edit the configuration file. Add as many schemes as you need. The ffmpeg command will be created like:ffmpeg ffargs_prefix scheme_prefix -i infile codec_args scaling scheme_suffix ffargs_suffix outfileand you can customise most of those in the config file. (scalingis calculated if you specify480petc)Configuration:~/.batchypegger.yamlThe first time you run batchypegger, the configuration file will be created in your home folder:~/.batchypegger.yaml(On Windows that's likeC:\Users\DingleToes\.batchypegger.yaml)I tried to pick reasonable defaults. You can make new schemes for whatever you need.tagis what will be added to the filename, as infoo__x264_720p.mp4.# full path to ffmpeg executable, or auto to look in the system path.ffmpeg:auto# the args parser will enforce only recognised numbers for p-ness (480p, 720p, etc)# although the scaling math will probably do any number you need, just add it in here# just the numbers, like [320, 300, 2000]allow_p:[]# the command will be constructed as:#   ffmpeg ffargs_prefix scheme_prefix -i infile codec_args scaling scheme_suffix ffargs_suffix outfileffargs_prefix:ffargs_suffix:-max_muxing_queue_size 1024 -movflags faststartdefault_scheme:x264schemes:x264:codec_args:-c:v libx264 -crf 28 -c:s mov_textformat:mp4tag:x264prefix:suffix:x264mkv:codec_args:-c:v libx264 -crf 28 -c:s srtformat:mkvtag:x264prefix:suffix:x264dvdsub:codec_args:-map 0:v -map 0:a -map 1:s -c:v libx264 -crf 28 -c:a copy -c:s dvdsubformat:mkvtag:x264prefix:suffix:x265:codec_args:-c:v libx265 -crf 30 -c:s srtformat:mkvtag:x265prefix:suffix:x265dvdsub:codec_args:-map 0:v -map 0:a -map 1:s -c:v libx265 -crf 30 -c:s dvdsubformat:mkvtag:x265prefix:suffix:just_erase:["(480pDVDx265BooYeah)","(480px265BooYeah)",# this list can get big...]