Some more pts timing analysis.
[dcpomatic.git] / hacks / check_packets.py
index 916813a1fe47129f5ae952ed698e8e873be8a2f7..22d2aa434c25efac88c039328c5167f4f3851710 100644 (file)
@@ -4,15 +4,20 @@ import subprocess
 import shlex
 import sys
 
+last_video = None
 last_video_pts = None
 
 def handle(frame):
+    global last_video
     global last_video_pts
     if frame['media_type'] == 'video':
         if last_video_pts is not None and frame['pkt_pts_time'] <= last_video_pts:
-            print 'Out of order video frame %f is ahead of %f' % (frame['pkt_pts_time'], last_video_pts)
-        else:
-            print 'OK frame %f' % frame['pkt_pts_time']
+            print 'Out of order video frame %f (%d) is same as or behind %f (%d)' % (frame['pkt_pts_time'], frame['pkt_pts'], last_video_pts, last_video)
+        elif last_video_pts is not None:
+            print 'OK frame %f %f %f' % (frame['pkt_pts_time'], frame['pkt_pts_time'] - last_video_pts, 1 / (frame['pkt_pts_time'] - last_video_pts))
+       else:
+            print 'OK frame %f' % (frame['pkt_pts_time'])
+        last_video = frame['pkt_pts']
         last_video_pts = frame['pkt_pts_time']
 
 p = subprocess.Popen(shlex.split('ffprobe -show_frames %s' % sys.argv[1]), stdin=None, stdout=subprocess.PIPE)
@@ -31,5 +36,7 @@ while True:
         s = l.split('=')
         if s[0] == 'pkt_pts_time':
             frame[s[0]] = float(s[1])
-        else:
+        elif s[0] == 'pkt_pts':
+            frame[s[0]] = float(s[1]) 
+        elif len(s) > 1:
             frame[s[0]] = s[1]