FFMPEG image overlaying video: hangs

Following up on this question: I have a relatively complex script that takes a video (mid.mov), overlays a set of images on top of it, and crossfades an intro (intro.mov) and outro (outro.mov) video to its endpoints:

introDuration=5.63
outroDuration=7.08    
crossfadeDuration=1.0
introStartFade=4.63
midDuration=57.04
midStartFade=56.04

ffmpeg -i "intro.mov" -i "mid.mov" -i "outro.mov" -loop 1 -i "animation/middle_%2d.png" -filter_complex \
"[0:v]trim=0:$introStartFade,setpts=PTS-STARTPTS[introvideo1]; \
[0:v]trim=$introStartFade,setpts=PTS-STARTPTS[introvideo2]; \
[1:v]trim=0:$crossfadeDuration,setpts=PTS-STARTPTS[midvideo1]; \
[1:v]trim=$crossfadeDuration:$midStartFade,setpts=PTS-STARTPTS[midvideo2]; \
[1:v]trim=$midStartFade:,setpts=PTS-STARTPTS[midvideo3]; \
[2:v]trim=0:$crossfadeDuration,setpts=PTS-STARTPTS[outrovideo1]; \
[2:v]trim=$crossfadeDuration:,setpts=PTS-STARTPTS[outrovideo2]; \
[3:v]setpts=1.0*PTS[midAnimation]; \

[introvideo2]format=pix_fmts=yuva420p,fade=t=out:st=0:d=$crossfadeDuration:alpha=1[fadeoutintrovideo]; \
[midvideo1]format=pix_fmts=yuva420p,fade=t=in:st=0:d=$crossfadeDuration:alpha=1[fadeinmidvideo]; \
[midvideo3]format=pix_fmts=yuva420p,fade=t=out:st=0:d=$crossfadeDuration:alpha=1[fadeoutmidvideo]; \
[outrovideo1]format=pix_fmts=yuva420p,fade=t=in:st=0:d=$crossfadeDuration:alpha=1[fadeinextrovideo]; \

[midvideo2][midAnimation]overlay=shortest=1[midvideo]; \

[fadeoutintrovideo][fadeinmidvideo]overlay[crossfadeintrovideo]; \
[fadeoutmidvideo][fadeinextrovideo]overlay[crossfadeoutrovideo]; \
[introvideo1][crossfadeintrovideo][midvideo][crossfadeoutrovideo][outrovideo2]concat=n=5[outputvideo]; \

[0:a][1:a] acrossfade=d=$crossfadeDuration:c1=ipar:c2=ipar [audiotemp]; \
[audiotemp][2:a] acrossfade=d=$crossfadeDuration:c1=ipar:c2=ipar [outputaudio]" \
-map [outputvideo] -map [outputaudio] "out.mov"

Using the latest build (FFmpeg 3.3.3 "Hilbert"), the script gets to a certain point, I get an "Error while filtering" message (in bright red), and then it hangs on the last frame (I need to "ctrl-c" a few times to exit).

If I remove this line it works fine:

[midvideo2][midAnimation]overlay=shortest=1[midvideo];

I've tried a more recent build (ffmpeg-86877-g8e275a7), but it still hangs at the same point.

If I go back to earlier versions (I've tried up to FFmpeg 3.2.7 "Hypatia"), it works fine. Is there a script problem, or is it a bug introduced into FFmpeg?


Solution 1:

It's not a script problem. There was a commit added in Dec 2016 that broke the operation of shortest=1 in some filters. That commit was reverted in June but that introduced side-effects, so the revert commit was reverted in July.

If you need shortest, then you'll need to use the old version for now. There is a fix in queue but no ETA on its application.