add -shortest option when call ffmpeg to let it write the end of mp4 when pipe closed
正在显示
3 个修改的文件
包含
3 行增加
和
4 行删除
| @@ -6,8 +6,7 @@ npm install | @@ -6,8 +6,7 @@ npm install | ||
| 6 | 6 | ||
| 7 | 运行命令示例: | 7 | 运行命令示例: |
| 8 | ;record duration 30s framerate 20fps width 640 height 320 videobitrate 800k | 8 | ;record duration 30s framerate 20fps width 640 height 320 videobitrate 800k |
| 9 | -electron . -u http://182.92.9.182:9090/media/hlsPlayer/hlsPlayer.html -d 30 -f 20 -w 640 -h 320 -b 800k test.flv | ||
| 10 | -ffmpeg -i test.flv -acodec copy -vcodec copy test.mp4 | 9 | +electron . -u http://182.92.9.182:9090/media/hlsPlayer/hlsPlayer.html -d 30 -f 20 -w 640 -h 320 -b 800k test.mp4 |
| 11 | 10 | ||
| 12 | 局限: | 11 | 局限: |
| 13 | 1. electron需要在桌面环境下运行 | 12 | 1. electron需要在桌面环境下运行 |
| @@ -126,6 +126,7 @@ function startFFmpeg(videosize) { | @@ -126,6 +126,7 @@ function startFFmpeg(videosize) { | ||
| 126 | 126 | ||
| 127 | args.push('-acodec'); | 127 | args.push('-acodec'); |
| 128 | args.push('aac'); | 128 | args.push('aac'); |
| 129 | + args.push('-shortest'); | ||
| 129 | args.push(argv._[0]); | 130 | args.push(argv._[0]); |
| 130 | 131 | ||
| 131 | console.log(args.join` `); | 132 | console.log(args.join` `); |
| 1 | ;record duration 30s framerate 20fps width 640 height 320 videobitrate 800k | 1 | ;record duration 30s framerate 20fps width 640 height 320 videobitrate 800k |
| 2 | -electron . -u http://182.92.9.182:9090/media/hlsPlayer/hlsPlayer.html -d 30 -f 20 -w 640 -h 320 -b 800k test.flv | ||
| 3 | -ffmpeg -i test.flv -vcodec copy -acodec copy test.mp4 | 2 | +electron . -u http://182.92.9.182:9090/media/hlsPlayer/hlsPlayer.html -d 30 -f 20 -w 640 -h 320 -b 800k test.mp4 |
-
请 注册 或 登录 后发表评论