Afraid I don’t have much time to proof read and refine this so this is going to sound rough until I am able to return to this to make it better.
Firstly though I USED CHATGPT to help me make this. So if you have a problem with me using it to ASSIST me in making this take your comments elsewhere and just don’t use it.
This is an passion project I altered recently to be an public so CLUNKY CODE will probably be present as I got it to where I was happy with it. It’s also why I put it on github so anyone can fork it and make their own version of this or just to clean it up more.
Short TLDR
Over the past year I’ve been trying to make an CMD prompt to get FFMPEG to re-encode videos to AV1 more and more refined, resulting in myself going from copy and paste’ing to .bat and now to .ps (powershell). Today due to circumstances out of my control I am releasing it publicly so others can use it.
Here is the github page link to download the .ps and the .bat file, BOTH ARE REQUIRED and setup is also required as you will need to manually download FFMPEG normal and probe exe’s for it to all work: https://github.com/Rat-attack/Re-encode-AV1-Powershell
PS Drag and drop files onto the .bat file NOT THE .ps file.
Backstory
Oh boy backstory because…I feel like it and you clicked on this to view this because you want it…don’t you? Isn’t that why you clicked here? Well why are you here?
Coughs to clear throat Sorry about that. Anyway…roughly an year and a few months ago I got fed up with trying to use Handbrake and various other programs that I went digging into one of them (FlowFrames) for how it was getting file sizes to be so small while having great quality in my view. Which from that I made an copy and paste CMD prompt to get singular files re-encoded into AV1.
I didn’t stick with that for very long though and soon looked at how to automate it so I didn’t have to carefully place the file paths and names along with making sometimes a few minute changes. As a result I made an .bat file where I could drag and drop the files and have an few queries about if I wanted the quality to be better or worse…even put in if I wanted to downscale the finished file. It all worked great although I got really puzzled at a few points about audio not copying over and trying to have an completion sound occur so I knew when that single file was done.
But I yearned for more eventually as the sin of greed came along and said “Why not re-encode all your video files to AV1?” which my two problems with that was I have no idea how to do an queue and not all re-encodes save space or don’t result in some weirdness with the output. So I slept on it…for several months until roughly 3 months ago where after trying to do something with ChatGPT making an script for myself I asked it about it.
As you can guess it gave me an surprisingly good enough answer even after feeding it what I got it made it work with the caveat of it needing to be in Powershell while using an .bat file to load the files into the script.
So I then started grinding away with ChatGPT’s sometimes bizarre responses and nuances (including when it re-wrote the entire script when it just needed to change 10 lines of text) to get to now what I’ve got here after treating it like an kid with beyond extreme levels of ADHD via feeding it specific code chunks and abusing the write-host command to do hello world. What is it though? Well… points down
This is meant to be an easy way to re-encode an video file (or many) to AV1 to mainly save space with an comparison function to delete bigger files and even a way to re-encode VR videos…oh and turn them into 2D versions after manually tweaking settings via an fast/draft re-encode option.
Key Functions:
- Re‑encode one or many files to AV1 only. (have to manually tweak to do others)
- Drag and drop the files.
- Build a queue before starting encoding.
- Detect and optionally skip files already encoded with AV1.
- Down‑scale non-VR videos automatically (global defaults or per‑file prompts or per user set monitor size)
- Handle VR / 360° content, with optional VR → flat 2D conversion (With option to do an draft fast re-encode to test settings)
Extra Functions:
- Show live FFmpeg progress with ETA and cancellation options (abort now or after current file, back-up method is in place as last resort)
- Compare output vs source size and optionally delete the larger output file or even the source file when output file is smaller (very dangerous in my mind to enable)
- Debug mode config option to view extra information if you want to troubleshoot yourself (based on simple if = true then write text so not everything is covered)
- Log key events to text files for later review (these are minor really)
- Fancy colors for the text at various points to hopefully emphasize how important each bit of text is. (done via using
-ForegroundColor)
Requirements
- ffmpeg.exe
- ffprobe.exe
- Configure the .ps to your taste
- Drag and drop files to re-encode onto the .bat file NOT THE .ps
- What you expected more? Fine here’s an link to the github where I got FFMPEG from: https://github.com/GyanD/codexffmpeg/releases
Now I hope that I didn’t miss anything though I should re-mention that this is an personal passion project that I turned into something to share in the last roughly 2 weeks give or take. As a result I have only tested this on Windows and FFMPEG version 7.01 (done limited testing/usage with 8.0) and since it uses Powershell (which I believe is Windows only) I think this is really an Windows only script.
I don’t have the time currently to use a virtual machine to try and fanangle/convert it to MAC or Linux. Maybe later but that depends on if ChatGPT doesn’t kick and scream at me.
However this is why I decided to put this all onto Github as then anyone with an account there should be able to make forks and pull requests of this to improve it. Additionally I’ve locked none of the code away so it can all be taken apart and stolen to be reused elsewhere.
Oh yeah I should give you guys the link to the Github page… https://github.com/Rat-attack/Re-encode-AV1-Powershell
Speaking of the Github page, there’s an readme file I started to work on and then after asking @mememan2010 to take a look at the entire thing…well they made it look so much better than I thought I could make it so…o7 them for it or whatever. (I hope they make a comment just so you can give them a like for it) You really should give it a read through before running the script, if not though and you want a shorter version the .ps file has what I did in it so you can read that to help configure it.
Anyway I believe that’s all I have to say on this with exception that health reasons are why I am releasing this sooner rather than later so if I vanish and nothing more occurs with this…well… something happened while trying to get rid of my cancer so I’m spending the next half a year recovering.
PS I didn’t have an name for this pop into my head in time so if you have an name suggestion (presuming leaving it as is fine) then say it. Although the Github name isn’t possible to change I believe, everything else is.