I am trying to adjust the frame rate -r fps
of a video, and draw text which includes the new frame number -vf drawtext=text='frame %{frame_num} %{pts}'
. Is this possible with a single invocation of ffmpeg
?
例如,如果我尝试使用-
ffmpeg -i original.mp4 -r 25 -vf "drawtext=text='frame %{frame_num} %{pts}':x=10:y=10" output.mp4
when I play output.mp4
, I see the frame rate indicted Input #0 25 fps
is correct but the text frame 3000
is drawn at the 100s point which suggests 30 fps.
Can I modify the above single call to ffmpeg
to correct the result or do I have to split the task in to two separate invocations of ffmpeg
such as -
ffmpeg -i original.mp4 -r 25 temp.mp4
其次是
ffmpeg -i temp.mp4 -vf "drawtext=text='frame %{frame_num} %{pts}':x=10:y=10" output.mp4