Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fonts render 'fuzzily' running on Ubuntu #26

Open
cramshaw opened this issue Jun 9, 2016 · 2 comments
Open

Fonts render 'fuzzily' running on Ubuntu #26

cramshaw opened this issue Jun 9, 2016 · 2 comments

Comments

@cramshaw
Copy link

cramshaw commented Jun 9, 2016

Hi!

This kind of relates to MoviePy as well, but I'm pretty sure the issue lies with Gizeh somehow. After spending a lot of time trying things out I've resorted to this.

I've got a MoviePy script which superimposes text on a pre existing video clip whilst animating the text to increase in size. I think I've posted all the relevant code, but let me know if anything else would help.

text_mask = mpy.VideoClip(make_frame=self.make_frame_text, duration=duration).to_mask()
text_mask.write_videofile(maskfilename, fps=25)
def make_frame_text(self, t):
e = self.current_element
if e.x == "center":
e.x = self.w/2
e.y = self.h/2
duration = e.end - e.start
sizeGrow = e.fontSize*0.2
sizeStart = e.fontSize-sizeGrow
currFrame = (t*100)/4
frameGrow = sizeGrow/(duration*25)
fsize = sizeStart + (currFrame * frameGrow)
bom = gizeh.text(e.text, fontfamily=e.font, fontsize=fsize,fill=(255,255,255), xy=(e.x,e.y))
surface = gizeh.Surface(self.w,self.h) # width, height
bom.draw(surface)
return surface.get_npimage() # returns a 8-bit RGB array

And e is an object like:
{ "text": "Hello", "font": "Courier", "fontSize": 100, "fontColor": "white", "start": 0.01, "end": 1.3, "x": 960, "y": 540, }

This all works very smoothly locally, however when I deploy (to Ubuntu 14.04 on AWS), the final product is jumpy, the text isn't as crisp and the animation isn't very smooth. Have you got any suggestions as to why that would be the case? I have checked everything I can think of, and the size and time variables are exactly the same for both versions for each frame, so essentially exactly the same thing is happening, just for some reason the local one produces a far smooth animation.

To my eye it appears that in some frames the text grows more than in others, however when I increased the sizeGrow it became clear the font size was increasing in every frame.

Any help would be really appreciated, it's driving me crazy!

Thanks!

@zamirkhan
Copy link

I know it's been a long time, but did you ever find a solution for crisp (non-blurry) text in moviepy @cramshaw ?

@cramshaw
Copy link
Author

@zamirkhan Hey!
The short answer is no, I never managed to get it to work perfectly smoothly. I tried a whole range of ways of calculating the size of text for each frame, but it was never possible to recreate the local performance.

I haven't played with it for a couple of years, but I wonder if a docker container might offer a solution to this now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants