gpt4 book ai didi

ffmpeg x11grab 转为流式格式

转载 作者:行者123 更新时间:2023-12-04 22:57:48 24 4
gpt4 key购买 nike

2 FFMPEG过程
(1) 生成 ffmpeg x11grab 到 .mp4
(2) 获取 .mp4 并将其同时重新流式传输到多个 rtmp 端点
问题 (1)中生成的文件有这个错误“找不到moov原子”
这是生成 (1) 的命令:

ffmpeg -re -y -f x11grab -draw_mouse 0 -framerate 30 
-video_size $RESOLUTION -i :$DISPLAY_NUM -c:a aac -c:v libx264
-movflags +faststart -preset ultrafast -crf 28 -refs 4 -qmin 4
-pix_fmt yuv420p -filter:v fps=30 file.mp4
在 (2) => 当我尝试在某处输出 ffmpeg -i file.mp4 时:我得到“找不到 moov atom”,因此 (2) 无法读取或打开 (1)。
我错过了什么
在 (1) -movflags +faststart似乎无法解决问题
••••••• 编辑:上下文的更多细节••••••
我正在使用 openvidu:webrtc 与 kurento 和 coturn。
聊天进行时,记录功能会即时创建一个 .mp4 文件。
要开始录制,我可以对我的服务器进行 API 调用,当所有用户离开聊天室或进行其他 api 调用停止时,它会自动停止。在此链接中查看合成视频 https://docs.openvidu.io/en/2.17.0/advanced-features/recording/
openvidu 也有 webhook。
我的问题不是如何停止 ffmpeg,而是在“动态”生成 mp4 或其他文件时让 FFMPEG 进行编码。
有 2 个选项:
选项 1:个人 => 1 .webm per camare => 这个 .webm ffmpeg 可以重新流式传输为 hls 或 RTMP => 它正在工作。
选项2:**但问题在于“组合”视频=>它使用ffmpeg来x11grab session ......但它是没有moov ato的mp4,所以ffmpeg对此不做任何事情。
在此处查看composed.sh 脚本
https://github.com/OpenVidu/openvidu/blob/master/openvidu-server/docker/openvidu-recording/scripts/composed.sh
***************** 编辑 3 *************
在 .sh 中,这是创建 mp4 的部分
ffmpeg -y -f alsa -i 脉冲 -f x11grab -draw_mouse 0
-framerate $FRAMERATE -video_size $RESOLUTION -i :$DISPLAY_NUM
-c:a aac -c:v libx264 -preset ultrafast
-crf 28 -refs 4 -qmin 4 -pix_fmt yuv420p
-filter:v fps=$FRAMERATE "/recordings/$VIDEO_ID/$VIDEO_NAME.$VIDEO_FORMAT"
我怎样才能修改它以获得更好的结果示例 VP8 或 VP9 具有良好的质量 .webm 以便 ffpmeg 第二个命令(2)可以对其进行实时编码......
**** 编辑 4 ********
我试过这个它工作了30秒然后突然停止了
    <./stop ffmpeg -y -f alsa -i pulse -f 
x11grab -draw_mouse 0 -framerate $FRAMERATE
-video_size $RESOLUTION -i :$DISPLAY_NUM
-c:v libx264 -b:v 1396k -b:a 128k -ar 44100 -maxrate 1369k
-pix_fmt yuv420p -preset veryfast -tune zerolatency
-c:a aac -ac 2 -profile:v main -flags -global_header
-bufsize 969k -hls_time 1 -hls_list_size 0 -g 30
-start_number 0 -streaming 1 -hls_playlist 1
-lhls 1 -hls_playlist_type event -f hls "/recordings/$VIDEO_ID/$VIDEO_NAME".m3u8


N: [pulseaudio] main.c: Running in system mode, forcibly disabling SHM mode.
N: [pulseaudio] main.c: Running in system mode, forcibly disabling exit idle time.
Display in use -> :99
----------------------------------------
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
Guessed Channel Layout for Input Stream #0.0 : stereo
Input #0, alsa, from 'pulse':
Duration: N/A, start: 1617150428.783763, bitrate: 1536 kb/s
Stream #0:0: Audio: pcm_s16le, 48000 Hz, stereo, s16, 1536 kb/s
[x11grab @ 0x55e88a4e8780] Stream #0: not enough frames to estimate rate; consider increasing probesize
Input #1, x11grab, from ':99':
Duration: N/A, start: 1617150428.837799, bitrate: N/A
Stream #1:0: Video: rawvideo (BGR[0] / 0x524742), bgr0, 1920x1080, 30 fps, 1000k tbr, 1000k tbn, 1000k tbc
Stream mapping:
Stream #1:0 -> #0:0 (rawvideo (native) -> h264 (libx264))
Stream #0:0 -> #0:1 (pcm_s16le (native) -> aac (native))
Press [q] to stop, [?] for help
[libx264 @ 0x55e88a4f70c0] max bitrate less than average bitrate, assuming CBR
[libx264 @ 0x55e88a4f70c0] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2 AVX512
[libx264 @ 0x55e88a4f70c0] profile Main, level 4.0
[alsa @ 0x55e88a4c2e40] Thread message queue blocking; consider raising the thread_queue_size option (current value: 8)
[hls @ 0x55e88a4f3040] Opening '/recordings/13391978436095-2/rec133903625619940.ts' for writing
Output #0, hls, to '/recordings/13391978436095-2/rec13390362561994.m3u8':
Metadata:
encoder : Lavf58.29.100
Stream #0:0: Video: h264 (libx264), yuv420p(progressive), 1920x1080, q=-1--1, 1396 kb/s, 30 fps, 90k tbn, 30 tbc
Metadata:
encoder : Lavc58.54.100 libx264
Side data:
cpb: bitrate max/min/avg: 1369000/0/1396000 buffer size: 969000 vbv_delay: -1
Stream #0:1: Audio: aac (LC), 44100 Hz, stereo, fltp, 128 kb/s
Metadata:
encoder : Lavc58.54.100 aac
frame= 16 fps=0.0 q=21.0 size=N/A time=00:00:00.53 bitrate=N/A speed=1.06x
frame= 31 fps= 31 q=16.0 size=N/A time=00:00:01.03 bitrate=N/A speed=1.02x
[hls @ 0x55e88a4f3040] Opening '/recordings/13391978436095-2/rec13390362561994.m3u8.tmp' for writing
[hls @ 0x55e88a4f3040] Opening '/recordings/13391978436095-2/rec133903625619941.ts' for writing
frame= 47 fps= 31 q=21.0 size=N/A time=00:00:01.56 bitrate=N/A speed=1.03x
frame= 62 fps= 30 q=22.0 size=N/A time=00:00:02.06 bitrate=N/A speed=1.02x
[hls @ 0x55e88a4f3040] Opening '/recordings/13391978436095-2/rec13390362561994.m3u8.tmp' for writing
[hls @ 0x55e88a4f3040] Opening '/recordings/13391978436095-2/rec133903625619942.ts' for writing
frame= 77 fps= 30 q=24.0 size=N/A time=00:00:02.56 bitrate=N/A speed=1.01x
frame= 92 fps= 30 q=22.0 size=N/A time=00:00:03.06 bitrate=N/A speed=0.999x
[hls @ 0x55e88a4f3040] Opening '/recordings/13391978436095-2/rec13390362561994.m3u8.tmp' for writing
[hls @ 0x55e88a4f3040] Opening '/recordings/13391978436095-2/rec133903625619943.ts' for writing
frame= 108 fps= 30 q=29.0 size=N/A time=00:00:03.60 bitrate=N/A speed= 1x
frame= 124 fps= 30 q=21.0 size=N/A time=00:00:04.13 bitrate=N/A speed=1.01x
[hls @ 0x55e88a4f3040] Opening '/recordings/13391978436095-2/rec13390362561994.m3u8.tmp' for writing
[hls @ 0x55e88a4f3040] Opening '/recordings/13391978436095-2/rec133903625619944.ts' for writing
frame= 139 fps= 30 q=20.0 size=N/A time=00:00:04.63 bitrate=N/A speed=1.01x
frame= 154 fps= 30 q=18.0 size=N/A time=00:00:05.13 bitrate=N/A speed= 1x
[hls @ 0x55e88a4f3040] Opening '/recordings/13391978436095-2/rec13390362561994.m3u8.tmp' for writing
[hls @ 0x55e88a4f3040] Opening '/recordings/13391978436095-2/rec133903625619945.ts' for writing
frame= 169 fps= 30 q=19.0 size=N/A time=00:00:05.63 bitrate=N/A speed= 1x
frame= 185 fps= 30 q=19.0 size=N/A time=00:00:06.16 bitrate=N/A speed=1.01x
[hls @ 0x55e88a4f3040] Opening '/recordings/13391978436095-2/rec13390362561994.m3u8.tmp' for writing
[hls @ 0x55e88a4f3040] Opening '/recordings/13391978436095-2/rec133903625619946.ts' for writing
frame= 199 fps= 30 q=20.0 size=N/A time=00:00:06.63 bitrate=N/A speed= 1x
frame= 215 fps= 30 q=19.0 size=N/A time=00:00:07.16 bitrate=N/A speed= 1x
[hls @ 0x55e88a4f3040] Opening '/recordings/13391978436095-2/rec13390362561994.m3u8.tmp' for writing
[hls @ 0x55e88a4f3040] Opening '/recordings/13391978436095-2/rec133903625619947.ts' for writing
frame= 230 fps= 30 q=19.0 size=N/A time=00:00:07.66 bitrate=N/A speed= 1x
frame= 242 fps= 30 q=18.0 size=N/A time=00:00:08.06 bitrate=N/A speed=0.99x
frame= 254 fps= 29 q=17.0 size=N/A time=00:00:08.46 bitrate=N/A speed=0.979x
[hls @ 0x55e88a4f3040] Opening '/recordings/13391978436095-2/rec13390362561994.m3u8.tmp' for writing
[hls @ 0x55e88a4f3040] Opening '/recordings/13391978436095-2/rec133903625619948.ts' for writing
frame= 276 fps= 30 q=17.0 size=N/A time=00:00:09.20 bitrate=N/A speed=1.01x
[hls @ 0x55e88a4f3040] Opening '/recordings/13391978436095-2/rec13390362561994.m3u8.tmp' for writing
[hls @ 0x55e88a4f3040] Opening '/recordings/13391978436095-2/rec133903625619949.ts' for writing
frame= 290 fps= 30 q=21.0 size=N/A time=00:00:09.66 bitrate=N/A speed= 1x
[hls @ 0x55e88a4f3040] Opening '/recordings/13391978436095-2/rec13390362561994.m3u8.tmp' for writing
[hls @ 0x55e88a4f3040] Opening '/recordings/13391978436095-2/rec1339036256199410.ts' for writing
frame= 306 fps= 30 q=31.0 size=N/A time=00:00:10.20 bitrate=N/A speed= 1x
frame= 322 fps= 30 q=21.0 size=N/A time=00:00:10.73 bitrate=N/A speed= 1x
[hls @ 0x55e88a4f3040] Opening '/recordings/13391978436095-2/rec13390362561994.m3u8.tmp' for writing
[hls @ 0x55e88a4f3040] Opening '/recordings/13391978436095-2/rec1339036256199411.ts' for writing
frame= 337 fps= 30 q=21.0 size=N/A time=00:00:11.23 bitrate=N/A speed= 1x
frame= 352 fps= 30 q=19.0 size=N/A time=00:00:11.73 bitrate=N/A speed= 1x
[hls @ 0x55e88a4f3040] Opening '/recordings/13391978436095-2/rec13390362561994.m3u8.tmp' for writing
[hls @ 0x55e88a4f3040] Opening '/recordings/13391978436095-2/rec1339036256199412.ts' for writing
frame= 367 fps= 30 q=19.0 size=N/A time=00:00:12.23 bitrate=N/A speed= 1x
frame= 382 fps= 30 q=18.0 size=N/A time=00:00:12.73 bitrate=N/A speed= 1x
[hls @ 0x55e88a4f3040] Opening '/recordings/13391978436095-2/rec13390362561994.m3u8.tmp' for writing
[hls @ 0x55e88a4f3040] Opening '/recordings/13391978436095-2/rec1339036256199413.ts' for writing
frame= 397 fps= 30 q=18.0 size=N/A time=00:00:13.23 bitrate=N/A speed= 1x
frame= 412 fps= 30 q=18.0 size=N/A time=00:00:13.73 bitrate=N/A speed= 1x
[hls @ 0x55e88a4f3040] Opening '/recordings/13391978436095-2/rec13390362561994.m3u8.tmp' for writing
[hls @ 0x55e88a4f3040] Opening '/recordings/13391978436095-2/rec1339036256199414.ts' for writing
frame= 428 fps= 30 q=18.0 size=N/A time=00:00:14.26 bitrate=N/A speed= 1x
frame= 443 fps= 30 q=17.0 size=N/A time=00:00:14.76 bitrate=N/A speed= 1x
[hls @ 0x55e88a4f3040] Opening '/recordings/13391978436095-2/rec13390362561994.m3u8.tmp' for writing
[hls @ 0x55e88a4f3040] Opening '/recordings/13391978436095-2/rec1339036256199415.ts' for writing
frame= 458 fps= 30 q=18.0 size=N/A time=00:00:15.26 bitrate=N/A speed= 1x
frame= 474 fps= 30 q=17.0 size=N/A time=00:00:15.80 bitrate=N/A speed= 1x
[hls @ 0x55e88a4f3040] Opening '/recordings/13391978436095-2/rec13390362561994.m3u8.tmp' for writing
[hls @ 0x55e88a4f3040] Opening '/recordings/13391978436095-2/rec1339036256199416.ts' for writing
frame= 489 fps= 30 q=18.0 size=N/A time=00:00:16.30 bitrate=N/A speed= 1x
frame= 504 fps= 30 q=17.0 size=N/A time=00:00:16.80 bitrate=N/A speed= 1x
[hls @ 0x55e88a4f3040] Opening '/recordings/13391978436095-2/rec13390362561994.m3u8.tmp' for writing
[hls @ 0x55e88a4f3040] Opening '/recordings/13391978436095-2/rec1339036256199417.ts' for writing
frame= 520 fps= 30 q=20.0 size=N/A time=00:00:17.33 bitrate=N/A speed= 1x
frame= 535 fps= 30 q=18.0 size=N/A time=00:00:17.83 bitrate=N/A speed= 1x
[hls @ 0x55e88a4f3040] Opening '/recordings/13391978436095-2/rec13390362561994.m3u8.tmp' for writing
[hls @ 0x55e88a4f3040] Opening '/recordings/13391978436095-2/rec1339036256199418.ts' for writing
frame= 551 fps= 30 q=20.0 size=N/A time=00:00:18.36 bitrate=N/A speed= 1x
frame= 566 fps= 30 q=19.0 size=N/A time=00:00:18.86 bitrate=N/A speed= 1x
[hls @ 0x55e88a4f3040] Opening '/recordings/13391978436095-2/rec13390362561994.m3u8.tmp' for writing
[hls @ 0x55e88a4f3040] Opening '/recordings/13391978436095-2/rec1339036256199419.ts' for writing
frame= 581 fps= 30 q=20.0 size=N/A time=00:00:19.36 bitrate=N/A speed= 1x
frame= 596 fps= 30 q=19.0 size=N/A time=00:00:19.86 bitrate=N/A speed= 1x
[hls @ 0x55e88a4f3040] Opening '/recordings/13391978436095-2/rec13390362561994.m3u8.tmp' for writing
[hls @ 0x55e88a4f3040] Opening '/recordings/13391978436095-2/rec1339036256199420.ts' for writing
frame= 612 fps= 30 q=21.0 size=N/A time=00:00:20.40 bitrate=N/A speed= 1x
frame= 626 fps= 30 q=20.0 size=N/A time=00:00:20.86 bitrate=N/A speed= 1x
[hls @ 0x55e88a4f3040] Opening '/recordings/13391978436095-2/rec13390362561994.m3u8.tmp' for writing
[hls @ 0x55e88a4f3040] Opening '/recordings/13391978436095-2/rec1339036256199421.ts' for writing
frame= 641 fps= 30 q=21.0 size=N/A time=00:00:21.37 bitrate=N/A speed= 1x
frame= 657 fps= 30 q=35.0 size=N/A time=00:00:21.90 bitrate=N/A speed= 1x
[hls @ 0x55e88a4f3040] Opening '/recordings/13391978436095-2/rec13390362561994.m3u8.tmp' for writing
[hls @ 0x55e88a4f3040] Opening '/recordings/13391978436095-2/rec1339036256199422.ts' for writing
frame= 672 fps= 30 q=33.0 size=N/A time=00:00:22.40 bitrate=N/A speed= 1x
frame= 687 fps= 30 q=23.0 size=N/A time=00:00:22.90 bitrate=N/A speed= 1x
[hls @ 0x55e88a4f3040] Opening '/recordings/13391978436095-2/rec13390362561994.m3u8.tmp' for writing
[hls @ 0x55e88a4f3040] Opening '/recordings/13391978436095-2/rec1339036256199423.ts' for writing
frame= 703 fps= 30 q=23.0 size=N/A time=00:00:23.43 bitrate=N/A speed= 1x
frame= 718 fps= 30 q=25.0 size=N/A time=00:00:23.93 bitrate=N/A speed= 1x
[hls @ 0x55e88a4f3040] Opening '/recordings/13391978436095-2/rec13390362561994.m3u8.tmp' for writing
[hls @ 0x55e88a4f3040] Opening '/recordings/13391978436095-2/rec1339036256199424.ts' for writing
frame= 733 fps= 30 q=27.0 size=N/A time=00:00:24.44 bitrate=N/A speed= 1x
frame= 749 fps= 30 q=26.0 size=N/A time=00:00:24.96 bitrate=N/A speed= 1x
[hls @ 0x55e88a4f3040] Opening '/recordings/13391978436095-2/rec13390362561994.m3u8.tmp' for writing
[hls @ 0x55e88a4f3040] Opening '/recordings/13391978436095-2/rec1339036256199425.ts' for writing
frame= 764 fps= 30 q=28.0 size=N/A time=00:00:25.46 bitrate=N/A speed= 1x
frame= 780 fps= 30 q=27.0 size=N/A time=00:00:26.00 bitrate=N/A speed= 1x
[hls @ 0x55e88a4f3040] Opening '/recordings/13391978436095-2/rec13390362561994.m3u8.tmp' for writing
[hls @ 0x55e88a4f3040] Opening '/recordings/13391978436095-2/rec1339036256199426.ts' for writing
frame= 795 fps= 30 q=27.0 size=N/A time=00:00:26.50 bitrate=N/A speed= 1x
frame= 810 fps= 30 q=26.0 size=N/A time=00:00:27.00 bitrate=N/A speed= 1x
[hls @ 0x55e88a4f3040] Opening '/recordings/13391978436095-2/rec13390362561994.m3u8.tmp' for writing
[hls @ 0x55e88a4f3040] Opening '/recordings/13391978436095-2/rec1339036256199427.ts' for writing
frame= 825 fps= 30 q=29.0 size=N/A time=00:00:27.50 bitrate=N/A speed= 1x
[hls @ 0x55e88a4f3040] Opening '/recordings/13391978436095-2/rec13390362561994.m3u8.tmp' for writing
frame= 840 fps= 30 q=30.0 Lsize=N/A time=00:00:28.01 bitrate=N/A speed= 1x
video:4635kB audio:404kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
[libx264 @ 0x55e88a4f70c0] frame I:42 Avg QP:12.88 size: 28020
[libx264 @ 0x55e88a4f70c0] frame P:798 Avg QP:13.11 size: 4473
[libx264 @ 0x55e88a4f70c0] mb I I16..4: 88.4% 0.0% 11.6%
[libx264 @ 0x55e88a4f70c0] mb P I16..4: 6.6% 0.0% 0.4% P16..4: 6.6% 1.9% 0.6% 0.0% 0.0% skip:83.8%
[libx264 @ 0x55e88a4f70c0] coded y,uvDC,uvAC intra: 18.8% 20.1% 10.1% inter: 1.7% 2.4% 0.1%
[libx264 @ 0x55e88a4f70c0] i16 v,h,dc,p: 55% 30% 12% 4%
[libx264 @ 0x55e88a4f70c0] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 29% 27% 31% 2% 3% 2% 2% 1% 2%
[libx264 @ 0x55e88a4f70c0] i8c dc,h,v,p: 77% 9% 12% 1%
[libx264 @ 0x55e88a4f70c0] Weighted P-Frames: Y:1.1% UV:0.1%
[libx264 @ 0x55e88a4f70c0] kb/s:1355.98
[aac @ 0x55e88a4f8440] Qavg: 40876.258
jq: error (at <stdin>:1): Cannot iterate over null (null)
jq: error (at <stdin>:1): Cannot iterate over null (null)
jq: error (at <stdin>:1): null (null) cannot be parsed as a number
jq: error (at <stdin>:1): null (null) cannot be parsed as a number
jq: error: syntax error, unexpected '|' (Unix shell quoting issues?) at <top-level>, line 1:
.hasAudio=false | .hasVideo=false | .duration= | .size= | .status="failed"
jq: 1 compile error
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
Invalid duration specification for ss: -i
***** 编辑 5 *****
不管我选择什么格式,它会在 20 到 30 秒后停止。
与 .webm .mov .264 相同的行当它不是 .mp4 时 ffmpeg 似乎下降了

最佳答案

通过这些更改,我能够实现 3 到 4 个稳定的延迟;)
第 79 行
https://github.com/OpenVidu/openvidu/blob/master/openvidu-server/docker/openvidu-recording/scripts/composed.sh
我更换了

-c:a aac -c:v libx264 -preset ultrafast -crf 28 -refs 4 -qmin 4 -pix_fmt yuv420p
-c:a aac -c:v libx264 -movflags +dash 
-preset ultrafast -crf 28 -refs 4 -qmin 4
-pix_fmt yuv420p -tune zerolatency -c:a aac -ac 2
-profile:v main -flags -global_header
-bufsize 969k -hls_time 2 -hls_list_size 0 -g 30
-start_number 0 -streaming 1 -hls_playlist 1
-lhls 1 -hls_playlist_type event -f hls
笔记 -movflags +dash => 以某种方式有所帮助(我没有完整的解释,但我注意到有一点帮助......) -tune zerolatency =>为流媒体制作的ffmpeg x264预设 -profile:v main => profile main 也专门用于流式传输 -lhls 1 => 启用低延迟 HLS
***** 我还必须等待 MP4 出现才能在 M3U8 中创建一个 SYMLINC 才能在 safari 中播放
while [ ! -f __path_to.mp4 ] ; do sleep 1 ; done ; ln -s __path_to.mp4 __path_to.m3u8;
********** 在这种特殊情况下的重要说明:ffmpeg 最终扩展名必须保留为 .mp4 因为如果我将其更改为 .m3u8 ===>> 我真的不知道为什么,但它停止了几秒钟后(可能是因为 x11grab ???)
••••• 播放器代码见: hls.js starting a beginning with ANDROID mobile (chrome, webview also) and not live *** but works very nice in deskto, ios .. hls.js 1.0.0 2021-04-01

关于ffmpeg x11grab 转为流式格式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66837454/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com