Are these issues can be checked programmatically?
For the first one, I answer "yes". Assuming file is a standard PCM wave file, the duration is usually computed and displayed using datas in the header of the file (nb of samples, nb of channels, nb of samples per channels, etc.) -- see Riff Header informations (SDK, http://www.sonicspot.com/guide/wavefiles.html
) -- when the sound is retrieved as a "file in the file".
Study the link above, use an hex editor, some cups of coffee
and you'll find all your answers !
For the second, I really don't know... Use an audio editor to remove unwanted sound, maybe ? But programmaticaly,