question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Hey guys,

I’m trying to evaluate expression like this: stream.drawtext(text=r"%%{eif\\:n+%s\\:d\\:4}" % start_frame_number, ...) but I always get eif related errors. Something funky is going on with escaping characters in this case.

Anyone else hit that? How should I format the expression for it to work?

Thanks, kk

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
kkroeningcommented, Jan 7, 2018

It works fine if you don’t put those extra \ chars in it yourself, don’t prefix it with -r, and do use escape_text=False:

import ffmpeg

text = '%%{eif:n+%s:d:4}' % start_frame_number
fontfile = '/Library/Fonts/Arial.ttf'

(ffmpeg
    .input('in.mp4')
    .drawtext(text, x=0, y=0, fontfile=fontfile, escape_text=False)
    .output('out.mp4')
    .run()
)
0reactions
krzyklicommented, Nov 3, 2017

Thanks @kkroening, in this particular case, whether you’re using raw strings or not doesn’t make much difference, the result is the same.

To “fix” this quickly on my side I’ve skipped escaping characters if there’s ‘eif’ present in ‘text’ parameter value and it works perfectly with a simple "%%{eif\:n+%s\:d\:4}" % i expression.

Would be great to find a proper fix for text expansions and add them to the test suite 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

What is Text Expansion? - TextExpander
Text expansion allows a user to shave off time when creating written communication. It's an upgrade on what you are used to with...
Read more >
Creating Text Expansions - Granicus Support
Text Expansions are abbreviations you can use when taking notes. When typing in a note field, you enter the abbreviation and Ctrl+Spacebar to...
Read more >
How Text Expansion Apps Help You Write Long Phrases With ...
There's a wide variety of text expansion apps: aText, TextExpander, TypeIt4Me, PhraseExpress, PhraseExpander, Breevy, and even the text ...
Read more >
How to type faster on Macs with built-in text expansion
Just as with the iPhone and iPad, macOS Big Sur includes a built-in way for you to avoid repetitive typing — and repetitive...
Read more >
15 of Our Favorite Text Expansion Hacks for Speed Typing
Text Expansion is a built-in feature for OSX, iOS and various Apple products, but it's also available in a number of stand-alone apps...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found