v1.0.2
1.using the video duration parsed from video file 2.make compatiable with the recording file with the start time not being zero 3.merge with blank jpg for the last segment audio without video 4.adjust video codec param ,using cfr, 20fps,gop 100
正在显示
2 个修改的文件
包含
29 行增加
和
11 行删除
| 1 | merge_av | 1 | merge_av |
| 2 | 2 | ||
| 3 | -此应用程序读入3mang webrtc课堂录像信息文件,根据各音频视频文件的开始和结束时间,运行ffmpeg对音频文件进行切分,再与视频文件合成。对每段开始音频无视频对应部分,取下一段视频的第一帧图像重复。 | 3 | +此应用程序读入3mang webrtc课堂录像信息文件,根据各音频视频文件的开始和结束时间,运行ffmpeg获取各视频文件的实际时长,对音频文件进行切分,再与视频文件合成。对每段开始音频无视频对应部分,取下一段视频的第一帧图像重复。最后一段无视频对应的音频, |
| 4 | +采用blank.jpg的图像与之合成。 | ||
| 4 | 各段音视频合成为ts文件后,再拼接。最后把拼接后的ts文件再重新转换时间戳。所有这些操作都是调用ffmpeg命令完成的,因此merge_av程序运行需要确保ffmpeg所在路径添加在系统执行路径环境变量里。 | 5 | 各段音视频合成为ts文件后,再拼接。最后把拼接后的ts文件再重新转换时间戳。所有这些操作都是调用ffmpeg命令完成的,因此merge_av程序运行需要确保ffmpeg所在路径添加在系统执行路径环境变量里。 |
| 5 | 6 | ||
| 6 | 运行示例: | 7 | 运行示例: |
| @@ -24,31 +25,48 @@ merge_av uid_284176605_20171127113703805.txt | @@ -24,31 +25,48 @@ merge_av uid_284176605_20171127113703805.txt | ||
| 24 | 25 | ||
| 25 | merge_av读入上述内容,解析后依次执行如下命令,最终生成dest.ts文件,是合成后是音视频文件,(各临时文件缺省删除,可以添加-k 参数保留,如merge_av uid_284176605_20171127113703805.txt -k) | 26 | merge_av读入上述内容,解析后依次执行如下命令,最终生成dest.ts文件,是合成后是音视频文件,(各临时文件缺省删除,可以添加-k 参数保留,如merge_av uid_284176605_20171127113703805.txt -k) |
| 26 | 这些命令可以通过 "merge_av uid_284176605_20171127113703805.txt -p"输出查看(-p就是只打印命令,不执行) : | 27 | 这些命令可以通过 "merge_av uid_284176605_20171127113703805.txt -p"输出查看(-p就是只打印命令,不执行) : |
| 28 | +;获取视频视频时长 | ||
| 29 | +ffmpeg -y -i 284176605_20171127113705486.webm -vcodec copy -an 284176605_20171127113705486.webm.mkv | ||
| 30 | +ffmpeg -i 284176605_20171127113705486.webm.mkv &> 284176605_20171127113705486.webm.txt | ||
| 31 | +#file:284176605_20171127113705486.webm , duration in recording file: 23.252, duration parsed from file: 23.170 | ||
| 32 | +ffmpeg -y -i 284176605_20171127113731534.webm -vcodec copy -an 284176605_20171127113731534.webm.mkv | ||
| 33 | +ffmpeg -i 284176605_20171127113731534.webm.mkv &> 284176605_20171127113731534.webm.txt | ||
| 34 | +file:284176605_20171127113731534.webm , duration in recording file: 832.260, duration parsed from file: 815.920 | ||
| 35 | +ffmpeg -y -i 284176605_20171127115159445.webm -vcodec copy -an 284176605_20171127115159445.webm.mkv | ||
| 36 | +ffmpeg -i 284176605_20171127115159445.webm.mkv &> 284176605_20171127115159445.webm.txt | ||
| 37 | +#file:284176605_20171127115159445.webm , duration in recording file: 65.524, duration parsed from file: 65.440 | ||
| 38 | +ffmpeg -y -i 284176605_20171127115308444.webm -vcodec copy -an 284176605_20171127115308444.webm.mkv | ||
| 39 | +ffmpeg -i 284176605_20171127115308444.webm.mkv &> 284176605_20171127115308444.webm.txt | ||
| 40 | +#file:284176605_20171127115308444.webm , duration in recording file: 1805.872, duration parsed from file: 1801.090 | ||
| 41 | +;切分,合成 | ||
| 27 | ffmpeg -y -i 284176605_20171127113703805.aac -ss 0.000 -t 1.681 -acodec copy 0_284176605_20171127113703805.aac | 42 | ffmpeg -y -i 284176605_20171127113703805.aac -ss 0.000 -t 1.681 -acodec copy 0_284176605_20171127113703805.aac |
| 28 | ffmpeg -y -i 284176605_20171127113705486.webm -vframes 1 -ss 0 -f mjpeg -an 284176605_20171127113705486.webm.jpg | 43 | ffmpeg -y -i 284176605_20171127113705486.webm -vframes 1 -ss 0 -f mjpeg -an 284176605_20171127113705486.webm.jpg |
| 29 | ffmpeg -y -loop 1 -i 284176605_20171127113705486.webm.jpg -i 0_284176605_20171127113703805.aac -loop 0 -shortest -acodec copy -vcodec libx264 -level 3.1 -preset veryfast -g 40 -r 20 0.ts | 44 | ffmpeg -y -loop 1 -i 284176605_20171127113705486.webm.jpg -i 0_284176605_20171127113703805.aac -loop 0 -shortest -acodec copy -vcodec libx264 -level 3.1 -preset veryfast -g 40 -r 20 0.ts |
| 30 | -ffmpeg -y -i 284176605_20171127113703805.aac -ss 1.681 -t 23.252 -acodec copy 1_284176605_20171127113703805.aac | 45 | +ffmpeg -y -i 284176605_20171127113703805.aac -ss 1.681 -t 23.170 -acodec copy 1_284176605_20171127113703805.aac |
| 31 | ffmpeg -y -i 1_284176605_20171127113703805.aac -i 284176605_20171127113705486.webm -acodec copy -vcodec libx264 -level 3.1 -preset veryfast -g 40 -r 20 1.ts | 46 | ffmpeg -y -i 1_284176605_20171127113703805.aac -i 284176605_20171127113705486.webm -acodec copy -vcodec libx264 -level 3.1 -preset veryfast -g 40 -r 20 1.ts |
| 32 | -ffmpeg -y -i 284176605_20171127113703805.aac -ss 24.933 -t 2.796 -acodec copy 2_284176605_20171127113703805.aac | 47 | +ffmpeg -y -i 284176605_20171127113703805.aac -ss 24.851 -t 2.878 -acodec copy 2_284176605_20171127113703805.aac |
| 33 | ffmpeg -y -i 284176605_20171127113731534.webm -vframes 1 -ss 0 -f mjpeg -an 284176605_20171127113731534.webm.jpg | 48 | ffmpeg -y -i 284176605_20171127113731534.webm -vframes 1 -ss 0 -f mjpeg -an 284176605_20171127113731534.webm.jpg |
| 34 | ffmpeg -y -loop 1 -i 284176605_20171127113731534.webm.jpg -i 2_284176605_20171127113703805.aac -loop 0 -shortest -acodec copy -vcodec libx264 -level 3.1 -preset veryfast -g 40 -r 20 2.ts | 49 | ffmpeg -y -loop 1 -i 284176605_20171127113731534.webm.jpg -i 2_284176605_20171127113703805.aac -loop 0 -shortest -acodec copy -vcodec libx264 -level 3.1 -preset veryfast -g 40 -r 20 2.ts |
| 35 | -ffmpeg -y -i 284176605_20171127113703805.aac -ss 27.729 -t 832.260 -acodec copy 3_284176605_20171127113703805.aac | 50 | +ffmpeg -y -i 284176605_20171127113703805.aac -ss 27.729 -t 815.920 -acodec copy 3_284176605_20171127113703805.aac |
| 36 | ffmpeg -y -i 3_284176605_20171127113703805.aac -i 284176605_20171127113731534.webm -acodec copy -vcodec libx264 -level 3.1 -preset veryfast -g 40 -r 20 3.ts | 51 | ffmpeg -y -i 3_284176605_20171127113703805.aac -i 284176605_20171127113731534.webm -acodec copy -vcodec libx264 -level 3.1 -preset veryfast -g 40 -r 20 3.ts |
| 37 | -ffmpeg -y -i 284176605_20171127113703805.aac -ss 859.989 -t 35.651 -acodec copy 4_284176605_20171127113703805.aac | 52 | +ffmpeg -y -i 284176605_20171127113703805.aac -ss 843.649 -t 51.991 -acodec copy 4_284176605_20171127113703805.aac |
| 38 | ffmpeg -y -i 284176605_20171127115159445.webm -vframes 1 -ss 0 -f mjpeg -an 284176605_20171127115159445.webm.jpg | 53 | ffmpeg -y -i 284176605_20171127115159445.webm -vframes 1 -ss 0 -f mjpeg -an 284176605_20171127115159445.webm.jpg |
| 39 | ffmpeg -y -loop 1 -i 284176605_20171127115159445.webm.jpg -i 4_284176605_20171127113703805.aac -loop 0 -shortest -acodec copy -vcodec libx264 -level 3.1 -preset veryfast -g 40 -r 20 4.ts | 54 | ffmpeg -y -loop 1 -i 284176605_20171127115159445.webm.jpg -i 4_284176605_20171127113703805.aac -loop 0 -shortest -acodec copy -vcodec libx264 -level 3.1 -preset veryfast -g 40 -r 20 4.ts |
| 40 | -ffmpeg -y -i 284176605_20171127113703805.aac -ss 895.640 -t 65.524 -acodec copy 5_284176605_20171127113703805.aac | 55 | +ffmpeg -y -i 284176605_20171127113703805.aac -ss 895.640 -t 65.440 -acodec copy 5_284176605_20171127113703805.aac |
| 41 | ffmpeg -y -i 5_284176605_20171127113703805.aac -i 284176605_20171127115159445.webm -acodec copy -vcodec libx264 -level 3.1 -preset veryfast -g 40 -r 20 5.ts | 56 | ffmpeg -y -i 5_284176605_20171127113703805.aac -i 284176605_20171127115159445.webm -acodec copy -vcodec libx264 -level 3.1 -preset veryfast -g 40 -r 20 5.ts |
| 42 | -ffmpeg -y -i 284176605_20171127113703805.aac -ss 961.164 -t 3.475 -acodec copy 6_284176605_20171127113703805.aac | 57 | +ffmpeg -y -i 284176605_20171127113703805.aac -ss 961.080 -t 3.559 -acodec copy 6_284176605_20171127113703805.aac |
| 43 | ffmpeg -y -i 284176605_20171127115308444.webm -vframes 1 -ss 0 -f mjpeg -an 284176605_20171127115308444.webm.jpg | 58 | ffmpeg -y -i 284176605_20171127115308444.webm -vframes 1 -ss 0 -f mjpeg -an 284176605_20171127115308444.webm.jpg |
| 44 | ffmpeg -y -loop 1 -i 284176605_20171127115308444.webm.jpg -i 6_284176605_20171127113703805.aac -loop 0 -shortest -acodec copy -vcodec libx264 -level 3.1 -preset veryfast -g 40 -r 20 6.ts | 59 | ffmpeg -y -loop 1 -i 284176605_20171127115308444.webm.jpg -i 6_284176605_20171127113703805.aac -loop 0 -shortest -acodec copy -vcodec libx264 -level 3.1 -preset veryfast -g 40 -r 20 6.ts |
| 45 | -ffmpeg -y -i 284176605_20171127113703805.aac -ss 964.639 -t 1815.808 -acodec copy 7_284176605_20171127113703805.aac | 60 | +ffmpeg -y -i 284176605_20171127113703805.aac -ss 964.639 -t 1801.090 -acodec copy 7_284176605_20171127113703805.aac |
| 46 | ffmpeg -y -i 7_284176605_20171127113703805.aac -i 284176605_20171127115308444.webm -acodec copy -vcodec libx264 -level 3.1 -preset veryfast -g 40 -r 20 7.ts | 61 | ffmpeg -y -i 7_284176605_20171127113703805.aac -i 284176605_20171127115308444.webm -acodec copy -vcodec libx264 -level 3.1 -preset veryfast -g 40 -r 20 7.ts |
| 47 | -copy /B 0.ts + /B 1.ts + /B 2.ts + /B 3.ts + /B 4.ts + /B 5.ts + /B 6.ts + /B 7.ts m.ts ;windows | ||
| 48 | -cat 0.ts 1.ts 2.ts 3.ts 4.ts 5.ts 6.ts 7.ts> m.ts ;linux | 62 | +ffmpeg -y -i 284176605_20171127113703805.aac -ss 2765.729 -t 14.718 -acodec copy 8_284176605_20171127113703805.aac |
| 63 | +ffmpeg -y -loop 1 -i /home/hubin/merge_av/blank.jpg -i 8_284176605_20171127113703805.aac -loop 0 -shortest -acodec copy -vcodec libx264 -level 3.1 -preset veryfast -g 40 -r 20 8.ts | ||
| 64 | +copy /B 0.ts + /B 1.ts + /B 2.ts + /B 3.ts + /B 4.ts + /B 5.ts + /B 6.ts + /B 7.ts +/B 8.ts m.ts ;windows | ||
| 65 | +cat 0.ts 1.ts 2.ts 3.ts 4.ts 5.ts 6.ts 7.ts 8.ts> m.ts ;linux | ||
| 49 | ffmpeg -y -i m.ts -acodec copy -vcodec copy dest.ts | 66 | ffmpeg -y -i m.ts -acodec copy -vcodec copy dest.ts |
| 50 | 67 | ||
| 51 | -调用ffmpeg时,视频编码参数是: -vcodec libx264 -level 3.1 -preset veryfast -g 40 -r 20 | 68 | + |
| 69 | +调用ffmpeg时,视频编码参数是: -vcodec libx264 -level 3.1 -preset veryfast -g 100 -r 20 -bf 0 -vsync cfr | ||
| 52 | 音频编码参数是: -acodec copy | 70 | 音频编码参数是: -acodec copy |
| 53 | 如果要修改,windows下在merge_av.exe同目录下新建merge_av.cfg文本文件,第一行保存视频编码,第二行保存音频编码;linux 下,merge_av.cfg保存在HOME目录下的merge_av目录。 | 71 | 如果要修改,windows下在merge_av.exe同目录下新建merge_av.cfg文本文件,第一行保存视频编码,第二行保存音频编码;linux 下,merge_av.cfg保存在HOME目录下的merge_av目录。 |
| 54 | 72 |
不能预览此文件类型
-
请 注册 或 登录 后发表评论