您的位置:首页 > 其它

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


Merging two video streams and saving as one file

I'm writing chat application with video call using webRTC. I have two 
MediaStream
s,
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.mp4
 and 
in_picture.mp4
,
then it send some information to the
-filter_complex
 flag...

The 
-filter_complex
 flag 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
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: