[FFmpeg-user] Recorded Frame Timestamps are Inconsistent! How to Fix it?

Carl Zwanzig cpz at tuunq.com
Sun Mar 21 20:03:35 EET 2021


Please do not top-post on this list.

On 3/21/2021 10:31 AM, Hassan wrote:
> ... Following is the command.
> 
> ffmpeg -f gdigrab -framerate 60 -offset_x 550 -offset_y 350 -video_size
> 640x480 -thread_queue_size 1024 -i desktop  -vf "settb=AVTB,
> setpts='trunc(PTS/1K)*1K+st(1,trunc(RTCTIME/1K))-1K*trunc(ld(1)/1K)',
> drawtext=fontfile=ArialBold.ttf:fontsize=30:fontcolor=white:text='%{localtime}.%{eif\:1M*t-1K*trunc(t*1K)\:d\:3}.%{n}:fontsize=30:r=60:x=(w-tw)/2:
> y=h-(2*lh):box=1:boxborderw=20:boxcolor=black at 1.0:x=10:y=10'" -c:v
> libx264rgb -crf 0 -preset ultrafast ./test_SD_1.mkv

You always need to show the output of the command.....

>  it gives an error of Unterminated %{} near '{pts'. Can
> you please help fix the above command?

But it looks like there's a quote nesting error in the drawtext, there's a 
end " but not a start.



> I have another challenge. I want to record at FPs higher than 60 FPS, i.e.,
> 120 FPS. For that, i set -framerate 120 and in -vf, I set r=120. However,
> the recording that I get is just 60 FPS. Is it because my LCD has a refresh
> rate of 60hz? Or FFmpeg is not concerned about LCD hardware? How can I
> record at 120 FPS?

Please don't add new questions to a topic, it's better to start a new one. 
However, ffmpeg doesn't know about the display hardware, and certainly not 
when you're using gdi, but yes, if the HW is a 60fps rate, the display 
driver isn't going to render more often since it doesn't need to.

If you _really_ want to capture with accurate timing and at faster than 
60fps, use a hardware device like a Blackmagic Decklink or Intensity card 
and get the actual output of the graphics card. You will need a second 
system to hold the card.

z!


More information about the ffmpeg-user mailing list