简体   繁体   English

Node.js可以编辑视频文件吗?

[英]Can Node.js edit video files?

I was wondering how compatible Node.js is with videos. 我想知道Node.js与视频的兼容性如何。 Not playing them, but actually editing it. 不播放它们,而是实际对其进行编辑。 My end goal is to reverse videos online. 我的最终目标是在线撤消视频。 Java looks like my best bet so far, but I do like how Node.js is fast, scalable, etc. 到目前为止,Java似乎是我最好的选择,但是我喜欢Node.js的快速性,可伸缩性等。

Does anyone know if it is possible with node.js? 有谁知道node.js是否可能? At lease being able to break up videos into frames, putting them into an array of some sort, and then sticking them back up. 至少可以将视频分解为帧,将它们放入某种数组中,然后将其粘贴回去。

My guess is probably not, as it looks as it is based off of JavaScript. 我的猜测可能不是,因为它看起来是基于JavaScript的。 I may be wrong, but I think javaScript is more UI, Animating, Simple Data jobs, etc. Not big time video editing. 我可能是错的,但我认为javaScript的用途更多是UI,动画,简单数据作业等。

Any help is highly appreciated. 非常感谢您的帮助。

ffmpeg/libav is the go-to library for this sort of thing on Linux. ffmpeg / libav是Linux上此类库的首选库。 While there are some ffmpeg bindings for node.js (eg, https://github.com/xonecas/ffmpeg-node ), they aren't quite as complete as you'd need for this task, and in any case ffmpeg is itself not asynchronous in the sort of way that you'd need to make this make sense for node.js. 尽管有一些用于node.js的ffmpeg绑定(例如https://github.com/xonecas/ffmpeg-node ),但它们并没有您完成此任务所需要的完全,在任何情况下ffmpeg都是本身不是异步的,您需要使之对node.js有意义。

I'd start by trying to implement this task using ffmpeg/libav using C, then consider other implementations afterwards. 我首先尝试使用C使用ffmpeg / libav实现此任务,然后再考虑其他实现。

I would approach this from the other end: What tool can I use to reverse videos? 我将从另一端着手:可以使用什么工具来反转视频? I'm sure there are better options out there, but at least it's possible to do with ffmpeg, according to this SO answer . 我敢肯定那里有更好的选择,但是根据这个答案 ,至少可以用ffmpeg做。 The caveat is that you have to split it into images and then stitch them back together. 需要注意的是,您必须将其拆分为图像,然后将它们缝在一起。

If you would go with this route (ie, using ffmpeg in the manner described), you could indeed accomplish it with node.js for the web application and job handling. 如果您采用这种方法(即以所述方式使用ffmpeg),则确实可以使用node.js来完成,以用于Web应用程序和作业处理。 I would have some kind of workers (either something similar to eg resque or using eg node.js child_process.fork ). 我会有某种类型的工作程序(类似于resque或使用child_process.fork node.js child_process.fork )。

As @duskwuff mentions in his answer, this solution won't be streaming, but using workers, you might be able to accomplish something acceptable, depending on your requirements. 正如@duskwuff在他的回答中提到的那样,该解决方案将不会流式传输,但是使用工作程序,根据您的要求,您也许可以完成一些可以接受的事情。

If, on the other hand, you have eg a Java library that's awesome in reversing videos, you should use that, and perhaps build the web app in Java as well. 另一方面,如果您有一个很棒的Java库,可以倒转视频,则应该使用它,并且也许也可以用Java来构建Web应用程序。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM