Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
convertmp4: A bash shell script to make the calls to ffmpeg a little simpler for converting OBS .flv output to .mp4
#!/bin/bash
#
# this will call ffmeg to convert a .flv to a .mp4
#
# NOTE: ffmeg is expected to be install and in your path
#
# usage: convertmp4 infile.flv
#
# output will be a .mp4 file in the same directory
#
# Example:
# convertmp4 /Users/myname/Movies/obsrecording.flv
# will create
# /Users/myname/Movies/obsrecording.mp4
showUsage()
{
echo "usage: $(basename "$0") infile.flv"
}
# only takes one parameter
if [ $# -ne 1 ] ; then
echo "Illegal number of arguments"
showUsage
exit 1
fi
# only works on .flv files
if [[ $1 =~ \.flv$ ]]; then
'ffmpeg' -i "$1" -c copy -copyts "${1%.*}.mp4"
else
echo "Filename should end with .flv"
showUsage
exit 1
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment