文章目录
1 提取音视频流
1.1 提取音频流
ffmpeg431.exe -i ande_302.mp4 -vn -acodec copy -f mp4 -y ande_302-vn.mp4
1.2 提取视频流
ffmpeg431.exe -i ande_302.mp4 -an -vcodec copy -f mp4 -y ande_302-an.mp4
选项详解:
- -i : 指定的文件。
- -vn:video no。
- -an:audio no。
- -acodec:audio codec。
- -vcodec:video codec。
- -f:指定封装格式。
- -y:直接覆盖。
另外补充个关于1080P和720P的概念:
- 1080P: 1920x1080。
- 720P: 1280x720 。
2 截取音视频片段
命令如下:
ffmpeg431.exe -i ande_302.mp4 -ss 10 -t 00:00:10 -c copy -f mp4 -y ande_302-ss10-t10.mp4
// 技巧:-ss 放到-i 前头,效率就会很高。
ffmpeg431.exe -ss 10 -i ande_302.mp4 -t 00:00:10 -c copy -f mp4 -y ande_302-ss10-t10.mp4
参数详解:
- -ss:start second。
- -t:time,截取多长时间。
- -c copy:直接复制,不经过重新编码(这样比较快)。
3 合并音视频
命令如下:
ffmpeg431.exe -i ande_302-an.mp4 -i ande_302-vn.mp4 -c copy -f mp4 ande_302-newfull.mp4
命令比较简单,没什么好解释的。
4 Libx265/Libxvid 重新编解码
Libxvid(iso+mpeg:mpeg1(vcd),2(dvd), 4(10:avc,h.264; 3:audio;4:video(xvid,vidx))
libmp3lame(iso,mpeg1, layer3)
libx264: itu(h.26x: 1,3,4,5),avc, AVC(H.264: libx264, openh264),advanced video coding
libx265: hevc(HEVC), high efficience video coding
ffmpeg431.exe -i ande_302.mp4 -acodec libmp3lame -vcodec libxvid -f mp4
ande_302-xvid-mp3.mp4
ffmpeg431.exe -i ande_302.mp4 -acodec libmp3lame -vcodec libx265 -f mp4
ande_302-xvid-