如何用java分割wmv文件
如何分割 *.wmv 文件(使用 java)? 我尝试了简单的算法,例如从 wmv 文件读取字节并将前半部分存储在一个文件中,另一半存储在另一个文件中。但第二个变得不可玩。 正如我所看到的,我必须向第二个文件添加正确的标头,以允许媒体播放器正确解释数据。 这是真的吗?如果不是,我该如何进行分割?如果我的假设正确,我在哪里可以找到 wmv 标头规范?
How can I split *.wmv file (using java)?
I tryed simple algorythm like read bytes from wmv file and store first half in one file and other half in another file. But the second becomes non-playable.
As I can see i must add to the second file correct header to allow media-players interpret data correct.
Is it true? How can i do splitting if it is not and where can i find wmv header specification if my assumption is correct?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您无需帮助自己进行任何格式定义,因为 WMV 文件只能通过 Windows Media Format SDK 正确处理。
以下是有关如何从 java 调用 COM 的一些(很少)信息: http://www.eggheadcafe.com/software/aspnet/29766681/windows-media-encoder-sdk-java.aspx
然后,转到 http://sourceforge.net/projects/windowsmedianet/files/WindowsMediaNetSamples/Dec%202008/
并下载示例,查看 WMVSPLIT (我猜这是您应该阅读的示例的名称)。
另外,您应该知道您只能在 CLEAN_POINT 处分割文件(这是 KEYFRAME 的 WMV 行话)。
编辑:
事实上,站在你的角度,我会选择一些 Windows 机器和简单的 .exe 或一些其他类型的额外进程实用程序,你将从 java 执行。我坚信它会更简单。
如果您没有 Windows 机器,则必须通过 VLC 代码来查找 ASF 格式解析器。
You won't be helping yourself with any format definitions, since WMV files are handled properly only through the Windows Media Format SDK.
Here is some (very little) info on how to call COM from java: http://www.eggheadcafe.com/software/aspnet/29766681/windows-media-encoder-sdk-java.aspx
Then, go to http://sourceforge.net/projects/windowsmedianet/files/WindowsMediaNetSamples/Dec%202008/
and download the samples, look into WMVSPLIT (I guess that's the name of the sample you should read).
Also, you should know that you will be able to split the files ONLY at CLEAN_POINTs (that's WMV lingo for KEYFRAME).
EDIT:
In fact, I would go, in your shoes, for some windows machine and simple .exe or some other kind of extra-process utility that you will execute from java. My strong belief is that it would be simpler.
And if you don't have a windows machine, you'll have to go through the VLC code to find ASF format parser.