开发者

Video file time length in minute while uploading to server in Spring or J2EE

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(inputS开发者_如何学Ctream);
      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?


Please refere to this post for "wav" files

How to learn .wav duration in Java media frame work?

For mp3 files please refere to:

How do I get a mp3 file's total time in Java?

For mp4 please refer to:

Is there a Java API for mp4 files?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜