summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2016-01-24 23:53:14 +0000
committerCarl Hetherington <cth@carlh.net>2016-01-24 23:53:14 +0000
commit952dc629d05500e45141239796458b450d4de895 (patch)
treed858ed2d2ef05b8561f4f4c227b0769590dc9ebd
parentd217a16d41dd71c921fa2155e068df7cca11f457 (diff)
Add hack.
-rw-r--r--hacks/check_packets.py35
1 files changed, 35 insertions, 0 deletions
diff --git a/hacks/check_packets.py b/hacks/check_packets.py
new file mode 100644
index 000000000..916813a1f
--- /dev/null
+++ b/hacks/check_packets.py
@@ -0,0 +1,35 @@
+#!/usr/bin/python
+
+import subprocess
+import shlex
+import sys
+
+last_video_pts = None
+
+def handle(frame):
+ 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']
+ last_video_pts = frame['pkt_pts_time']
+
+p = subprocess.Popen(shlex.split('ffprobe -show_frames %s' % sys.argv[1]), stdin=None, stdout=subprocess.PIPE)
+frame = dict()
+while True:
+ l = p.stdout.readline()
+ if l == '':
+ break
+
+ l = l.strip()
+
+ if l == '[/FRAME]':
+ handle(frame)
+ frame = dict()
+ elif l != '[FRAME]' and l != '[SIDE_DATA]' and l != '[/SIDE_DATA]':
+ s = l.split('=')
+ if s[0] == 'pkt_pts_time':
+ frame[s[0]] = float(s[1])
+ else:
+ frame[s[0]] = s[1]