简体   繁体   English

可以将实时m3u8流与WebRTC源中的PIP覆盖相结合吗?

[英]Possible to Combine Live m3u8 stream with PIP overlay from WebRTC source?

Can someone tell me what server-side technology (perhaps ffmpeg), one could use in order to: 有人可以告诉我什么服务器端技术(也许是ffmpeg)可以用于以下目的:

1) display this full-screen live-streaming video: 1)显示此全屏实时流视频:

http://aolhdshls-lh.akamaihd.net/i/gould_1@134793/master.m3u8 http://aolhdshls-lh.akamaihd.net/i/gould_1@134793/master.m3u8

2) and overlay it in the lower-right corner with a live video coming from a webRTC video-chat stream? 2)并用来自webRTC视频聊天流的实时视频将其覆盖在右下角?

3) and send that combined stream into a new m3u8 live-stream 3)并将合并后的流发送到新的m3u8实时流中

4) Note that it needs to be a server-side solution - - - cannot launch multiple video players in this case (needs to pass the resulting stream to SmartTV's which only have one video-decoder at a time) 4)请注意,它必须是服务器端解决方案---在这种情况下不能启动多个视频播放器(需要将结果流传递到一次仅具有一个视频解码器的SmartTV上)

The closest example I've found so far is this article: 到目前为止,我找到的最接近的示例是本文:

https://trac.ffmpeg.org/wiki/Create%20a%20mosaic%20out%20of%20several%20input%20videos https://trac.ffmpeg.org/wiki/Create%20a%20mosaic%20out%20of%20several%20input%20videos

Which isn't really live, nor is it really doing overlays. 这不是真正的直播,也不是真正的覆盖。

any advice is greatly appreciated. 任何意见是极大的赞赏。

Let me clear what you want in this case : 在这种情况下,让我清除您想要的内容:

  1. Input video is HLS streaming from webRTC : What about delay? 输入视频是来自webRTC的HLS流:延迟如何? is dealy important thing in your work? 交易中重要的事情是对的吗?

  2. Overlay image into video : This will need that decoding input video, and filtering it, encoding again. 将图像叠加到视频中:这需要解码输入视频,然后对其进行过滤,然后再次编码。 so it needs a lot of cpu resource and even more if input video is 1080p. 因此,如果输入视频为1080p,则需要大量的CPU资源,甚至更多。

  3. Re-struct new HLS format : You must put it lot of encoding option to make sure that ts fragment works well. 重构新的HLS格式:必须添加很多编码选项,以确保ts片段能正常工作。 most important thing is GOP size and ts duration. 最重要的是GOP大小和ts持续时间。

  4. You need a web server to provide m3u8 index file. 您需要Web服务器来提供m3u8索引文件。 you can use nginx, apache. 您可以使用Nginx,Apache。

What i tell you now in this answer is that ffmpeg command line, which making overlay from input HLS streaming and re-make ts segments. 我现在在这个答案中告诉您的是ffmpeg命令行,该命令行从输入HLS流和重新制作ts段进行覆盖。

Following command-line will do what you want in step 1 to step 3 : 以下命令行将执行步骤1至步骤3中的操作:

ffmpeg \
-re -i "http://aolhdshls-lh.akamaihd.net/i/gould_1@134793/master.m3u8" \
-i "[OVERLAY_IMAGE].png" \
-filter_complex "[0:v][1:v]overlay=main_w:main_h[output]" \
-map [output] -0:a -c:v libx264 -c:a aac -strict -2 \
-f ssegment -segment_list out.list out%03d.ts

This is basic command line that overlay image from your input HLS streaming then creating ts segment and index file. 这是基本的命令行,用于覆盖输入的HLS流中的图像,然后创建ts段和索引文件。

I don't have any further experience with HLS so it can be done without any tuning option but maybe you should tune it for you work. 我对HLS没有任何进一步的经验,因此可以在没有任何调整选项的情况下完成它,但也许您应该为工作进行调整。 and also you should search a little bit for web server to provide m3u8 but it won't be hard. 而且您应该搜索一些Web服务器以提供m3u8,但这并不难。

GOP size(-g) and its duration(segment_tim), as i said, will be key point of your tuning. 正如我所说,GOP大小(-g)及其持续时间(segment_tim)将是您进行调整的关键。

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

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