我想将RTSP流的输出合并为两者和HLS流以及几个图像静止图像。我可以单独(显然)做到这一点,但是我在组合事情时遇到了麻烦。我可以帮忙吗?
这是我的输出(有效):
输出HLS流:
ffmpeg -rtsp_transport tcp -i '$RTSP_URL'
-c:v copy -b:v 64K -f flv rtmp://localhost/hls/stream_low \
-c:v copy -b:v 512K -f flv rtmp://localhost/hls/stream_high
输出图像静止图像:
ffmpeg -hide_banner -i '$(RTSP_URL)' -y \
-vframes 1 -vf "scale=1920:-1" -q:v 10 out/screenshot_1920x1080.jpeg \
-vframes 1 -vf "scale=640:-1" -q:v 10 out/screenshot_640x360.jpeg \
-vframes 1 -vf "scale=384:-1" -q:v 10 out/screenshot_384x216.jpeg \
-vframes 1 -vf "scale=128:-1" -q:v 10 out/screenshot_128x72.jpeg
感谢您的帮助(我也发布了一笔赏金^ _ ^)
谢谢大家!
答案 0 :(得分:2)
简单
ffmpeg -rtsp_transport tcp -i '$RTSP_URL'
-c:v copy -b:v 64K -f flv rtmp://localhost/hls/stream_low \
-c:v copy -b:v 512K -f flv rtmp://localhost/hls/stream_high \
-vframes 1 -vf "scale=1920:-1" -q:v 10 out/screenshot_1920x1080.jpeg \
-vframes 1 -vf "scale=640:-1" -q:v 10 out/screenshot_640x360.jpeg \
-vframes 1 -vf "scale=384:-1" -q:v 10 out/screenshot_384x216.jpeg \
-vframes 1 -vf "scale=128:-1" -q:v 10 out/screenshot_128x72.jpeg
请注意,按照输出协议的说明,“ HLS”流实际上是RTMP流。另外,对于-c:v copy
,没有视频编码,因此-b:v
没有任何作用。