FFMPEG Image overlay Fade in and out on Video not working properly,,

classic Classic list List threaded Threaded
12 messages Options
Reply | Threaded
Open this post in threaded view
|

FFMPEG Image overlay Fade in and out on Video not working properly,,

ankur456799
hi i have a video around 30 second and i want to set overlay image between 5 - 10 second only and play remaining video as per as... but i have an issue the video start with black screen and fade in on 5th second and play well upto 10 second and fade out to black after 10 second and whole video is black screen upto 30 second

-i input.mp4  -i 34232944.png -filter_complex " [0:v][1:v] overlay=0:0:enable='between(t,5,10)',fade=t=in:st=5:d=1, fade=t=out:st=10:d=1  '" -c:v libx264 -crf 23 output.mp4

video link:- https://www.dropbox.com/s/vmbed5vxtakfhg5/TinyTake24-08-2015-02-59-59.mp4?dl=0

Please help me..
Thanks
Ankur Tripathi
Reply | Threaded
Open this post in threaded view
|

Re: FFMPEG Image overlay Fade in and out on Video not working properly,,

kchandu5200
This post was updated on .
CONTENTS DELETED
The author has deleted this message.
Reply | Threaded
Open this post in threaded view
|

Re: FFMPEG Image overlay Fade in and out on Video not working properly, ,

Moritz Barsnick
In reply to this post by ankur456799
On Mon, Aug 24, 2015 at 02:30:11 -0700, ankur456799 wrote:
> hi i have a video around 30 second and i want to set overlay image between 5
> - 10 second only and play remaining video as per as... but i have an issue
> the video start with black screen and fade in on 5th second and play well
> upto 10 second and fade out to black after 10 second and whole video is
> black screen upto 30 second
>
> -i input.mp4  -i 34232944.png -filter_complex " [0:v][1:v]
> overlay=0:0:enable='between(t,5,10)',fade=t=in:st=5:d=1,
> fade=t=out:st=10:d=1  '" -c:v libx264 -crf 23 output.mp4

With "overlay[...],fade[...],fade[...]", you're appying the fading to the
whole video and not just the overlay. It's a filter chain, you see, and
the fade filters are chained behind the overlay.

You will want to do something like adding "-loop 1" before the overlay
image, and then using a filter like this:

  -filter_complex "[1:v]fade=t=in:st=5:d=1,fade=t=out:st=10:d=1[over];[0:v][over]overlay=0:0"

(First creates an in+out-faded version of the overlay image as
"[over]", then overlays. "Works for me (TM)".)

Moritz
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user
Reply | Threaded
Open this post in threaded view
|

Re: FFMPEG Image overlay Fade in and out on Video not working properly,,

ankur456799
In reply to this post by kchandu5200
Chandu have you understand my question?
its not about how to use fade in or fade out... here is the issue related to fade in -  out ovelrlay image..
 
Reply | Threaded
Open this post in threaded view
|

Re: FFMPEG Image overlay Fade in and out on Video not working properly, ,

ankur456799
In reply to this post by Moritz Barsnick
Some thing like this
-i input.mp4  -i 34232944.png -filter_complex " -loop 1 [0:v][1:v]
 overlay=0:0:enable='between(t,5,10)',fade=t=in:st=5:d=1,
 fade=t=out:st=10:d=1  '" -c:v libx264 -crf 23 output.mp4

or

-i input.mp4  -i 34232944.png -filter_complex " [0:v][1:v]  -loop 1
 overlay=0:0:enable='between(t,5,10)',fade=t=in:st=5:d=1,
 fade=t=out:st=10:d=1  '" -c:v libx264 -crf 23 output.mp4
Reply | Threaded
Open this post in threaded view
|

Re: FFMPEG Image overlay Fade in and out on Video not working properly, ,

Moritz Barsnick
On Mon, Aug 24, 2015 at 04:40:53 -0700, ankur456799 wrote:

> Some thing like this
> -i input.mp4  -i 34232944.png -filter_complex " -loop 1 [0:v][1:v]
>  overlay=0:0:enable='between(t,5,10)',fade=t=in:st=5:d=1,
>  fade=t=out:st=10:d=1  '" -c:v libx264 -crf 23 output.mp4
>
> or
>
> -i input.mp4  -i 34232944.png -filter_complex " [0:v][1:v]  -loop 1
>  overlay=0:0:enable='between(t,5,10)',fade=t=in:st=5:d=1,
>  fade=t=out:st=10:d=1  '" -c:v libx264 -crf 23 output.mp4

Did you read my whole email? You didn't even adapt the filter. Your
filter won't work, as I wrote, you're fading away the combined video!

I literally wrote:
> adding "-loop 1" before the overlay image
and
> -filter_complex "[1:v]fade=t=in:st=5:d=1,fade=t=out:st=10:d=1[over];[0:v][over]overlay=0:0"

which adds up to:

  -i input.mp4 -loop 1 -i 34232944.png -filter_complex "[1:v]fade=t=in:st=5:d=1,fade=t=out:st=10:d=1[over];[0:v][over]overlay=0:0" -c:v libx264 -crf 23 output.mp4

Moritz
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user
Reply | Threaded
Open this post in threaded view
|

Re: FFMPEG Image overlay Fade in and out on Video not working properly, ,

ankur456799
hi thanks for reply but its not working FFMPEG get stuck and continue running in the loop

my request:- -i input.mp4  -loop 1 -i 57982344.png -filter_complex "[1:v]fade=t=in:st=5:d=1,fade=t=out:st=10:d=1[over];[0:v][over]overlay=0:0 " -c:v libx264 -crf 23 output.mp4
Reply | Threaded
Open this post in threaded view
|

Re: FFMPEG Image overlay Fade in and out on Video not working properly, ,

Moritz Barsnick
On Mon, Aug 24, 2015 at 06:05:06 -0700, ankur456799 wrote:
> hi thanks for reply but its not working FFMPEG get stuck and continue running
> in the loop

Ah, you're right. Please add "-shortest" _after_ the input files (i.e.
as an output option).

Moritz
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user
Reply | Threaded
Open this post in threaded view
|

Re: FFMPEG Image overlay Fade in and out on Video not working properly, ,

ankur456799
Thanks man  for yours continue reply ...
like this :-
-i input.mp4 -shortest -loop 1 -i 57982344.png -filter_complex "[1:v]fade=t=in:st=5:d=1,fade=t=out:st=10:d=1[over];[0:v][over]overlay=0:0 " -c:v libx264 -crf 23 output.mp4
Reply | Threaded
Open this post in threaded view
|

Re: FFMPEG Image overlay Fade in and out on Video not working properly, ,

Moritz Barsnick
On Mon, Aug 24, 2015 at 06:17:52 -0700, ankur456799 wrote:
> Thanks man  for yours continue reply ...
> like this :-
> -i input.mp4 -shortest -loop 1 -i 57982344.png -filter_complex
> "[1:v]fade=t=in:st=5:d=1,fade=t=out:st=10:d=1[over];[0:v][over]overlay=0:0 "
> -c:v libx264 -crf 23 output.mp4

As an output option (please do read up on ffmpeg's command line
handling, it's important), i.e. _after all_ the input files.

> -i input.mp4 -loop 1 -i 57982344.png -shortest -filter_complex
> "[1:v]fade=t=in:st=5:d=1,fade=t=out:st=10:d=1[over];[0:v][over]overlay=0:0 "
> -c:v libx264 -crf 23 output.mp4

(CRF 23 is default, no particular need to put it here, BTW.)

Moritz
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user
Reply | Threaded
Open this post in threaded view
|

Re: FFMPEG Image overlay Fade in and out on Video not working properly, ,

ankur456799
hi after added shortest again its not working  FFMPEG get stuck and continue running

-i input.mp4  -loop 1 -i 57982344.png -shortest -filter_complex "[1:v]fade=t=in:st=5:d=1,fade=t=out:st=10:d=1[over];[0:v][over]overlay=0:0 " -c:v libx264 -crf 23 output.mp4
Reply | Threaded
Open this post in threaded view
|

Re: FFMPEG Image overlay Fade in and out on Video not working properly, ,

Moritz Barsnick
On Mon, Aug 24, 2015 at 06:32:10 -0700, ankur456799 wrote:
> hi after added shortest again its not working  FFMPEG get stuck and continue
> running

Sorry, stupid of me for not trying before recommending.

I did give you the correct command line, I believe. But we're
triggering this bug, which I can reproduce:
https://trac.ffmpeg.org/ticket/3789

Please just interrupt ffmpeg by pressing 'q', or give an output option
"-t" stating the number of seconds to convert (length of the input
video).

Sorry, nothing I can do about this bug, and I don't know any
proper workaround.

Moritz
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user