Opened 6 weeks ago

Last modified 5 weeks ago

#11149 reopened defect

"drawtext" filter produces trembling text?

Reported by: idest Owned by:
Priority: normal Component: avfilter
Version: git-master Keywords: drawtext
Cc: MasterQuestionable Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

  1. Put this text into a file "filter.txt":
drawtext=text='%{pts\:hms}':fontsize=128:fontcolor=white
  1. Execute
ffmpeg.exe -i trembling_text_input.mp4 -/filter:v filter.txt trembling_text_output.mp4"
  1. Open the newly created file, "trembling_text_output.mp4", in a video player. Notice that the timestamp text is trembling.

OS: Windows 10 Home
ffmpeg: N-116617-g9e3b5b8a26-20240813.

Attachments (1)

trembling_text_input.mp4 (525.5 KB ) - added by idest 6 weeks ago.

Download all attachments as: .zip

Change History (9)

by idest, 6 weeks ago

Attachment: trembling_text_input.mp4 added

comment:1 by MasterQuestionable, 5 weeks ago

Cc: MasterQuestionable added
Resolution: invalid
Status: newclosed
Summary: "drawtext" filter produces trembling text"drawtext" filter produces trembling text?

͏    Try using a lossless codec?
͏    I guess there's no real issue in the filter:
͏    Merely the artifact of lossy codecs...

comment:2 by idest, 5 weeks ago

Try using a lossless codec?

I tried

ffmpeg.exe -i trembling_text_input.mp4 -/filter:v filter.txt -c:v huffyuv trembling_text_output.avi

, the result is the same -- the text is trembling...

comment:3 by MasterQuestionable, 5 weeks ago

Version: unspecifiedgit-master

͏    ffmpeg -h encoder=huffyuv
͏    ; indicated "yuv422p" preference..?
͏    Try non-subsampled format, e.g. "rgb24"?

comment:4 by idest, 5 weeks ago

indicated "yuv422p" preference..?

I think it does, the output of "ffmpeg -h encoder=huffyuv" includes this line:

Supported pixel formats: yuv422p rgb24 bgra

Try non-subsampled format, e.g. "rgb24"?

I tried these two commands:

ffmpeg.exe -i trembling_text_input.mp4 -/filter:v filter.txt -pix_fmt rgb24 trembling_text_output.mp4"
ffmpeg.exe -i trembling_text_input.mp4 -/filter:v filter.txt -c:v huffyuv -pix_fmt rgb24 trembling_text_output.avi

, and both of them produce trembling text.

comment:5 by MasterQuestionable, 5 weeks ago

Component: undeterminedavfilter
Keywords: drawtext added
Resolution: invalid
Status: closedreopened

͏    Last to confirm, try this:
͏    ffmpeg -y -v trace -hide_banner -nostdin -nostats -i "${In}" -pix_fmt yuv444p -sws_flags spline+accurate_rnd+full_chroma_int -c:v libx264 -preset placebo -qp 0 -x264-params "keyint=15:no-deblock=1" "yuv444p.avi"

͏    See also: https://trac.ffmpeg.org/wiki/colorspace#yuv444p

comment:6 by idest, 5 weeks ago

Just tried it (replacing "${In}" with "trembling_text_input.mp4" and adding the "-/filter:v filter.txt" option), the result is the same.

Last edited 5 weeks ago by idest (previous) (diff)

comment:7 by MasterQuestionable, 5 weeks ago

͏    Probably similar bizarrerie?
͏    https://trac.ffmpeg.org/ticket/10989

comment:8 by idest, 5 weeks ago

Turns out what font is used matters, for example, if I add "font=tahoma" to the filter value, making it

drawtext=text='%{pts\:hms}':font=tahoma:fontsize=124:fontcolor=white

, there's no trembling in the output video.

Note: See TracTickets for help on using tickets.