Skip to content

Instantly share code, notes, and snippets.

@jsfaint
Last active March 24, 2021 05: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 jsfaint/eed8f868f0047981fe29bbc0b227dadd to your computer and use it in GitHub Desktop.
Save jsfaint/eed8f868f0047981fe29bbc0b227dadd to your computer and use it in GitHub Desktop.
Convert FLV to MP4 powered by ffmpeg
#!/bin/bash
[[ -z $1 ]] && echo "flv2mp4 <flv name>"
src=$1
if [[ -d $src ]] && command -v fzf > /dev/null 2>&1; then
src="$(fd . -e flv "$src" | fzf -e -m)"
fi
if [[ -z $src ]]; then
echo "Invalid parameter"
exit 1
fi
dest="${src/.flv/}.mp4"
if test -z "$dest"; then
echo "Invalid parameter"
exit 1
fi
echo "Convert $(basename "$src") to MP4"
ffmpeg -i "$src" -codec copy "$dest"
echo "All Done."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment