-
June 26th, 2023, 01:19 #1
Bash: Batch convert webm VP9 to webm VP8 using ffmpeg
Bash script to batch convert animated assets VP9 to VP8 for FG using ffmpeg.
Linux/OSX Bash Script
Windows Powershell - By Lo Zeno
Will recursively batch convert animated assets. Works well for large amounts of assets such as https://jb2a.com
It will copy over existing VP8 assets to the new destination and convert VP9 to VP8. There is option to re-encode VP8 if you wish. You can also adjust some of the encoding settings I have if you don't like them. It will also not copy over anything that isn't a webm file so it cleans out any text files or webp files that may also be there.
Instructions OSX/Linux
- Install ffmepg
- Download attached convert-vp9.txt and rename it convert-vp9
- Make it executable. chmod +x convert-vp9
- Run it ./convert-vp9 -i input-folder -o images
Windows should also be possible but it may have to get converted to a powershell script. Someone who has more knowledge than I may be able to do that pretty quicklyLast edited by rhagelstrom; July 6th, 2023 at 23:16. Reason: Update Powershell link to latest
-
June 26th, 2023, 23:45 #2
Thanks!
Got a Bug - Click & FOLLOW the procedure here, it will save time
Ultimate Edition Fantasy Grounds - ONLY ON Linux
Twitch Channel
-
June 27th, 2023, 11:52 #3
I have made a powershell conversion of it - very hasted, very brutal and absolutely ugly looking in terms of code and Powershell best practices - I basically converted your bash line-by-line. Ugly, but works fine for what I tested so far.
If I'll have time I'll clean it up.
Once downloaded, the file needs to be renamed from convert-vp9.txt to convert-vp9.ps1
For windows users, the best way to install ffmpeg is to use a package manager:
if you have chocolatey from powershell with admin rights type:
Code:choco install ffmpeg
Code:scoop install ffmpeg
Code:winget install ffmpeg
Last edited by Lo Zeno; July 3rd, 2023 at 11:53. Reason: Removed old version of the script that did not set alpha channel correctly
Please vote these quality-of-life features for Fantasy Grounds Unity:
Human readable titles in FGU Updater - 'Staging' state of die rolls (modify results after dice are rolled, but before FGU evaluates the result, for things like Bardic Inspiration) - Multi Screen Support - Let players control friendly NPC tokens - Customizable duration of fog of war
-
June 27th, 2023, 17:49 #4
I've made a better version with some small cleanup to the code and a fix to the parameters passed to ffmpeg which were not passing the transparency correctly.
The instructions to use it are similar to the ones for the bash file, except the commands are run in Powershell:
- Install ffmpeg (refer to the post above for ways to do it on Windows)
- Download the file and rename it to convert-vp9.ps1
- Set your powershell execution policy to allow the script to be run: Set-ExecutionPolicy -ExecutionPolicy Unrestricted -Scope Process
- Run it: convert-vp9.ps1 -i input-folder -o output-folder
Please vote these quality-of-life features for Fantasy Grounds Unity:
Human readable titles in FGU Updater - 'Staging' state of die rolls (modify results after dice are rolled, but before FGU evaluates the result, for things like Bardic Inspiration) - Multi Screen Support - Let players control friendly NPC tokens - Customizable duration of fog of war
-
June 27th, 2023, 19:09 #5
I am not versed in Powershell.
So I installed ffmpeg with winget, I ran powershell as admin, ran the set-executionpolicy and then ran your script and I get the following error:
ffprobe : The term 'ffprobe' 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 D:\RPG\convert-vp9.ps1:43 char:28
+ $vp8 = ffprobe -show_streams -hide_banner -logle ...
+ ~~~~~~~
+ CategoryInfo : ObjectNotFound: (ffprobe:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
[UPDATE]
Uninstalled ffmpeg and then reinstalled using powershell with admin rights and it works now.Last edited by Farnaby; June 27th, 2023 at 19:13. Reason: Working now
“Build a man a fire, and he'll be warm for a day. Set a man on fire, and he'll be warm for the rest of his life.”
Terry Pratchett [RIP] - Jingo
-
June 27th, 2023, 21:30 #6
You don't need to use powershell with admin rights in order to install ffmpeg - actually you don't need to run powershell with admin rights at all for this script to work. I think your issue was that winget, unlike scoop and chocolatey, does not automatically refresh the PATH and environment variable of your powershell session, so after installing ffmpeg with winget what you needed to do was close powershell, wait a few seconds, and reopen it (without admin rights) for it to work. Your uninstalling and reinstalling achieved probably the same thing.
Last edited by Lo Zeno; June 30th, 2023 at 10:41.
Please vote these quality-of-life features for Fantasy Grounds Unity:
Human readable titles in FGU Updater - 'Staging' state of die rolls (modify results after dice are rolled, but before FGU evaluates the result, for things like Bardic Inspiration) - Multi Screen Support - Let players control friendly NPC tokens - Customizable duration of fog of war
-
July 5th, 2023, 12:16 #7
One more small fix to the Powershell version: the script was failing to copy files or folders that included wildcard characters (square brackets in particular), so I changed the relevant commandlets to use -LiteralPath instead of -Path
As usual, rename the file to convert-vp9.ps1 to use.Please vote these quality-of-life features for Fantasy Grounds Unity:
Human readable titles in FGU Updater - 'Staging' state of die rolls (modify results after dice are rolled, but before FGU evaluates the result, for things like Bardic Inspiration) - Multi Screen Support - Let players control friendly NPC tokens - Customizable duration of fog of war
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks