Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • F ffmpeg-python
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 402
    • Issues 402
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 34
    • Merge requests 34
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Karl Kroening
  • ffmpeg-python
  • Issues
  • #753
Closed
Open
Issue created Mar 12, 2023 by AzazelHD@AzazelHD

Drawtext given problems under .filter method

Okey so, i am doing this:

text = "Hello world"
color = "white"
fontsize = 50
x = 10
y = 50

filter = f"drawtext=fontfile='c\:/Windows/Fonts/{font}.ttf':text='{text}':fontcolor={color}:fontsize={fontsize}:x={x}:y={y}"

(
    ffmpeg
        .input("test.avi")
        .filter('vf', filter)
        .output(f'output_video.mp4', vcodec='copy', acodec='copy')
        .overwrite_output()
        .run()
)

And ffmpeg keeps throwing same error:

No option name near 'drawtext\\\=fontfile\\\=\\\'c\\\\\\\:/Windows/Fonts/Arial.ttf\\\'\\\:text\\\=\\\'Hello world\\\'\\\:fontcolor\\\=white\\\:fontsize\\\=50\\\:x\\\=10\\\:y\\\=50'
Error parsing a filter description around: [s0]
Error parsing filterchain '[0]vf=drawtext\\\\\\=fontfile\\\\\\=\\\\\\\'c\\\\\\\\\\\\\\:/Windows/Fonts/Arial.ttf\\\\\\\'\\\\\\:text\\\\\\=\\\\\\\'Hello world\\\\\\\'\\\\\\:fontcolor\\\\\\=white\\\\\\:fontsize\\\\\\=50\\\\\\:x\\\\\\=10\\\\\\:y\\\\\\=50[s0]' around: [s0]
Error initializing complex filters.
Invalid argument

Seems it is something parsing the filter string.

However, if i wanna call this command as pure ffmpeg, i would do this:

# ffmpeg -i test.avi -vf "drawtext=fontfile='c\:/Windows/Fonts/Arial.ttf':text='Hello':fontcolor=0xff0000:fontsize=100:x=10:y=10" output_video.mp4

Which runs successfully.

Can someone explain me what am i writting wrongly?

Assignee
Assign to
Time tracking