以编程方式将视频转换为FLV [英] Programmatically convert a video to FLV

查看:207
本文介绍了以编程方式将视频转换为FLV的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在开发一个网络应用程序,需要接受用户以任何格式(.avi,.mov等)上传的视频,并将它们转换为flv,以便在基于闪存的播放器中播放。

i am currently working on a web application that needs to accept video uploaded by users in any format (.avi, .mov, etc.) and convert them to flv for playing in a flash-based player.

由于该网站是基于OpenCms的,最好的解决方案是OpenCms的现成插件,允许上传和播放在后台进行转码操作的视频,但只是一组用于转码的Java类很棒,然后我可以自己制作上传表格和回放部分。

Since the site is OpenCms-based, the best solution would be a ready-made plugin for OpenCms that allowed to upload and play videos doing the transcode operation in background, but just a set of Java classes to do the transcode would be great and then i could make the uploading form and playback part on my own.

推荐答案

你如果你想托管,转码和流式传输flv文件(并且不想购买视频转码应用程序),基本上有两种选择:你可以调用FFMpeg / MEncoder,也可以使用外部Web服务。你也可以通过允许他们在你的网站上嵌入YouTube视频来完全回避这个问题。

You basically have two choices if you want to host, transcode and stream flv files (and don't want to buy a video transcoding application): you can call out to FFMpeg/MEncoder or you can use an external Web service. You could also sidestep the problem completely by allowing them to embed YouTube videos on your site.

如果你去'本地FFMpeg路线'我会建议只使用ProcessBuilder并构建一个命令行来执行FFMpeg。通过这种方式,您可以完全控制执行的内容,避免使用JNI,这是一个绝对的噩梦,并且您可以将特定于操作系统的代码保留在应用程序之外。几乎任何平台都可以找到FFMPeg的所有铃声和口哨声。很有可能它已经存在于您的服务器上。

If you go the 'local FFMpeg route' I would suggest simply using ProcessBuilder and constructing a command-line to execute FFMpeg. That way you get full control over what gets executed, you avoid JNI, which is an absolute nightmare to work with, and you keep OS-specific code out of your app. You can find FFMPeg with all the bells and whistles for pretty much any platform. There's a good chance it's already on your server.

本地FFMPeg路线的好处在于您无需为任何额外的托管付费,一切都在本地运行,虽然你的托管管理员可能会开始抱怨如果你使用了大量的磁盘和CPU。还有一些其他StackOverflow问题可以讨论一些使用FFMpeg 创建可以在Flash播放器中实际播放的flv。

The nice thing about the 'Local FFMPeg' route is that you don't have to pay for any extra hosting, and everything is running locally, although your hosting admin might start complaining if you're using a crazy amount of disk and CPU. There are some other StackOverflow questions that talk about some of the gotchas using FFMpeg to create flvs that you can actually play in the flash player.

Web服务路线很好,因为涉及的设置较少。我没有使用嘿!观看,但看起来很有希望。 PandaStream 易于设置且运行良好,而且您无需额外工作即可在S3上获取所有视频。

The Web service route is nice because there is less setup involved. I have not used Hey!Watch but it looks promising. PandaStream is easy to set up and it works well, plus you get all your videos on S3 with no additional effort.

这篇关于以编程方式将视频转换为FLV的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆