When using samtools 1.19, I would index my .bam, and use idxstatst to make a file of read counts per sequence in my reference, and the unmapped reads...