Skip to content

Instantly share code, notes, and snippets.

@ericholsinger
Created March 19, 2015 11:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ericholsinger/9fa39d7dcf6491ce6f96 to your computer and use it in GitHub Desktop.
Save ericholsinger/9fa39d7dcf6491ce6f96 to your computer and use it in GitHub Desktop.
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