ffprobe -print_format xml -show_format -show_streams -count_frames "input" > "output.xml"

で各ストリームのフレーム数を調べるとむちゃくちゃ時間がかかるの何とかならないかな。
inputが長さ3時間で2GBほどのmpeg2動画だと30秒ほどかかる。