๐ฝ๏ธ Convert videos to Chromecast compatible formats
OTHER License
Identify and convert videos to formats that are Chromecast supported.
Cast Convert can tell you whether videos will play correctly on your casting devices. If they won't, this project can convert videos into formats that devices do support.
Click here to see a list of supported devices.
cast-convert
can identify and correct a video's incompatibility with a device caused by the video's:
This utility can tell you if a video will or won't play correctly on your casting device. It can then efficiently modify the video so that it will play on the device.
Cast Convert calculates the least amount of transcoding required to playback videos. It also has detailed support profiles for every format supported by each device, whereas other transcoding options tend to force all videos into one format.
For example, you may have a video named video.mp4
that isn't compatible with your device. Cast Convert can generate a transcoding plan that does the least amount of transcoding necessary instead of blindly transcoding every video into the same format.
You can use cast-convert inspect
to scan the video and come up with the most efficient transcoding plan:
$ cast-convert inspect --name '1st Gen' video.mp4
[โ๏ธ] Need to convert "~/video.mp4" to play on Chromecast 1st Gen...
Must convert from:
- File Container: mp4
- Video Codec: vp9
- Resolution: 640x480
- Frame Rate: 29.970
- Audio Codec: mp3
To:
- Video Codec: avc
- Encoder Level: 4.1
Since the video is encoded with a supported audio codec, within a supported container and supported framerate and resolution, only the video encoding must change.
If you used another tool, it may have tried to convert all videos to the same format, no matter how inefficient it is. That means video.mp4
might have more than its video encoding changed, it might have to have its container, audio codec and framerate changed, as well. That can take up an unnecessary amount of time and resources.
Similarly, the following might have its video track transcoded, too, despite only the audio track needing to be converted to a supported format:
$ cast-convert inspect --name '1st Gen' video.mp4
[โ๏ธ] Need to convert "~/video.mp4" to play on Chromecast 1st Gen...
Must convert from:
- File Container: mp4
- Video Codec: vp9
- Resolution: 640x480
- Frame Rate: 29.970
- Audio Codec: dts
To:
- Audio Codec: mp3
Individual casting devices like the Chromecast have unique video encoding, audio encoding and container support combinations for video files. Cast Convert has detailed compatibility profiles for each individual Chromecast model on the market.
cast-convert
will inspect a video's metadata to determine what video attributes must get changed to successfully play
it. To use resources efficiently, it will determine only the minimum amount of transcoding needed to successfully play
each video back.
$ python3 -m pip install cast_convert
You can run the Python module directly:
$ python3 -m cast_convert --help
Or you can use launcher that gets added to your $PATH
:
$ cast-convert --help
Usage: cast-convert [OPTIONS] COMMAND [ARGS]...
๐ฝ๏ธ Identify and convert videos to formats that are Chromecast supported.
See https://github.com/alexdelorenzo/cast_contvert for more information.
Copyright ยฉ 2022 Alex DeLorenzo (https://alexdelorenzo.dev).
โญโ โ About โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฎ
โ --log-level -l [critical|debug|error|fata ๐ชต Set the minimum logging โ
โ l|info|warn] level. โ
โ [default: warn] โ
โ --version -v ๐ข Show application versioโฆ โ
โ and quit. โ
โฐโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฏ
โญโ ๐ Analyze โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฎ
โ command ๐ Get FFmpeg transcoding command. โ
โ inspect ๐ Inspect videos to see what attributes should get transcoded. โ
โฐโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฏ
โญโ ๐ฝ๏ธ Convert โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฎ
โ convert ๐ผ Convert videos so they're compatible with specified device. โ
โ watch ๐ Watch directories for new or modified videos and convert them. โ
โฐโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฏ
โญโ ๐ ๏ธ Hardware Support โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฎ
โ devices ๐บ List all supported devices. โ
โฐโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฏ
--log-level
You can set the log level using the --log-level
flag:
$ cast-convert --log-level debug devices
[06:12:49] DEBUG DEBUG:root:Loaded devices from file base.py:201
You can use these device names with the --name flag:
- Chromecast 1st Gen
- Chromecast 2nd Gen
- Chromecast 3rd Gen
- Chromecast Ultra
- Chromecast with Google TV
- Google Nest Hub
- Nest Hub Max
Default log level is warn
.
--name
You can specify the model of your device with the --name
flag. It uses fuzzy matching, so you don't have to type out
device names completely.
The --name
flag comes after cast-convert
commands.
$ cast-convert inspect --name '1st Gen' ~/video.webm
[๐๏ธ] Need to convert "/home/user/video.webm" to play on Chromecast 1st Gen...
Must convert from:
- Container: webm
- Codec: vp9
- Resolution: 406x260
- Fps: 25.000
- Level: 0
To:
- Codec: avc
- Level: 4.1
Default device name is Chromecast 1st Gen
.
PATHS
You can specify one or more file or directory paths as PATHS
arguments.
You must specify at least one path. Paths are supplied after commands, and they are the last arguments
to cast-convert
.
$ cast-convert command vid1.mkv vid2.mkv
ffmpeg -fflags +genpts -i 'vid1.mkv' -acodec copy -movflags faststart -scodec
copy -threads 12 -vcodec libx264 -vlevel 4.1 'vid1_transcoded.mkv' -y
ffmpeg -fflags +genpts -i 'vid2.mkv' -acodec copy -movflags faststart -scodec
copy -threads 12 -vcodec libx264 -vlevel 4.1 'vid2_transcoded.mkv' -y
convert
Usage: cast-convert convert [OPTIONS] ๐PATHS
๐ผ Convert videos so they're compatible with specified device.
โญโ Arguments โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฎ
โ * paths ๐PATHS Path(s) to video(s). [required] โ
โฐโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฏ
โญโ Options โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฎ
โ --help Show this message and exit. โ
โฐโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฏ
โญโ ๐บ Device โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฎ
โ --name -n TEXT ๐ Device model name. [default: Chromecast 1st Gen] โ
โฐโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฏ
โญโ ๐ฅ Encoder Options โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฎ
โ --replace -r ๐พ Replace original file with transcoded video. โ
โ --threads -t INTEGER ๐งต Number of threads to tell FFMPEG to use per โ
โ job. โ
โ [default: 12] โ
โฐโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฏ
devices
Usage: cast-convert devices [OPTIONS]
๐บ List all supported devices.
โญโ Options โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฎ
โ --help Show this message and exit. โ
โฐโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฏ
โญโ ๐บ Device โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฎ
โ --details -d โน Show detailed device information. โ
โฐโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฏ
command
Usage: cast-convert command [OPTIONS] ๐PATHS
๐ Get FFmpeg transcoding command.
โญโ Arguments โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฎ
โ * paths ๐PATHS Path(s) to video(s). [required] โ
โฐโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฏ
โญโ Options โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฎ
โ --help Show this message and exit. โ
โฐโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฏ
โญโ ๐บ Device โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฎ
โ --name -n TEXT ๐ Device model name. [default: Chromecast 1st Gen] โ
โฐโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฏ
โญโ ๐ฅ Encoder Options โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฎ
โ --replace -r ๐พ Replace original file with transcoded video. โ
โ --threads -t INTEGER ๐งต Number of threads to tell FFMPEG to use per โ
โ job. โ
โ [default: 12] โ
โฐโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฏ
inspect
Usage: cast-convert inspect [OPTIONS] ๐PATHS
๐ Inspect videos to see what attributes should get transcoded.
โญโ Arguments โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฎ
โ * paths ๐PATHS Path(s) to video(s). [required] โ
โฐโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฏ
โญโ Options โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฎ
โ --help Show this message and exit. โ
โฐโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฏ
โญโ ๐บ Device โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฎ
โ --name -n TEXT ๐ Device model name. [default: Chromecast 1st Gen] โ
โฐโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฏ
watch
Usage: cast-convert watch [OPTIONS] ๐PATHS
๐ Watch directories for new or modified videos and convert them.
โญโ Arguments โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฎ
โ * paths ๐PATHS Path(s) to video(s). [required] โ
โฐโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฏ
โญโ Options โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฎ
โ --help Show this message and exit. โ
โฐโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฏ
โญโ ๐บ Device โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฎ
โ --name -n TEXT ๐ Device model name. [default: Chromecast 1st Gen] โ
โฐโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฏ
โญโ ๐ฅ Encoder Options โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฎ
โ --jobs -j INTEGER ๐ข Number of simultaneous transcoding jobs. โ
โ [default: 2] โ
โ --replace -r ๐พ Replace original file with transcoded video. โ
โ --threads -t INTEGER ๐งต Number of threads to tell FFMPEG to use per โ
โ job. โ
โ [default: 12] โ
โฐโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฏ