ffmpeg drawtext timecode source framerate I'm trying to burn timecode onto a video file with ffmpeg. Documentation notes that frame rate is a required parameter. It confuses me that I need to specify it manually when the information is available for the source file. This confusion suggests I'm missing an important assumption.

I'm batch-processing source files with different frame rates depending on their source (24, 29.97, 30). How can I set the frame rate automatically?
FFmpeg has a modular design. The module which unpacks a stream from a file and discovers/sets its properties, including framerate, is ffmpeg base code. drawtext is a filter module that operates upon decoded frames. It has no concept of a framerate because it receives a sequence of individual frames in series, and only gets to see the metadata pertaining to that frame.

Usual M.O. when performing such operations is to get the framerate information by running ffprobe beforehand and saving it to a variable, referencing that variable in the drawtext options so that the shell can substitute the value.

That ffprobe command is

FPS=$(ffprobe -v 0 -show_entries stream=r_frame_rate -select_streams v:0 -of compact=p=0:nk=1 "$file")