'Moviepy - Place textclips at relative position

How do I place a textclip, right below the other? I require to place an image at the left of the video and two lines of text to the right of image, that are placed one below the other.

Something like this: Desired frame

I tried to use set_position, but doesn't scale well for different videos (of different resolutions). By adjusting the arguments of set_position, I am able to place the textclips one below the other without gap in one resolution, but when I go to a higher resolution video, it shows a gap (I understand why the gap comes, but not sure how to prevent it)

txt_clip1 = TextClip("This is line 1 of text", fontsize = 12, color = 'white', bg_color='black') txt_clip1 = txt_clip1.set_duration(7).set_start(0).set_end(7) txt_clip1 = txt_clip1.set_position((0.1,0.90), relative=True).set_opacity(0.6)

txt_clip2 = TextClip("This is line 2 of the text, smaller font", fontsize = 8, color = 'white', bg_color='black') txt_clip2 = txt_clip2.set_duration(7).set_start(0).set_end(7) txt_clip2 = txt_clip2.set_position((0.1,0.93), relative=True).set_opacity(0.6)

I tried to insert a new line character in the text, but that doesn't suit me because the second line of text has different font properties.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source