Skip to content

Instantly share code, notes, and snippets.

@BlakeBeus
Last active June 1, 2022 01:31
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 BlakeBeus/bd4c09546bfaeafa6cfa7527da72d341 to your computer and use it in GitHub Desktop.
Save BlakeBeus/bd4c09546bfaeafa6cfa7527da72d341 to your computer and use it in GitHub Desktop.
# Convert Single flv to MP4
ffmpeg -i input.flv -vcodec copy output.mp4
# Batch convert flv to mp4
for i in *.flv; do ffmpeg -i "$i" -vcodec copy "${i%.*}.mp4"; done
#MOV to MP4 re-encode the video and audio streams for smaller file size (slow)
ffmpeg -i input.mov -vcodec h264 -acodec aac output.mp4
#MOV to MP4 copy video and audio streams to new container (fast)
ffmpeg -i movie.mov -vcodec copy -acodec copy out.mp4
#Get video info
ffprobe -show_streams -i "file.mp4"
#Scale video keep ratio
ffmpeg -i input.mp4 -vf scale=-1:720 output_720.mp4
#download video from m3u8 playlist
echo "Enter m3u8 link:";read link;echo "Enter output filename:";read filename;ffmpeg -i "$link" -bsf:a aac_adtstoasc -vcodec copy -c copy -crf 50 $filename.mp4
#convert .ts file to mp4
ffmpeg -i input.ts -acodec copy -vcodec copy out.mp4
#quickly compress all files in a folder (must create /compressed folder before running
for f in ./*mp4; do ffmpeg -i "$f" -vcodec h264 "compressed/${f##*/}"; done
# https://web.dev/replace-gifs-with-videos/
# gif to mp4
ffmpeg -i my-animation.gif -b:v 0 -crf 25 -f mp4 -vcodec libx264 -pix_fmt yuv420p my-animation.mp4
#gif to webp
ffmpeg -i my-animation.gif -c vp9 -b:v 0 -crf 41 my-animation.webm
#aifc to mp3 192kbps 44.1kHz
ffmpeg -i myinput.aifc -f mp3 -acodec libmp3lame -b:a 192000 -ar 44100 myoutput.mp3
#extract mp3 from video
ffmpeg -i video.mp4 -f mp3 -ab 192000 -vn music.mp3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment