Skip to content

Instantly share code, notes, and snippets.

@olijf
Last active December 7, 2023 09:56
Show Gist options
  • Save olijf/ca8a057115af366d376cc2f9a7c152b8 to your computer and use it in GitHub Desktop.
Save olijf/ca8a057115af366d376cc2f9a7c152b8 to your computer and use it in GitHub Desktop.
Convert a video file to a format that can be played on a Chromecast
#!/bin/bash
# Convert a video file to a format that can be played on a Chromecast
# Requires ffmpeg
# Usage: convert-for-chromecast.sh <input file>
# Output: <input file>.chromecast.mp4
# Author:
# Olaf van der Kruk
# Check if input file is given
if [ -z "$1" ]; then
echo "Usage: convert-for-chromecast.sh <input file>"
exit 1
fi
# extract filename and extension
filename=$(basename "$1")
extension="${filename##*.}"
filename="${filename%.*}"
# convert to mp4
ffmpeg -i $1 -c:v copy -c:a aac -strict -2 -af "pan=stereo|FL=0.5*FC+0.707*FL+0.707*BL+0.5*LFE|FR=0.5*FC+0.707*FR+0.707*BR+0.5*LFE" $filename.chromecast.mp4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment