Skip to content

Instantly share code, notes, and snippets.

@feiandxs
Last active June 15, 2022 03:04
Show Gist options
  • Save feiandxs/5d7ccc70100dcc49c86d479c85933a4f to your computer and use it in GitHub Desktop.
Save feiandxs/5d7ccc70100dcc49c86d479c85933a4f to your computer and use it in GitHub Desktop.
FFmpeg commands

There are too many ffmpeg parameters, but there is no need to remember them.

Use 'convert FormatA to FormatB' to search.

convert jpeg to gif

ffmpeg -i A.jpeg A.gif

convert png to gif

ffmpeg -i A.png A.gif

convert jpg to gif

ffmpeg -i A.jpg A.gif

convert gif to jpg

ffmpeg -i A.gif A.jpg

convert gif to png

ffmpeg -i A.gif A.png

convert mkv to mp4

ffmpeg -i example.mkv -c copy example.mp4

for multi mkv to mp4

Linux or macOS

for f in *.mkv; do ffmpeg -i "$f" -c copy "${f%.mkv}.mp4"; done

Windows

for /R %%f IN (*.mkv) DO ffmpeg -i "%%f" -c copy "%%~nf.mp4"

convert flv to mp4

####Use the "-c copy" parameter to convert losslessly, without lossy conversion

ffpmeg -i A.flv -c copy A.mp4

convert mp4 to gif

ffmpeg -i S.mp4 S.gif

convert mp4 to mp3

ffmpeg -i test.mp4 -f mp3 -vn test.mp3

here, -f means format, -vn means video not

convert rmvb to mp4

ffmpeg -i name1.rmvb -c:v libx264 -strict -2 name2.mp4

convert ape to mp3

ffmpeg -i test.ape target.mp3

for multi ape to mp3

Linux or macOS

for f in *.ape; do ffmpeg -i "$f" "${f%.ape}.mp3"; done

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment