0

I managed to create a video from set of non-sequential images and attached an audio to it. Also I added a "Copyright" text on top right hand corner so that the text appears throughout the video. However, I would like that text to appear only on the last image. How should I change my code below to address this?

ffmpeg \
-thread_queue_size 512 -f image2 -pattern_type glob -framerate 1/3 \
-i '*.jpg' \
-i 'audio.mp3' \
-c:a aac -c:v libx264 \
-vf scale=640:480, format=yuv420p, drawtext="text='Copyright':fontcolor=white:box=1:[email protected]:boxborderw=5:x=w-tw-5:y=5" \
-preset medium \
video.mp4

1 Answer 1

2

Isolate the last image from the glob and then concat it:

ffmpeg \
  -pattern_type glob -framerate 1/3 -i '*.jpg' -framerate 1/3 -loop 1 -t 5 -i last/img.jpg -i audio.mp3 \
  -filter_complex \
    "[0:v]scale=640:480,setsar=1[v0]; \
     [1:v]scale=640:480,setsar=1,drawtext=text='Copyright':fontcolor=white:box=1:[email protected]:boxborderw=5:x=w-tw-5:y=5[v1]; \
     [v0][v1]concat=n=2:v=1:a=0,fps=25,format=yuv420p[v]" \
  -map "[v]" -map 2:a -c:v libx264 -c:a aac -shortest -movflags +faststart video.mp4
7
  • 1
    Thanks for the response. I'll test it on Tuesday and get back to you.
    – BentCoder
    Commented May 25, 2018 at 19:42
  • All the images I have are in different size so getting error [Parsed_concat_3 @ 0x55aab62e47a0] Input link in1:v0 parameters (size 640x480, SAR 0:1) do not match the corresponding output link in0:v0 parameters (640x480, SAR 441:440) [Parsed_concat_3 @ 0x55aab62e47a0] Failed to configure output pad on Parsed_concat_3
    – BentCoder
    Commented May 29, 2018 at 8:13
  • OK. I got rid of the error by using setdar=4:3. However, setting -framerate 1/5 -i last/img.jpg doesn't let last image stay visible for 5 seconds. It still stays as 3 seconds. Any reason why?
    – BentCoder
    Commented May 29, 2018 at 11:03
  • So all the images should appear for 3 seconds each but the last one should appear for 5 seconds.
    – BentCoder
    Commented May 29, 2018 at 11:16
  • @BentCoder See updated answer to address all of these issues.
    – llogan
    Commented May 29, 2018 at 17:34

Not the answer you're looking for? Browse other questions tagged or ask your own question.