About timestamp when recording video using Gstreamer

Hi,

I am new with TX2 and Gstreamer. I am using this kind of Gstreamer command to record raw video data from my own CSI camera.

gst-launch-1.0 -e v4l2src device=/dev/video1 num-buffers=450 ! 'video/x-raw, format=UYVY, width=2304, height=1296, framerate=45/1' ! filesink location=/media/nvidia/Transcend/capture0.UYVY

Then I want to know is it possible to get the timestamp from the system server or something else when I start recording? I need to know the exact time second when the recording starts. Is it possible to get the time instant into the file name automatically when the file is created?

Any help would be greatly appreciated.

Hi,
You can link v4l2src to appsink. Here is a sample:
https://devtalk.nvidia.com/default/topic/1010111/jetson-tx1/nvmm-memory/post/5158652/#5158652
The sample pipeline is ‘nvcamerasrc ! nvvidconv ! appsink’. Please replace it with your ‘v4l2src ! appsink’

In GstBuffer, there is timestamp information:
https://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstBuffer.html#GST-BUFFER-PTS:CAPS

Hi,

Thanks for your help.

But I am almost a dummy to Gstreamer. I only use this command to capture in terminal without c++ script. Your code is quite long and seems complex for me to understand even if I tried my best.

I just wanted to know the exact time second when the recording starts. (no further requirement).

Please go to http://gstreamer-devel.966125.n4.nabble.com/
Users in gstreamer forum are more experienced and may give you other suggestions.

If you just want to name the file with date, you can use command date for making filename:

... ! filesink location=recorded_`date '+%Y-%m-%d_%H-%M-%S'`.UYVY

Thank you!

This helps!