查找DSS音频文件的播放长度... [英] Find Play length of DSS Audio File...
本文介绍了查找DSS音频文件的播放长度...的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
嗨朋友们......
任何人都可以说如何找到DSS音频文件的playlength。
音频文件采用DSS格式。
请帮我找到DSS文件的playlength ...
在此先感谢,
Mani。
Hi friends...
Can any one say how to find the playlength of the DSS audio file .
The audio file is in the DSS format .
Pls help me to find the playlength of DSS file...
Thanks in advance ,
Mani.
推荐答案
如果你没试过ffmpeg,请查看这个
FFMPEG All in一个视频&音频转换器接口 [ ^ ]
if you not tried ffmpeg check this
FFMPEG All in One Video & Audio Converter Interface[^]
嗨!
我知道这是一篇非常古老的帖子,但在google中引用得很好。所以我发布了我的解决方案。
只需对DSS和DS2文件格式进行一些逆向工程即可提取如下信息:
Hi !
I know this is a very very old post, but it's well referenced in google. So I publish my solution.
Just make some reverse engineering on the DSS and DS2 file format for extract the information like this :
public static TimeSpan GetDssDuration(string fileName)
{
const int durationOffset = 62;
const int durationLength = 6;
const int headerLength = durationOffset + durationLength;
using (var fileStream = File.OpenRead(fileName))
{
var fileHeader = new byte[headerLength + 1];
fileStream.Read(fileHeader, 0, headerLength);
var hoursData = new byte[2];
var minutesData = new byte[2];
var secondsData = new byte[2];
Array.Copy(fileHeader, durationOffset, hoursData, 0, 2);
Array.Copy(fileHeader, durationOffset + 2, minutesData, 0, 2);
Array.Copy(fileHeader, durationOffset + 4, secondsData, 0, 2);
return new TimeSpan(int.Parse(Encoding.ASCII.GetString(hoursData)), int.Parse(Encoding.ASCII.GetString(minutesData)), int.Parse(Encoding.ASCII.GetString(secondsData)));
}
}
我希望这会对某人有所帮助。
I hope this will help someone.
这篇关于查找DSS音频文件的播放长度...的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文