16 def check_pts_dts(frame):
17 diff = frame['pkt_pts_time'] - frame['pkt_dts_time']
19 print("\tPTS != DTS: %f" % diff)
25 if frame['media_type'] == 'video' and 'video' in types:
26 if last_video_pts is not None and frame['pkt_pts_time'] <= last_video_pts:
27 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)
28 elif last_video_pts is not None:
29 print 'OK V frame %f %f %f %f %d' % (frame['pkt_pts_time'], frame['pkt_dts_time'], frame['pkt_pts_time'] - last_video_pts, 1 / (frame['pkt_pts_time'] - last_video_pts), frame['pkt_size'])
32 print 'OK V frame %f' % (frame['pkt_pts_time'])
33 last_video = frame['pkt_pts']
34 last_video_pts = frame['pkt_pts_time']
35 elif frame['media_type'] == 'audio' and 'audio' in types:
36 stream_index = frame['stream_index']
37 if stream_index in last_audio_pts and (stream_index == AUDIO_STREAM or AUDIO_STREAM is None):
38 print 'OK A[%s] frame %4.8f %4.8f %4.8f %4.8f %d' % (stream_index, frame['pkt_pts_time'], frame['pkt_dts_time'], frame['pkt_pts_time'] - last_audio_pts[stream_index], 1 / (frame['pkt_pts_time'] - last_audio_pts[stream_index]), frame['pkt_size'])
40 if stream_index in last_channels and frame['channels'] != last_channels[stream_index]:
41 print "\t*** unusual channel count"
42 last_audio_pts[stream_index] = frame['pkt_pts_time']
43 last_channels[stream_index] = frame['channels']
46 p = subprocess.Popen(shlex.split('ffprobe -show_frames "%s"' % sys.argv[1]), stdin=None, stdout=subprocess.PIPE)
49 l = p.stdout.readline()
58 elif l != '[FRAME]' and l != '[SIDE_DATA]' and l != '[/SIDE_DATA]':
60 if s[0] in ['pkt_pts_time', 'pkt_dts_time', 'pkt_pts', 'pkt_dts']:
61 frame[s[0]] = float(s[1])
62 elif s[0] in ['channels', 'pkt_size', 'nb_samples']:
63 frame[s[0]] = int(s[1])