将文件嵌入到已编译的 .exe 中
我正在开发一个项目,该项目是关于制作带有内置库的视频播放器。
我想要做的是在 Flash CS5、Python(使用 Phonon)或 C# 中创建一个自定义视频播放器,它可以播放任何视频文件(与扩展名无关)。这个想法是,当我运行我的程序时,将播放嵌入在编译的 .exe 中的视频文件。
有没有办法可以将视频文件包含在编译后的 .exe 中?
编辑:视频文件大小约为 100 MB。
I am working on a project that is about making a video player with built in libraries.
What I want to do is create a custom video player in Flash CS5, Python (Using Phonon) or C# which can play any video file (independent of the extension). The idea is that when I run my program, the video files that are embedded in the complied .exe will be played.
Is there a way I can include the video file with the compiled .exe?
EDIT: the video files will be around 100 MB in size.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
让我看看我是否正确理解了你的问题。我假设您想要将视频文件嵌入到您正在创建的视频播放器应用程序中。视频可以是任何类型(.avi、.mp4、.flv),并且应用程序将是可执行文件(.exe)。
如果是这种情况,那么您需要做的是,使用 Visual Studio 将视频文件添加为项目中的资源,重建项目并从代码访问资源。
例如,如果您已将
MyVideo.avi
添加到项目中,则在构建项目后,您可以将其作为MyNamespace.MyVideo.avi
进行访问。以下是一些 SO 帖子,提供了项目中嵌入式资源的更具体示例:
如何在 EXE 中存储文件
如何在 .NET 程序集中嵌入文本文件?
Let me see if I understood your question correctly. I am assuming you want to embed a video file into a video player application that you are creating. The video can be on any type (.avi, .mp4, .flv) and the application will be an executable (.exe).
If this is the case then what you need to do is, using Visual Studio, add your video file as a resource in your project, rebuild the project and access the resource from your code.
For example, if you have added
MyVideo.avi
to your project, after building the project you can access it asMyNamespace.MyVideo.avi
.Here are a couple of SO posts that provide more concrete examples of embedded resources within a project:
How To Store Files In An EXE
How to embed a text file in a .NET assembly?