LinMinquan's Blog

Experience technology to change life

ffmpeg笔记

我主要是用ffmpeg在windows下写一些简单的命令进行音频、视频处理。用文本工具写命令保存成.bat文件,将bat文件和ffmpeg.exe放在同一个目录里。

wav to aac ,pause命令也可以不写,写了会使得cmd窗口不关闭,不写会自动关闭cmd窗口。

aac to mp3

pcm to aac

mp4 to mp3,提取视频里的音频文件

显示mp4视频的信息

裁剪视频,将222.avi(3840*1080)截取右半边的1920*1080

mp4视频和mp3音频合并,如果mp4里的音频也一起合并,但最终视频的长度取决于mp3音频的长度

将png图片放在mp4视频里,即给视频文件加水印,可以指定图片在视频里的位置

将单张图片变成视频,30秒

把多张图片变成视频,图片的命名是000.png, 001.png, 002.png

将两个视频合并成一个视频,一个左边,一个右边。

https://unix.stackexchange.com/questions/233832/merge-two-video-clips-into-one-placing-them-next-to-each-other

  • hstack will place each video side-by-side.
  • amerge will combine the audio from both inputs into a single, multichannel audio stream, and -ac 2 will make it stereo; without this option the audio stream may end up as 4 channels if both inputs are stereo.

视频转成hap格式

视频转成MPEG-4编码:

 

另外一些参考资料:

Overlay

http://ffmpeg.org/ffmpeg-filters.html#overlay-1

字幕

https://trac.ffmpeg.org/wiki/HowToBurnSubtitlesIntoVideo

Add an image in front of video using ffmpeg

http://video.stackexchange.com/questions/12105/add-an-image-in-front-of-video-using-ffmpeg


Share