7

I am currently trying to extract each frame time stamp from an MPEG-4 file that has been recorded using a GoPro.

I want the exact time at which the frame has been captured by the camera, to couple that with computer vision algorithms later on.

I know that the output framerate is 25 fps. I extracted the pts in different ways using ffmpeg and ffprobe, but they all show way too perfect results for me to believe them.

Each frame/packet has a precise, 0.04 sec interal (or 3600 in pts units) which conveniently enough matches a perfect 25 fps.

The commands I have used so far are:

ffmpeg -i 3_96025.MP4  -an -vf showinfo %10d.png 2> res.txt

I have also tried to use

ffmpeg -i 3_96025.MP4 **-copyts** -an -vf showinfo %10d.png 2> res.txt

but the results are exactly the same.

I also tried ffprobe:

ffprobe -i 396025.MP4 -show_packets -select_streams v

Bu the intervals I get are perfect too.

I am quite sure the gopro cannot sustain 25 fps in such a perfect manner. In addition, I recorded a timer, and I can see that each frame does not exactly match 0.04 seconds interval. So is there a way I can actually see the time each frame was captured?

Here is a part of the output I get with ffmpeg for reference :

frame=   42 fps= 26 q=0.0 size=N/A time=00:00:01.36 bitrate=N/A    
n:42 pts:151200 pts_time:1.68 pos:3232584 fmt:yuv420p sar:1/1 s:1280x960 i:P iskey:0 type:B checksum:6A83E942 plane_checksum:[1C859E55 79A4ED3E 28E25DA0]
[Parsed_showinfo_0 @ 0037dea0] n:43 pts:154800 pts_time:1.72 pos:3255334 fmt:yuv420p sar:1/1 s:1280x960 i:P iskey:0 type:B checksum:5736F4C1 plane_checksum:[ACAD00D0 06FFDE34 65FA15BD]
[Parsed_showinfo_0 @ 0037dea0] n:44 pts:158400 pts_time:1.76 pos:3083826 fmt:yuv420p sar:1/1 s:1280x960 i:P iskey:0 type:P checksum:9DD6B636 plane_checksum:[229400B3 7C0B52AF 75D162D4]
[Parsed_showinfo_0 @ 0037dea0] n:45 pts:162000 pts_time:1.8 pos:3531851 fmt:yuv420p sar:1/1 s:1280x960 i:P iskey:0 type:B checksum:2DA4E2B9 plane_checksum:[9C646B9D 16F45382 28B0239A]
[Parsed_showinfo_0 @ 0037dea0] n:46 pts:165600 pts_time:1.84 pos:3556346 fmt:yuv420p sar:1/1 s:1280x960 i:P iskey:0 type:B checksum:B4924AFE plane_checksum:[579EDD8F 94BC5C61 5B7F10FF]
[Parsed_showinfo_0 @ 0037dea0] n:47 pts:169200 pts_time:1.88 pos:3279065 fmt:yuv420p sar:1/1 s:1280x960 i:P iskey:0 type:I checksum:DBB23A0C plane_checksum:[321835C9 57E9C9FB 576B3A39]
[Parsed_showinfo_0 @ 0037dea0] n:48 pts:172800 pts_time:1.92 pos:3655246 fmt:yuv420p sar:1/1 s:1280x960 i:P iskey:0 type:B checksum:9BF3A47A plane_checksum:[4E17440B 3A059191 E394CECF]
[Parsed_showinfo_0 @ 0037dea0] n:49 pts:176400 pts_time:1.96 pos:3677897 fmt:yuv420p sar:1/1 s:1280x960 i:P iskey:0 type:B checksum:2A3167B4 plane_checksum:[78601136 0A6F8334 272ED33B]
[Parsed_showinfo_0 @ 0037dea0] n:50 pts:180000 pts_time:2 pos:3581296 fmt:yuv420p sar:1/1 s:1280x960 i:P iskey:0 type:P checksum:5A8C502E plane_checksum:[65A1FE60 0CEF07C3 F26149FC]
[Parsed_showinfo_0 @ 0037dea0] n:51 pts:183600 pts_time:2.04 pos:3773963 fmt:yuv420p sar:1/1 s:1280x960 i:P iskey:0 type:B checksum:90572E41 plane_checksum:[E9478643 B8BAE0E2 E1A7C6FE]
[Parsed_showinfo_0 @ 0037dea0] n:52 pts:187200 pts_time:2.08 pos:3797473 fmt:yuv420p sar:1/1 s:1280x960 i:P iskey:0 type:B checksum:2F206AB4 plane_checksum:[EB17F6AB 0AD1C78A E032AC61]
[Parsed_showinfo_0 @ 0037dea0] n:53 pts:190800 pts_time:2.12 pos:3700340 fmt:yuv420p sar:1/1 s:1280x960 i:P iskey:0 type:P checksum:9A91E693 plane_checksum:[72309E37 229C34FB 59A71361]
[Parsed_showinfo_0 @ 0037dea0] n:54 pts:194400 pts_time:2.16 pos:3897890 fmt:yuv420p sar:1/1 s:1280x960 i:P iskey:0 type:B checksum:BFCD3D1C plane_checksum:[13787B52 5F33F597 833ECC15]
[Parsed_showinfo_0 @ 0037dea0] n:55 pts:198000 pts_time:2.2 pos:3919440 fmt:yuv420p sar:1/1 s:1280x960 i:P iskey:0 type:B checksum:62C6ED26 plane_checksum:[E4053A80 4752E0B5 E78FD1E2]
jlengrand
  • 10,477
  • 8
  • 51
  • 76
  • Are you looking for a timestamp that can be converted to a Unix epoch timestamp? – Multimedia Mike Jun 07 '13 at 23:55
  • Any timestamp would fit actually. I just want to be able to link each single frame with a precise moment in time for later processing. – jlengrand Jun 08 '13 at 07:39
  • If I'm reading your question correctly, your core concern is that the camera couldn't possibly read images at such perfect intervals and that the timestamps should have more jitter in them while still maintaining an average frame rate of 25 fps. Is that correct? It seems reasonable that the camera firmware would just do a little rounding when writing the file's timestamps. – Multimedia Mike Jun 08 '13 at 16:49
  • 2
    yep, you nailed it. I recorded a chronometer as a test, and the time between 2 frames varies between 30 and 50 ms. On top of that, I couldnt find a way to precisely define the t=0 of the video, meaning that I cant really reference the images compared to my other sensors – jlengrand Jun 09 '13 at 11:45
  • 1
    @jlengrand thats a brilliant idea btw! also did you manage to finally find a way where you can get precise timestamps < 10ms accuracy? – sleeping_dragon Oct 16 '13 at 19:11
  • @sleeping_dragon Nope, no luck so far. It looks like the rounding is internal, and I couldn't find a way to get access to it so far. – jlengrand Jan 13 '14 at 15:53
  • 1
    @jlengrand what type of chronometer did you record? I tried recording a millisecond counter on my computer, but then remembered that computer screens have a refresh rate of 60Hz, and can there for only update every 1/60th of a second (https://www.youtube.com/watch?v=v6ba6k6ZipI). What type of chronometer are you recording such that you can see updates at the millisecond level? – Tim Feb 18 '15 at 18:13

0 Answers0