Skip to content

Instantly share code, notes, and snippets.

@hellokaton
Last active August 28, 2018 02:37
Show Gist options
  • Save hellokaton/6115ca2dac43b52fb0a349158d8f5086 to your computer and use it in GitHub Desktop.
Save hellokaton/6115ca2dac43b52fb0a349158d8f5086 to your computer and use it in GitHub Desktop.
ffmpeg常用操作

提取音频

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

提取视频

ffmpeg -i a.mp4 -vcodec copy -an b.mp4

合并音频视频

ffmpeg -i a1.mp4 -i a2.mp3 -vcodec copy -acodec copy b.mp4

转换格式

ffmpeg -i "outputfile.flv" -qscale 0 "outputfile.mp4"

合并视频

ffmpeg -f concat -i file-list.txt -c copy outputfile_part3.mp4

file-list.txt

file 'a1.mp4'
file 'a2.mp4'

按时间截取

ffmpeg -i outputfile.mp4 -t 00:00:10 -c copy outputfile_part1.mp4 -ss 00:00:10 -codec copy outputfile_part2.mp4

10 秒开始截取分为 2 段。

加速

ffmpeg -i a.mp4 -filter_complex "[0:v]setpts=0.9*PTS[v];[0:a]atempo=1.1[a]" -map "[v]" -map "[a]" b.mp4

0.9:原来的 0.9 倍速度

@vzardlloo
Copy link

six six six 🥇

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