- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在使用 rtsp-simple-server ( https://github.com/aler9/rtsp-simple-server ) 并向 RTSP 服务器提供 FFMPEG 流。
我使用 docker compose 文件来启动流:
version: "3.8"
services:
ffmpeg:
container_name: ffmpeg-base
restart: always
image: "jenssgb/rtspffmpeg:base"
depends_on:
- rtsp-server
volumes:
- $PWD/:/video
network_mode: "host"
command: "ffmpeg -re -stream_loop -1 -i /video/footage-1-b.mp4 -c copy -f rtsp rtsp://localhost:8554/compose-rtsp"
rtsp-server:
container_name: rtsp-server-base
restart: always
image: "aler9/rtsp-simple-server"
network_mode: "host"
现在我正在尝试通过转码来降低视频的 FPS:
command: -re -stream_loop -1 -i ${VIDEO_FILE} -vf "fps=${FPS_COMPOSE}" -f rtsp rtsp://localhost:8554/compose-rtsp
这基本上是有效的,
但是输出视频的质量变得很差 .我尝试了很多东西,例如
-c:v libx264
这确实帮助了一分钟,但让 ffmpeg 崩溃了。
av_interleaved_write_frame(): Broken pipe0:00:09.99 bitrate=N/A speed=0.985x
[rtsp @ 0x5563b1755640] Packets poorly interleaved, failed to avoid negative timestamp -33660 in stream 0.
Try -max_interleave_delta 0 as a possible workaround.
av_interleaved_write_frame(): Broken pipe
Error writing trailer of rtsp://localhost:8554/compose-rtsp: Broken pipe
知道如何降低 FPS 将流发送到服务器但保持视频质量吗?稍后我也会降低分辨率 - 但现在我想保持分辨率和质量,但只降低 FPS。
-c:v libx264
进行的测试的完整日志:
ffmpeg -re -stream_loop -1 -i footage-1-b.mp4 -vf "fps=5" -c:v libx264 -f rtsp rtsp://localhost:8554/compose-rtsp
ffmpeg version 4.2.4-1ubuntu0.1 Copyright (c) 2000-2020 the FFmpeg developers
built with gcc 9 (Ubuntu 9.3.0-10ubuntu2)
configuration: --prefix=/usr --extra-version=1ubuntu0.1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-nvenc --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared
libavutil 56. 31.100 / 56. 31.100
libavcodec 58. 54.100 / 58. 54.100
libavformat 58. 29.100 / 58. 29.100
libavdevice 58. 8.100 / 58. 8.100
libavfilter 7. 57.100 / 7. 57.100
libavresample 4. 0. 0 / 4. 0. 0
libswscale 5. 5.100 / 5. 5.100
libswresample 3. 5.100 / 3. 5.100
libpostproc 55. 5.100 / 55. 5.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'footage-1-b.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
title : Session streamed by "nessyMediaServer"
encoder : Lavf58.29.100
comment : h264_3
Duration: 00:59:59.63, start: 0.000000, bitrate: 2099 kb/s
Stream #0:0(und): Video: h264 (Main) (avc1 / 0x31637661), yuvj420p(pc), 1280x720 [SAR 1:1 DAR 16:9], 2061 kb/s, 24.96 fps, 25 tbr, 12800 tbn, 25 tbc (default)
Metadata:
handler_name : VideoHandler
Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 8000 Hz, mono, fltp, 35 kb/s (default)
Metadata:
handler_name : SoundHandler
Stream mapping:
Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
Stream #0:1 -> #0:1 (aac (native) -> aac (native))
Press [q] to stop, [?] for help
[aac @ 0x56277bc7f840] Too many bits 8832.000000 > 6144 per frame requested, clamping to max
[libx264 @ 0x56277bbc33c0] using SAR=1/1
[libx264 @ 0x56277bbc33c0] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
[libx264 @ 0x56277bbc33c0] profile High, level 3.1
[libx264 @ 0x56277bbc33c0] 264 - core 155 r2917 0a84d98 - H.264/MPEG-4 AVC codec - Copyleft 2003-2018 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=12 lookahead_threads=2 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=5 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
Output #0, rtsp, to 'rtsp://localhost:8554/compose-rtsp':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
title : Session streamed by "nessyMediaServer"
comment : h264_3
encoder : Lavf58.29.100
Stream #0:0(und): Video: h264 (libx264), yuvj420p(pc), 1280x720 [SAR 1:1 DAR 16:9], q=-1--1, 5 fps, 90k tbn, 5 tbc (default)
Metadata:
handler_name : VideoHandler
encoder : Lavc58.54.100 libx264
Side data:
cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
Stream #0:1(und): Audio: aac (LC), 8000 Hz, mono, fltp, 48 kb/s (default)
Metadata:
handler_name : SoundHandler
encoder : Lavc58.54.100 aac
av_interleaved_write_frame(): Broken pipe0:00:09.87 bitrate=N/A speed=0.978x
[rtsp @ 0x56277bba0640] Packets poorly interleaved, failed to avoid negative timestamp -33660 in stream 0.
Try -max_interleave_delta 0 as a possible workaround.
av_interleaved_write_frame(): Broken pipe
Error writing trailer of rtsp://localhost:8554/compose-rtsp: Broken pipe
frame= 50 fps=4.6 q=23.0 Lsize=N/A time=00:00:10.21 bitrate=N/A speed=0.947x
video:162kB audio:8kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
[libx264 @ 0x56277bbc33c0] frame I:1 Avg QP:19.85 size:165667
[libx264 @ 0x56277bbc33c0] frame P:13 Avg QP:20.88 size:140481
[libx264 @ 0x56277bbc33c0] frame B:36 Avg QP:24.58 size: 55445
[libx264 @ 0x56277bbc33c0] consecutive B-frames: 4.0% 0.0% 0.0% 96.0%
[libx264 @ 0x56277bbc33c0] mb I I16..4: 4.4% 30.8% 64.8%
[libx264 @ 0x56277bbc33c0] mb P I16..4: 4.1% 10.6% 20.0% P16..4: 24.4% 24.8% 13.3% 0.0% 0.0% skip: 2.6%
[libx264 @ 0x56277bbc33c0] mb B I16..4: 0.8% 2.0% 4.0% B16..8: 40.3% 14.5% 5.2% direct:11.8% skip:21.4% L0:77.1% L1: 7.9% BI:14.9%
[libx264 @ 0x56277bbc33c0] 8x8 transform intra:30.1% inter:11.9%
[libx264 @ 0x56277bbc33c0] coded y,uvDC,uvAC intra: 82.5% 60.9% 26.6% inter: 55.0% 42.4% 2.7%
[libx264 @ 0x56277bbc33c0] i16 v,h,dc,p: 17% 26% 34% 23%
[libx264 @ 0x56277bbc33c0] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 22% 33% 15% 3% 4% 5% 4% 3% 9%
[libx264 @ 0x56277bbc33c0] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 20% 22% 13% 3% 17% 11% 5% 3% 6%
[libx264 @ 0x56277bbc33c0] i8c dc,h,v,p: 54% 25% 16% 5%
[libx264 @ 0x56277bbc33c0] Weighted P-Frames: Y:7.7% UV:7.7%
[libx264 @ 0x56277bbc33c0] ref P L0: 33.2% 11.6% 29.0% 23.9% 2.4%
[libx264 @ 0x56277bbc33c0] ref B L0: 79.6% 11.9% 8.5%
[libx264 @ 0x56277bbc33c0] ref B L1: 95.9% 4.1%
[libx264 @ 0x56277bbc33c0] kb/s:3190.34
[aac @ 0x56277bc7f840] Qavg: 65536.000
Conversion failed!
谢谢,
最佳答案
当您说“视频质量变得非常糟糕”时,我猜您的意思是您的转码输出视频中有很多 block 伪影。这通常是因为您没有为输出视频流分配足够的带宽。没有足够的输出带宽可供使用,编码器会量化并消除高频内容,因此看起来很讨厌。
你没有提到你有什么样的节目 Material 。但值得一提的是:在具有大量运动的 Material 中(想想詹姆斯邦德电影),它不会节省太多带宽来降低帧速率:我们正在编码连续帧之间的差异。您在帧之间等待的时间越长,编码的差异就越大(运动估计器的工作就越困难)。如果您从根本上降低帧速率(例如从 24 到 2),它会变得更糟。
Talking-heads 素材通常对帧率不太敏感。
你可以试试setting your bandwidth -- your output bitrate -- explicitly像这样。
-b:v 1000K -maxrate 1200K -bufsize 500K
这些参数告诉 ffmpeg 给你一个 1 mbps 的恒定速率流,允许一些变化。从您的示例中可以看到类似的内容...
-re -stream_loop -1 -i ${VIDEO_FILE} -vf "fps=${FPS_COMPOSE}" -b:v 1M -maxrate 1M -bufsize 500K -f rtsp rtsp://localhost:8554/compose-rtsp
在您的笔记本电脑上尝试各种 ffmpeg 参数组合可能是最简单的,这样您就可以在选择一个放入 docker 镜像之前快速循环各种尝试。
关于FFMPEG 在使用 rtsp-simple-server 降低 FPS 和通过 RTSP 流式传输时保持质量,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65852931/
我有一个简单的 Rtsp 客户端...客户端将 Rtsp 命令发送到 Rtsp 服务器并从服务器获取 RTP 数据包。 The problem is that after a time( about
所以我正在尝试创建一个流式传输音乐的 RTSP 服务器。 我不明白服务器如何播放音乐,不同的请求会得到当时正在播放的内容。 所以,整理我的问题: 1)服务器如何播放音乐文件? 2) 对服务器的请求如何
我已经安装 gst-rtsp-server我想尝试一个简单的代码。但是在编译时我收到以下错误: In function `main': test-launch01.c:(.text+0x64): un
已关闭。此问题不符合Stack Overflow guidelines 。目前不接受答案。 要求我们推荐或查找工具、库或最喜欢的场外资源的问题对于 Stack Overflow 来说是偏离主题的,因为
我刚刚开始研究流媒体库和底层协议(protocol)。我了解 rtsp/rtp 流媒体以及这两种协议(protocol)的用途。但是,如果我们需要 IP 地址、编解码器和 rtsp/rtp 协议(pr
我想从 Live-CAM 捕获 Rtsp 流,然后我想将其重新流式传输到另一个 Rtsp 服务器。 基本上,我的计算机将使用 FFMpeg 作为中继服务器。 我已经尝试过这个临时命令,但我无法让它工作
我正在使用 java web 应用程序使用 rtsp 从 IP 摄像机检索视频; rtsp url 在 url 本身中嵌入了用户名/密码,这似乎很不安全。例如rtsp://用户:密码@ip/... 有
对不起,我的英语不好 我正在为 rtsp 通信程序工作 此 RTSP 服务器在我的 SETUP 请求中回复 459 错误(不允许聚合操作) 我对此一无所知。 请帮我。我做错了什么? ==== Mess
对于这个问题的普遍性,我深表歉意。我尝试了很多东西,但似乎没有任何效果。我有服务器? (我们称它为 服务器 A)驻留在局域网中,那里也有一个 IP 网络摄像头。该网络摄像头不断在地址上提供 RTSP
对于这个问题的普遍性,我深表歉意。我尝试了很多东西,但似乎没有任何效果。我有服务器? (我们称它为 服务器 A)驻留在局域网中,那里也有一个 IP 网络摄像头。该网络摄像头不断在地址上提供 RTSP
我有一个 RTSP 视频源 (h265),我可以使用 VLC 显示它。我想将流分成两部分,一个以原始分辨率(使用 h265 编码),另一个以新的较低分辨率(使用 h264 编码)。这两个新流也应该是
实时流协议(protocol) (RTSP) 版本 1.0 发布为 RFC 2326 1998 年。 现在将近 20 年后,2.0 版发布为 RFC 7826 2016 年 12 月。 我想知道这些更
我想使用 Kurento 作为媒体服务器,它将 WebRTC 作为输入并提供 RTSP 流作为 url:rtsp://kurento/streamName 这可能吗? 我看到了https://gith
我正在使用 rtsp-simple-server ( https://github.com/aler9/rtsp-simple-server ) 并向 RTSP 服务器提供 FFMPEG 流。 我使用
关注:https://github.com/kyriesent/node-rtsp-stream和 How to display IP camera feed from an RTSP url ont
我目前有一个采用 H.264 编码的 IP 摄像机流式视频 (RTSP)。 我想使用 FFmpeg 将此 H.264 编码流转换为另一个 RTSP 流,但 MPEG-2 编码。我该怎么做?我应该使用哪
我目前正在为 Android 设备开发通过 RTSP/UDP 进行的视频流。我的目标是通过 4G 蜂窝网络流式传输视频。我面临的问题是所使用的方法不适用于 Samsung Galaxy Core SM
获取 [rtsp @ 000002aa9df0cb80] 方法设置失败:500 内部服务器错误 当我尝试在 opencv python 中流式传输 rtsp 相机但一段时间后它可以正常工作几分钟并且不
我是这个论坛的新手,我的英语水平不是最好的! 我有一个网站,在那里我发布了摄像机的视频流,以显示在嵌套时间现场发生的事情!一个具有高 IT 技能的人为我构建了一个小服务器用于重新流 (Datarhei
我收到一个 HTTP 错误 400,以响应下面显示的函数正在处理的以下 RTSP URL。 描述 rtsp://root:pass@192.168.1.47/axis-media/media.amp
我是一名优秀的程序员,十分优秀!