在本地显示时使用ffmpeg捕获和流式传输 [英] Capturing and streaming with ffmpeg while displaying locally
问题描述
我可以使用ffmpeg从设备捕获视频,可以对音频/视频进行转码,也可以将其流式传输到ffserver.
I can capture with ffmpeg from a device, I can transcode the audio/video, I can stream it to ffserver.
当在本地显示捕获的内容时,如何使用ffmpeg捕获和流式传输?
How can I capture and stream with ffmpeg while showing locally what is captured?
到目前为止,我一直在使用VLC捕获并流式传输到localhost,然后使用ffmpeg获取该流,再次对其进行转码,然后流式传输到ffserver.
Up to now I've been using VLC to capture and stream to localhost, then ffmpeg to get that stream, transcode it again, and stream to ffserver.
我只想使用ffmpeg来做到这一点.
I'd like to do this using ffmpeg only.
谢谢.
推荐答案
选项A :将 ffmpeg
与多个输出和一个单独的播放器一起使用:
Option A: Use ffmpeg
with multiple outputs and a separate player:
- 输出1:无需转码即可复制源并将其通过管道传输或发送到本地端口
-
输出2:转码并发送到服务器
- output 1: copy source without transcoding and pipe it or send it to a local port
output 2: transcode and send to server
使用 ffplay
ffmpeg -f x11grab [grab parameters] -i :0.0 \
[transcode parameters] -f [transcode output] \
-f rawvideo - | ffplay -f rawvideo [grab parameters] -i -
选项B : ffmpeg
仅适用于OpenGL和SDL窗口(需要SDL和-enable-opengl
)
Option B: ffmpeg
only with OpenGL and a SDL window (requires SDL and --enable-opengl
)
ffmpeg -f x11grab [grab parameters] -i :0.0 \
[transcode parameters] -f [transcode output] \
-f opengl "Window title"
这篇关于在本地显示时使用ffmpeg捕获和流式传输的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!