# cv::VideoWriter.write() - timestamp of written frame

**URL:** <https://forum.opencv.org/t/cv-videowriter-write-timestamp-of-written-frame/19188>\
**Category:** C++\
**Created:** [November 5, 2024, 3:47pm UTC](https://forum.opencv.org/t/cv-videowriter-write-timestamp-of-written-frame/19188 "2024-11-05T15:47:39Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![ck28](https://avatars.discourse-cdn.com/v4/letter/c/ecccb3/32.png) [@ck28](https://forum.opencv.org/u/ck28)\
**Post date:** [November 5, 2024, 3:47pm UTC](https://forum.opencv.org/t/cv-videowriter-write-timestamp-of-written-frame/19188/1 "2024-11-05T15:47:39Z")

</div>

Hello everyone,

I am currently working on capturing frames from a camera and writing them to a video file. I am wondering if there is a way to obtain the timestamp of the just-written frame. It seems that the write function returns void, so I’m unsure how to retrieve the timestamp. Any suggestions or hints would be greatly appreciated.

Thank you in advance for your help.

Best regards  
Christa

---

<div class="post-metadata">

**Author:** ![Cary\_Hutchinson](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opencv.org/cary_hutchinson/32/8881_2.png) [@Cary\_Hutchinson](https://forum.opencv.org/u/Cary_Hutchinson)\
**Post date:** [November 5, 2024, 6:25pm UTC](https://forum.opencv.org/t/cv-videowriter-write-timestamp-of-written-frame/19188/2 "2024-11-05T18:25:20Z")

</div>

What camera are you using?

---

<div class="post-metadata">

**Author:** ![crackwitz](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opencv.org/crackwitz/32/14_2.png) [@crackwitz](https://forum.opencv.org/u/crackwitz)\
**Post date:** [November 5, 2024, 7:13pm UTC](https://forum.opencv.org/t/cv-videowriter-write-timestamp-of-written-frame/19188/3 "2024-11-05T19:13:44Z")

</div>

no you can’t obtain the timestamp of a frame you just _wrote to a file_. that’s a meaningless value for this operation.

---

<div class="post-metadata">

**Author:** ![ck28](https://avatars.discourse-cdn.com/v4/letter/c/ecccb3/32.png) [@ck28](https://forum.opencv.org/u/ck28)\
**Post date:** [November 6, 2024, 8:00am UTC](https://forum.opencv.org/t/cv-videowriter-write-timestamp-of-written-frame/19188/4 "2024-11-06T08:00:56Z")

</div>

I’ve tested it with the built-in USB camera on my laptop.

---

<div class="post-metadata">

**Author:** ![ck28](https://avatars.discourse-cdn.com/v4/letter/c/ecccb3/32.png) [@ck28](https://forum.opencv.org/u/ck28)\
**Post date:** [November 6, 2024, 8:35am UTC](https://forum.opencv.org/t/cv-videowriter-write-timestamp-of-written-frame/19188/5 "2024-11-06T08:35:16Z")

</div>

In my scenario, this value is essential for subsequent processing. It needs to be transferred to another process immediately after writing the frame into the file.

---

<div class="post-metadata">

**Author:** ![crackwitz](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opencv.org/crackwitz/32/14_2.png) [@crackwitz](https://forum.opencv.org/u/crackwitz)\
**Post date:** [November 6, 2024, 9:01am UTC](https://forum.opencv.org/t/cv-videowriter-write-timestamp-of-written-frame/19188/6 "2024-11-06T09:01:24Z")

</div>

do you not want the time the picture was taken, instead of when it was written?

OpenCV is the wrong library for you. you need to use ffmpeg’s libraries, or something similar.
