Skip to content

Commit 074f542

Browse files
committed
move timestamp to bottom
1 parent 9b9a9cf commit 074f542

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

examples/local_video/publisher.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,10 +276,16 @@ async def publish_track_with_fallback(
276276
def burn_timestamp(frame_bgr, timestamp_us: int) -> None:
277277
text = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(timestamp_us / 1_000_000))
278278
text = f"{text}.{(timestamp_us // 1_000) % 1000:03d}"
279+
(_, text_height), baseline = cv2.getTextSize(
280+
text,
281+
cv2.FONT_HERSHEY_SIMPLEX,
282+
0.9,
283+
2,
284+
)
279285
cv2.putText(
280286
frame_bgr,
281287
text,
282-
(20, 40),
288+
(20, frame_bgr.shape[0] - baseline - 20),
283289
cv2.FONT_HERSHEY_SIMPLEX,
284290
0.9,
285291
(255, 255, 255),

0 commit comments

Comments
 (0)