Yamahabest
Yamahabest

Reputation: 21

FFmpeg continues to process after time specified at "-to"

I have a video, where I want to cut a part from the beginning, and from the end. And I want to apply some fade ins/fade outs, and add some text.

So, I came up with the following syntax:

-ss 10 -to 40 
-i "D:\DATA\Software\VideoProcessor_Files\20171015 Zelhem Tandem Frans met Mirthe.MP4" 
-loop 1 -i "Input_Files\logo maurik large.png" 
-loop 1 -i "Input_Files\logo maurik small.png" 
-filter_complex "
    [email protected]:1920x1080[grey_for_fade_out];
    [grey_for_fade_out]fade=t=out:st=12:d=2:alpha=1[grey_fade_out];
    [0:v][grey_fade_out]overlay[video_grey_fade_out];
    [email protected]:1920x1080[grey_for_fade_in];
    [grey_for_fade_in]fade=t=in:st=37:d=2:alpha=1[grey_fade_in];
    [video_grey_fade_out][grey_fade_in]overlay[video_grey_fade_out_in];
    [1:v]fade=t=out:st=13:d=2:alpha=1[over];
    [over]scale=iw/1.5:-1[scaled];
    [video_grey_fade_out_in][scaled]overlay=(main_w-overlay_w)/2:(main_h-overlay_h)/10[video_grey_fade_out_in_logo];
    [1:v]fade=t=in:st=36:d=2:alpha=1[over2];
    [over2]scale=iw/1.5:-1[scaled2];
    [video_grey_fade_out_in_logo][scaled2]overlay=(main_w-overlay_w)/2:(main_h-overlay_h)/2[video_grey_fade_out_in_logo2];
    [2:v]colorchannelmixer=aa=0.5,fade=t=in:st=14:d=2:alpha=1,fade=t=out:st=35:d=2:alpha=1[over3];
    [over3]scale=iw/10:-1[scaled3];
    [video_grey_fade_out_in_logo2][scaled3]overlay=10:10[video_complete];
    [video_complete]drawtext=fontfile=Input_Files/Sansation-Bold.ttf:text='Tandemvlucht met Mirthe':fontsize=96:fontcolor=white:alpha='if(lt(t,11),1,(2-(t-11))/2)':x=(w-text_w)/2:y=((h-text_h)/2)+125,drawtext=fontfile=Input_Files/Sansation-Bold.ttf:text='Zeddam':fontsize=96:fontcolor=white:alpha='if(lt(t,11),1,(2-(t-11))/2)':x=(w-text_w)/2:y=((h-text_h)/2)+250,drawtext=fontfile=Input_Files/Sansation-Bold.ttf:text='4 augustus 2020':fontsize=96:fontcolor=white:alpha='if(lt(t,11),1,(2-(t-11))/2)':x=(w-text_w)/2:y=((h-text_h)/2)+375,drawtext=fontfile=Input_Files/Sansation-Bold.ttf:text='Ook een keer meevliegen?':fontsize=96:fontcolor=white:alpha='if(lt(t,37),0,(t-37)/2)':x=(w-text_w)/2:y=((h-text_h)/6),drawtext=fontfile=Input_Files/Sansation-Bold.ttf:text='Of bel 085 - 049 55 69':fontsize=96:fontcolor=white:alpha='if(lt(t,37),0,(t-37)/2)':x=(w-text_w)/2:y=((h-text_h)/2)+350"
-preset medium 
-crf 18 
-c:a copy 
-y ".\Output_Files\Video\Zeddam\2020-08-04\Mirthe\27ed390a-8497-4550-b93f-4f87d9f2c9f0\MP_Tandemvlucht met_Mirthe_Zeddam_2020-08-04.mp4"

I am quite sure this has worked in the past, but now FFmpeg just keeps on processing endlessly. If I then stop the FFmpeg process, and look at the resulting file, I see that the last frame (of the end of the specified period) just keeps on duplicating.

The drop counter in the console output of FFmpeg also starts increasing at the end of the specified period:

frame=  987 fps= 15 q=-1.0 Lsize=   31357kB time=00:00:41.04 bitrate=6259.0kbits/s dup=0 drop=10 speed=0.644x

I am kind of lost on why this doesn't work anymore. I might have upgraded the FFmpeg executable in the mean time. Maybe my syntax was/is not correct, but I believe it just worked.

It has to be in the complex filter, because when I remove that, it works alright. It is not in the drawtext part of the complex filter, because it still occurs when I remove that. And when I only do the drawtext, FFmpeg stops correctly at the specified time.

I have tried this, but then it still occurs:

-filter_complex "
    [email protected]:1920x1080[grey_for_fade_out];
    [grey_for_fade_out]fade=t=out:st=12:d=2:alpha=1[grey_fade_out];
    [0:v][grey_fade_out]overlay[video_grey_fade_out];
    [email protected]:1920x1080[grey_for_fade_in];
    [grey_for_fade_in]fade=t=in:st=37:d=2:alpha=1[grey_fade_in];
    [video_grey_fade_out][grey_fade_in]overlay"

Also with this, it still occurs:

-filter_complex "
    [1:v]fade=t=out:st=13:d=2:alpha=1[over];
    [over]scale=iw/1.5:-1[scaled];
    [0:v][scaled]overlay=(main_w-overlay_w)/2:(main_h-overlay_h)/10[video_grey_fade_out_in_logo];
    [1:v]fade=t=in:st=36:d=2:alpha=1[over2];
    [over2]scale=iw/1.5:-1[scaled2];
    [video_grey_fade_out_in_logo][scaled2]overlay=(main_w-overlay_w)/2:(main_h-overlay_h)/2[video_grey_fade_out_in_logo2];
    [2:v]colorchannelmixer=aa=0.5,fade=t=in:st=14:d=2:alpha=1,fade=t=out:st=35:d=2:alpha=1[over3];
    [over3]scale=iw/10:-1[scaled3];
    [video_grey_fade_out_in_logo2][scaled3]overlay=10:10"

I just don't understand. All my fade-ins/-outs seem to be within the specified range:

It is just like some sequence is not ended properly, which is causing FFmpeg to just continue.

Upvotes: 1

Views: 241

Answers (1)

Yamahabest
Yamahabest

Reputation: 21

Solved by moving "-ss 10 -to 40" after the input parameters, just before the filter_complex.

However, it now does take quite a while longer before it actually starts processing.

frame=    0 fps=0.0 q=0.0 size=       0kB time=00:00:00.00 bitrate=N/A speed=   0x    

The above statement gets logged like 200 times before it starts:

frame=    0 fps=0.0 q=0.0 size=       0kB time=00:00:00.02 bitrate=  16.0kbits/s speed=0.00021x    
frame=    0 fps=0.0 q=0.0 size=       0kB time=00:00:00.45 bitrate=   0.9kbits/s speed=0.00392x    
frame=    8 fps=0.1 q=0.0 size=       0kB time=00:00:00.81 bitrate=   0.5kbits/s dup=1 drop=0 speed=0.00704x    
frame=   16 fps=0.1 q=0.0 size=       0kB time=00:00:01.17 bitrate=   0.3kbits/s dup=1 drop=0 speed=0.0101x    
frame=   23 fps=0.2 q=0.0 size=       0kB time=00:00:01.45 bitrate=   0.3kbits/s dup=1 drop=0 speed=0.0125x    
frame=   30 fps=0.3 q=0.0 size=       0kB time=00:00:01.77 bitrate=   0.2kbits/s dup=1 drop=0 speed=0.0152x    
frame=   38 fps=0.3 q=0.0 size=       0kB time=00:00:02.09 bitrate=   0.2kbits/s dup=1 drop=0 speed=0.0178x    
frame=   45 fps=0.4 q=0.0 size=       0kB time=00:00:02.37 bitrate=   0.2kbits/s dup=1 drop=0 speed=0.0201x    
frame=   49 fps=0.4 q=0.0 size=       0kB time=00:00:02.56 bitrate=   0.1kbits/s dup=1 drop=0 speed=0.0216x    
frame=   54 fps=0.5 q=0.0 size=       0kB time=00:00:02.73 bitrate=   0.1kbits/s dup=1 drop=0 speed=0.023x    
frame=   59 fps=0.5 q=0.0 size=       0kB time=00:00:02.96 bitrate=   0.1kbits/s dup=1 drop=0 speed=0.0248x    
frame=   64 fps=0.5 q=23.0 size=       0kB time=00:00:03.16 bitrate=   0.1kbits/s dup=1 drop=0 speed=0.0263x    
frame=   70 fps=0.6 q=23.0 size=       0kB time=00:00:03.41 bitrate=   0.1kbits/s dup=1 drop=0 speed=0.0283x    
frame=   74 fps=0.6 q=23.0 size=     256kB time=00:00:03.58 bitrate= 584.8kbits/s dup=1 drop=0 speed=0.0296x    
frame=   79 fps=0.6 q=23.0 size=     256kB time=00:00:03.80 bitrate= 552.0kbits/s dup=1 drop=0 speed=0.0313x    

Upvotes: 1

Related Questions