I want to save time length of the video files having several extension(mp4, wav, flv etc) in to database while uploading to server when submitting the page. But I did not find the how to get the length of the uploading video? I tried this code but it only works for audio files.
File f = new File(fileName);
Bitstream m_bitstream = new Bitstream(inputStream);
Header m_header = m_bitstream.readFrame();
int mediaLength = (int)f.length();
int nTotalMS = 0;
if (mediaLength != AudioSystem.NOT_SPECIFIED) {
nTotalMS = Math.round(m_header.total_ms(mediaLength));
}
Can you please help me?