BEGIN {
RS="--\n"
ORS="\n"
FS="[=\n]"
frm=0
offset=0
}
# A typical record looks like:
# pkt_pts_time=166.725833
# pkt_pos=596336
# pict_type=I
# coded_picture_number=13
# interlaced_frame=0
# --
{
pkt_pts_time=int($2*1000+0.5)
pkt_pos=$4
frame=$8+offset
if (frm==0) {
startpts=pkt_pts_time
# a bug? in ffprobe makes the frame numbers deficient by 2 after frame 0
# but this does not seem to affect mkv containers made by ffmpeg?
if (ending != "mkv") {
offset=2
}
}
frm=1
pkt_pts_time=pkt_pts_time-startpts
#
#
print ""
print ""
}