How to get video duration from mp4, wmv, flv, mov videos

后端 未结 10 701
深忆病人
深忆病人 2020-11-30 07:51

Alright. Actually i need mostly the mp4 format. But if it is possible to get for other types as well that would be nice. I just need to read the duration of the file. How ca

10条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-11-30 08:17

    You could also use windows media player, although it don't support alle file types you requested

    using WMPLib;
    
    public Double Duration(String file)
        {
            WindowsMediaPlayer wmp = new WindowsMediaPlayerClass();
            IWMPMedia mediainfo = wmp.newMedia(file);
            return mediainfo.duration;
        }
    }
    

提交回复
热议问题