Due to "office-powerpoint-itpro" tag focuses on general technical questions about Microsoft PowerPoint, but your issue seems to be related to the development code. To better help you, you may also post a new question on following forum.
Office developer community
Here is a thread "Create mp4 from PowerPoint in PowerShell", please check whether it is helpful to you.
(Please Note: Since the web site is not hosted by Microsoft, the link may change without notice. Microsoft does not guarantee the accuracy of this information.)
Thanks for your understanding.
If an Answer is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.