简体   繁体   English

ffmpeg:1帧按需操作

[英]ffmpeg: 1 frame manipulation on demand

Hello folks & friends of SO! 大家好,SO的朋友们!

We need to create a small application to take a random frame from a video, and apply some modifications to it, in real time. 我们需要创建一个小型应用程序,以从视频中获取随机帧,并对其进行实时修改。

This has to be done in real time, and in order to do that, we wouldn't mind to create some initial delay, before the video starts streaming. 这必须实时完成,为此,我们不介意在视频开始流式传输之前创建一些初始延迟。 So let's assume we have a total of 6 seconds of preloading time, in order to: 因此,假设我们总共有6秒的预加载时间,以便:

1) extract a keyframe.
2) create an image with it.
3) manipulate the image.
4) replace the original keyframe with the new one.

The point (3) of the previous algorithm is already solved using GD as a PHP module. 使用GD作为PHP模块已经解决了先前算法的要点(3)。 However we would need to find a solution for the rest of the procedure in order to accomplish this. 但是,我们将需要为其余过程找到解决方案,以实现此目的。

Please if anyone is available to help us with this, feel free to contact me. 如果有人可以帮助我们,请随时与我联系。

Thanks in advance; 提前致谢; Chris C. Russo 克里斯·鲁索(Chris C.Russo)

This is a pretty complicated problem that cannot be solved by simply replacing the keyframe with a modified image. 这是一个非常复杂的问题,无法通过简单地将关键帧替换为修改后的图像来解决。 Following problems (at least) should be addressed for this to work: 要使其正常工作,至少应解决以下问题:

  • Re-encoding all the frames that depend on the keyframe. 重新编码依赖于关键帧的所有帧。 Otherwise, the video would be corrupt. 否则,视频将损坏。
  • File format considerations - The modified keyframe and subsequent frames are likely to have a different size after encoding (compared to the original encoded data). 文件格式注意事项-编码后,修改后的关键帧和后续帧的大小可能会有所不同(与原始编码数据相比)。 Storing them in the output file is not easy 将它们存储在输出文件中并不容易
  • Timestamp - The timestamp information for these modified frames must be preserved, else there would be audio-video sync issues in the output file. 时间戳-必须保留这些已修改帧的时间戳信息,否则输出文件中将出现音频-视频同步问题。

Given these issues, my recommendation is to perform the image manipulation in the raw video frame, and encode the stream afterwards. 考虑到这些问题,我的建议是在原始视频帧中执行图像处理,然后对流进行编码。 Please let me know if I can help clarify. 请让我知道是否可以帮助您澄清。

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

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