Ask Your Question
0

Can we get the PTS value of the frame

asked 2015-12-11 01:16:09 -0600

gafoor gravatar image

updated 2015-12-11 02:39:46 -0600

I'm using SIFT feature of Opencv in an application. I need to read the PTS value of the frame which i'm using. Is there any API to read PTS value in Opencv.

As a input I'm giving the video and I need to read the Presentation timestamp (PTS) of the frames in the video.

edit retag flag offensive close merge delete

Comments

what do you mean by "PTS value" ?

berak gravatar imageberak ( 2015-12-11 01:40:11 -0600 )edit

Presentation timestamp.

gafoor gravatar imagegafoor ( 2015-12-11 02:38:15 -0600 )edit
1

so, totally unrelated to SIFT , right ?

would that be the date, when your picture was acquired ? the frame# from the video ?

(it's probably even totally unrelated to opencv)

berak gravatar imageberak ( 2015-12-11 02:49:51 -0600 )edit

Yes. It is unrelated to SIFT .Here I'm comparing the video frames with a reference frame, for comparing i'm using SIFT algorithm.When match-count is high, as output I need to provide the PTS value which will be in the PES Packetized Elementary Stream header. It not refers to the date/time picture when acquired.

gafoor gravatar imagegafoor ( 2015-12-11 03:53:13 -0600 )edit
2

ah, a bit clearer now. unfortunately, you can't access the PES (or any kind of codec/container/packet header) from opencv, such information gets discarded way before. (also, different codecs/containers might not even have it)

you probably need to interface with ffmpeg/gstreamer directly, to achieve this

berak gravatar imageberak ( 2015-12-11 04:03:54 -0600 )edit

Thank Berak!!!

gafoor gravatar imagegafoor ( 2015-12-11 04:13:02 -0600 )edit

I am facing same issue, I need PTS of live video stream while processing frame in OpenCV. I mean what is value of PTS (in PES header of Transport stream) of particular frame on which currently I am doing processing in OpenCV.

Can some one give me some hint whether this is doable or not?

hb15 gravatar imagehb15 ( 2017-06-27 04:51:50 -0600 )edit

@berak, Can you please help me out if you came across any way to do this?

hb15 gravatar imagehb15 ( 2017-06-27 05:00:19 -0600 )edit

@hb15 , the answer is still: not possible.

berak gravatar imageberak ( 2017-06-27 05:02:23 -0600 )edit

@berak, Thanks for your quick reply.

I can see my ffmpeg prints, when I build ffmpeg statically and then compile OpenCV and run OpenCV app to get frame etc.

But I am not sure how to make interface to get PTS from ffmpeg. I am new to OpenCV but worked for different development in FFMPEG.

In above thread you mentioned 'you probably need to interface with ffmpeg/gstreamer directly, to achieve this', Can you please give me some idea or link how to do this?

hb15 gravatar imagehb15 ( 2017-06-27 06:30:01 -0600 )edit

1 answer

Sort by » oldest newest most voted
0

answered 2018-07-31 06:03:02 -0600

sanjaya gravatar image

updated 2018-07-31 06:44:24 -0600

double pts = vc.get(CV_CAP_PROP_POS_MSEC);

whether it contains proper value depends on driver implementation.

v4l driver for pi camera implements it; some notes:

  • the unit of measurement in ms
  • it has 3 decimal place precision (1µs) -- mmal has µs precision for pts & sts.
  • value should be taken from pts. to translate it to system clock we'll need to pull sts and system clock and calculate the offset.
edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2015-12-11 01:16:09 -0600

Seen: 2,363 times

Last updated: Jul 31 '18