#!/usr/bin/perl -w # # Utility routine for hunting defects in files. Finds places in the # output from show-packets where a slew of audio packets with no video # or video packets with no audio show up. These are the most likely # places where audio sync problems appear, and it can be helpful to # re-encode splitting the files at the timestamp where the glitch # ends and normal alternating audio and video resume. That gives you # a good place to do something like insert silence (see make-silence) # to get the audio back in sync. # use strict; my $last_si = 3; my $last_count = 0; while (<>) { if (/^packet\|stream_index\=(\d+)\|/) { my $si = $1; if ($si == $last_si) { ++$last_count; if ($last_count == 4) { print $_; } } else { $last_count = 1; $last_si = $si; } } }