Adding color filter at specific intervals in ffmpeg
I want to add a color filter to the rtmp stream in ffmpeg at specific intervals, like 10 seconds every 10 seconds. I've tried two approaches. First:
-vf "color=#8EABB8@0.9:480x208,select='gte(t,10)*lte(t,20)' [color];[in][color] overlay [out]"
This stream only transmits the 10 seconds denoted by the selection and applies a color filter instead of playing the entire stream and applies the filter to only those 20 seconds.
Then I learned about split and fifo and tried this approach:
-vf "[in] split [no-color], fifo, [with-color] overlay [out]; [no-color] fifo, select='gte(t,10)*lte(t,20)' [with-color]"
I would expect this to play the entire stream and then select 10 seconds so I can apply filters, but it does the same as the first approach and just plays the selected 10 seconds, not the entire stream.
Thanks in advance.
source to share
As this issue is discussed, there seems to be no way to apply video filters to a specific period of a video stream, pieces, apply filters and recombination. Share if you find a better method.
source to share
You have changed the order of the streams included in the overlay.
It looks like if the stream " select
" arrives as the first input to the filter overlay
, the overlay also frees its output at unselected times.
But if you provide a stable stream first before overlay
and then selected, it will output the stream all the time.
I tried the following set of filters:
-vf "[in]split[B1][B2];[B1]fifo,drawbox=-1:-1:5000:5000:invert:2000,vflip,hflip[B1E];[B2]fifo,select='gte(t,5)'[B2E];[B1E][B2E]overlay[out]"
My graph version:
_,--[B1]--fifo--drawbox--flip--[B1E]--._
[in]---split--X X--overlay--[out]
‾'--[B2]--fifo--select---------[B2E]--'‾
Your version was (select filter - first entry overlay
!):
_,--fifo--select---[with-color]--._
[in]---split--X X--overlay--[out]
‾'--[no-color]--fifo-------------'‾
The reason is that
...[B2E];[B1E][B2E]overlay...
and
...,[B1E]overlay...
are equivalent.
But, nevertheless, some problems may arise: do you need it once or every 10 seconds, for example. g.
source to share
I am dealing with a similar problem, I have used a combination of slpit, overlay and concat filters and it works, you can try.
-filter_complex "[0:v]split[v1][v2];[v1]select='lt(t,5)',setpts=PTS-STARTPTS[iv1];[v2]select='gte(t,5)'[over];[over][1:v] overlay=W-w:H-h:shortest=1,setpts=PTS-STARTPTS[iv2];[iv1][iv2]concat=n=2:v=1:a=0"
but my problem is that I am using gif as the second input because it contains transparent color information, but the gif file does not contain audio. how can i make a movie with transparent (or alpha) and audio?
source to share