Attached is my PowerShell script Vid2Mp4 which converts videos to MP4 format for playing on a Chromecast. All videos in current folder and subfolders are converted if the -RECURSE parameter is used. The following three utilities are required:
MediaInfo CLI - Checks the audio/video formats - http://mediaarea.net/en/MediaInfo/Download/Windows
FFmpeg - Converts audio to AAC when video is already AVC or VP8 and simply remuxs compliant videos to MP4 - https://ffmpeg.zeranoe.com/builds/
Handbrake - Converts both audio and video to AVC and AAC unless audio is already AAC or MP3 - https://handbrake.fr/downloads.php
Optional parameter switches:
-RECURSE all videos in current folder and subfolders for conversion.
-DELETE deletes input files after conversion.
-FOLDER creates new files in MP4 subfolders and is the default when MP4 folders already exist.
-HQ for higher quality Handbrake encoding, the default for files less than 100MB in size.
-FORCE forces Handbrake encoding for files that contain FFmpeg formats like AVC
-NOLOG logs to console only, not to file, and is the default when less than 10 files are being converted.
The MkvToMp4 utility may do this already, but I wanted a simple script that can run from the command line, and do exactly what I want. I believe the MkvToMp4 project was abandoned and I needed an excuse to learn PowerShell for video conversions, anyway. A BAT file is provided in the zip for more easily running the PS script from a non-PowerShell command prompt.
Remember to Unblock the zip before extracting. Also Set-ExecutionPolicy as required after running PowerShell as Administrator.
+ Reply to Thread
Results 1 to 3 of 3
Last edited by V1de0Luvr; 20th Mar 2017 at 12:22. Reason: Version 5 adds the -FORCE option
The Chrome app Videostream allows you to play your videos files on Chromecast and seems to convert any video files not supported, as Chromecast can only decode H.264 and VP8. So any videos that are not either of those two get encoded with x264, on the fly. It works fairly well, assuming you have a decent CPU and know to drop the resolution settings if you are getting buffered. I've been using it since they first started, back when Google released their developers tools for the Chromecast.
Yes, if you are casting from a PC then Videostream sounds good. Plex should work, too. My aim is to cast videos from an SD card in my phone and be able to plug a Chromecast into any TV at a friend's house, hotel, etc. The BubbleUPnP app may be able to transcode on-the-fly from a phone but costs $5 to try. I tried another app that supposedly transcodes but it failed miserably. While my Nexus 6 may be powerful enough to transcode on-the-fly, it won't take an SD card. My Moto E phones take SD cards but I'm sure they are too slow to transcode.