Skip to content

Instantly share code, notes, and snippets.

@openly-retro
Created November 25, 2025 03:24
Show Gist options
  • Select an option

  • Save openly-retro/e24fbb445390d517f1b8bed3598a55e7 to your computer and use it in GitHub Desktop.

Select an option

Save openly-retro/e24fbb445390d517f1b8bed3598a55e7 to your computer and use it in GitHub Desktop.
Use FFmpeg to convert a movie file to MKV with open-source/free audio & video codecs
#!/bin/bash
# I use this to convert MOV files from my iphone to more open formats
sourcefile=$1
sourcefilenoext="${sourcefile%.*}"
sourceasmkv="${sourcefilenoext}.mkv"
ffmpeg -i $sourcefile -c:v libsvtav1 -q:v 7 -c:a libopus $sourceasmkv
touch -r $sourcefile $sourceasmkv
# MOV files created on iphones have a special 'filemodifydate' exif data we can use
exiftool -v "-filename<filemodifydate" -d "%Y%m%d_%H%M%S.mkv" $sourceasmkv
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment