Skip to content

Instantly share code, notes, and snippets.

@grzegorzblaszczyk
Last active March 26, 2024 03:12
Show Gist options
  • Save grzegorzblaszczyk/e0fefdc071505af4fa5ae1c9c01f8556 to your computer and use it in GitHub Desktop.
Save grzegorzblaszczyk/e0fefdc071505af4fa5ae1c9c01f8556 to your computer and use it in GitHub Desktop.
WEBM to MP4 converter
#!/bin/bash
# Quick and dirty WEBM to MP4 converter
# by Grzegorz Błaszczyk <grzegorz.blaszczyk@gmail.com> 2017
# License: MIT http://rem.mit-license.org/
FFMPEG=`which ffmpeg`
LAME=`which lame`
RM=`which rm`
EXECS=( "FFMPEG" "LAME" "RM" );
for exec in "${EXECS[@]}"; do
if [ "x${!exec}" == "x" ]; then
echo "Error: Executable $exec is not installed!"
exit 1;
fi
done
if [ "x$1" == "x" ]; then
echo "Syntax $0 [some WEBM file]"
exit 1
fi
INPUT_FILE=$1
FRAMES="30"
if [ -e "${INPUT_FILE}" ]; then
FILENAME="${INPUT_FILE%.*}"
OUTPUT_FILE="${FILENAME}.mp4"
echo "Output file will be: ${OUTPUT_FILE}"
${FFMPEG} -fflags +genpts -i "${INPUT_FILE}" -r ${FRAMES} ${OUTPUT_FILE}
#$MPLAYER -vc dummy -vo null -ao pcm:file=${MP4_FILE}.wav ${MP4_FILE}
#$RM -v "${WEBM_FILE}"
else
echo "Input file ${INPUT_FILE} does not exist :("
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment