ffmpeg filter command
2016-05-23 21:24
369 查看
------------------------------------------------------------------------------------
ffmpeg -i vod1.flv -i vod2.flv -filter_complex "[0 0]scale=720x480[main_video];
[1 0]scale=700x450[in_picture];[main_video][in_picture]overlay=10:10"
out05231943.flv
vod2 over vod1 with postion 10,10
------------------------------------------------------------------------------------
http://corpus.hubwiz.com/2/node.js/19154807.html
I'm writing chat application with video call using webRTC. I have two
remote and local and want to merge and save them as one file. So when opening a file, i shall see large video frame (remote stream) and little video frame at top right (local stream). Now I can record these two streams separately using RecordRTC. How can i
merge them with nodejs? (no code because I don't know how it's done)
node.js
video-streaming
webrtc
You can use FFmpeg with
is a working and tested example using FFmpeg version N-62162-gec8789a:
So, this command tells FFmpeg to read from two input files,
then it send some information to the
The
input, first video track) and scale this video to be 640x480px and it identifies the video as
then, takes the
input, video track 0) and resize the video to 240x180px naming the video
then it merges both videos making an overlay of the second one at x=390 y=10.
Then it saves the output to
It is that what you want?
UPDATE: I forgot to add, all you need in node is a module to run FFmpeg, there are plenty of those: https://nodejsmodules.org/tags/ffmpeg
------------------------------------------------------------------------------------
ffmpeg cut video with time
ffmpeg -ss 00:00:00 -t 00:00:20 -i vod.flv -vcodec copy -acodec copy vod20s.flv
------------------------------------------------------------------------------------
1/4 every video, use first audio
ffmpeg -i vod1.flv -i vod2.flv -i vod3.flv -i vod4.flv -filter_complex "[0:v]pad=iw*2:ih*2[a];[a][1:v]overlay=w[b];[b][2:v]overlay=0:h[c];[c][3:v]overlay=w:h" out0080.flv
------------------------------------------------------------------------------------
ok:mux multi font
ffmpeg -i src.mp4 -vf "drawtext=fontfile=/usr/share/fonts/truetype/droid/DroidSansMono.ttf : fontcolor=white : text='Suker-10-10' : x=10: y=10, drawtext=fontfile=/usr/share/fonts/truetype/droid/DroidSansMono.ttf : fontcolor=white : text='Suker10-100' : x=10:
y=100, drawtext=fontfile=/usr/share/fonts/truetype/droid/DroidSansMono.ttf : fontcolor=white : text='Suker10-200' : x=10: y=200" -an -y outfont.mp4
------------------------------------------------------------------------------------
ffplay -f rawvideo -video_size 1920x1080 input.yuv
------------------------------------------------------------------------------------
mux two video
ffmpeg -i 01.mp4 -i mvp.mp4 -filter_complex "[0:v]format=rgb24,setsar=sar=1/1[mv];[1:v]format=rgb24,setsar=sar=1/1[in];[in][mv]blend=all_mode='addition':all_opacity=1,format=rgb24" -strict -2 output.mp4
ffmpeg -i vod1.flv -i vod2.flv -filter_complex "[0 0]scale=720x480[main_video];
[1 0]scale=700x450[in_picture];[main_video][in_picture]overlay=10:10"
out05231943.flv
vod2 over vod1 with postion 10,10
------------------------------------------------------------------------------------
http://corpus.hubwiz.com/2/node.js/19154807.html
Merging two video streams and saving as one file
I'm writing chat application with video call using webRTC. I have two MediaStreams,
remote and local and want to merge and save them as one file. So when opening a file, i shall see large video frame (remote stream) and little video frame at top right (local stream). Now I can record these two streams separately using RecordRTC. How can i
merge them with nodejs? (no code because I don't know how it's done)
node.js
video-streaming
webrtc
You can use FFmpeg with
-filter_complex, here
is a working and tested example using FFmpeg version N-62162-gec8789a:
ffmpeg -i main_video.mp4 -i in_picture.mp4 -filter_complex "[00]scale=640x480[main_video]; [10]scale=240x180[in_picture];[main_video][in_picture]overlay=390:10" output.mp4
So, this command tells FFmpeg to read from two input files,
main_video.mp4and
in_picture.mp4,
then it send some information to the
-filter_complexflag...
The
-filter_complexflag takes the
[0 0](first
input, first video track) and scale this video to be 640x480px and it identifies the video as
[main_video],
then, takes the
[1 0](second
input, video track 0) and resize the video to 240x180px naming the video
[in_picture],
then it merges both videos making an overlay of the second one at x=390 y=10.
Then it saves the output to
output.mp4
It is that what you want?
UPDATE: I forgot to add, all you need in node is a module to run FFmpeg, there are plenty of those: https://nodejsmodules.org/tags/ffmpeg
------------------------------------------------------------------------------------
ffmpeg cut video with time
ffmpeg -ss 00:00:00 -t 00:00:20 -i vod.flv -vcodec copy -acodec copy vod20s.flv
------------------------------------------------------------------------------------
1/4 every video, use first audio
ffmpeg -i vod1.flv -i vod2.flv -i vod3.flv -i vod4.flv -filter_complex "[0:v]pad=iw*2:ih*2[a];[a][1:v]overlay=w[b];[b][2:v]overlay=0:h[c];[c][3:v]overlay=w:h" out0080.flv
------------------------------------------------------------------------------------
ok:mux multi font
ffmpeg -i src.mp4 -vf "drawtext=fontfile=/usr/share/fonts/truetype/droid/DroidSansMono.ttf : fontcolor=white : text='Suker-10-10' : x=10: y=10, drawtext=fontfile=/usr/share/fonts/truetype/droid/DroidSansMono.ttf : fontcolor=white : text='Suker10-100' : x=10:
y=100, drawtext=fontfile=/usr/share/fonts/truetype/droid/DroidSansMono.ttf : fontcolor=white : text='Suker10-200' : x=10: y=200" -an -y outfont.mp4
------------------------------------------------------------------------------------
ffplay -f rawvideo -video_size 1920x1080 input.yuv
------------------------------------------------------------------------------------
mux two video
ffmpeg -i 01.mp4 -i mvp.mp4 -filter_complex "[0:v]format=rgb24,setsar=sar=1/1[mv];[1:v]format=rgb24,setsar=sar=1/1[in];[in][mv]blend=all_mode='addition':all_opacity=1,format=rgb24" -strict -2 output.mp4
相关文章推荐
- hdoj2053
- 【算法总结系列-5】链表与模拟链表
- 计算机图形学(二)输出图元_14_OpenGL像素阵列函数_1_位图函数
- FFmpeg实用命令
- Java的八种基本数据类型
- HDU 2767 强联通分量
- Spring-mybatis的整合
- 如何跨UI实现功能
- 蓝桥杯 算法训练 最大的算式 (动态规划)
- CodeForces 4A Watermelon(太水了。。。。。)
- HDU 2539 点球大战(字符串+输出坑)
- 0516正则表达式
- HTTP状态码大全
- Leetcode 217. Contains Duplicate
- 软考二进宫-总结篇
- Eclipse调整Java和xml代码字体大小
- mybatis分页插件
- socket关闭之close()和shutdown()的差异
- hdoj 2032杨辉三角 解题报告
- SQL Server 2008 R2安装与使用