Apache mpm 事件共享内存错误 - ffmpeg-python 打开输出流编码器时出错 #0:1 当被多个实例访问时
Apache mpm event shared memory error - ffmpeg-python Error while opening encoder for output stream #0:1 when accessed by multiple instances
编辑:
我有点明白了,问题需要处理 apache mpm 事件...当我在第一个客户端上发送请求时,我的脚本是线性执行的。当我从第二个客户端发送我的请求时,他实际上是从代码中最后一个请求当前所在的那一点开始的。所以这可能是这些线程之间共享内存的问题,但我不是 apache 专家,也许有人有想法?
我以前用过 apache mpm prefork,所以每个请求都有自己的进程和自己的内存等,但是用那个读取 jpg 文件时出现问题,在我将 apache 更改为 mpm 事件后它起作用了,请参见以下内容:https://github.com/python-pillow/Pillow/issues/5834#issue-comment-box
在我的 VM 中(运行 与 mpm 事件相同的 apache 版本)一切正常。
我在 apache2 网络服务器上通过 wsgi 获得了一个带有 flask 运行 的 python 脚本。在该脚本中,我得到以下几行 (458-461):
video_stream = ffmpeg.input(pathToVideo)
audio_file = ffmpeg.input(pathToAudio)
ffmpeg.concat(video_stream, audio_file, v=1, a=1).output(
pathToOutVid).run()
因此,该代码片段在单击按钮时成功地将我的视频和音频文件合并为一个新的视频文件。
当我从 2 个客户端 访问网页并启动该脚本时,我的 问题 就开始了。两者都有不同的输入音视频文件和不同的输出文件,但是当它们同时运行时,其中一个通过成功,另一个客户端得到以下错误:
ffmpeg version 3.4.8-0ubuntu0.2 Copyright (c) 2000-2020 the FFmpeg developers
built with gcc 7 (Ubuntu 7.5.0-3ubuntu1~18.04)
configuration: --prefix=/usr --extra-version=0ubuntu0.2 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --enable-gpl --disable-stripping --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librubberband --enable-librsvg --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libopencv --enable-libx264 --enable-shared
libavutil 55. 78.100 / 55. 78.100
libavcodec 57.107.100 / 57.107.100
libavformat 57. 83.100 / 57. 83.100
libavdevice 57. 10.100 / 57. 10.100
libavfilter 6.107.100 / 6.107.100
libavresample 3. 7. 0 / 3. 7. 0
libswscale 4. 8.100 / 4. 8.100
libswresample 2. 9.100 / 2. 9.100
libpostproc 54. 7.100 / 54. 7.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/path/to/movie.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf57.83.100
Duration: 00:00:11.50, start: 0.000000, bitrate: 1053 kb/s
Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1920x1080, 1050 kb/s, 30 fps, 30 tbr, 15360 tbn, 60 tbc (default)
Metadata:
handler_name : VideoHandler
Input #1, mp3, from '/path/to/audio.mp3':
Metadata:
encoder : Lavf57.83.100
Duration: 00:00:11.55, start: 0.025057, bitrate: 128 kb/s
Stream #1:0: Audio: mp3, 44100 Hz, stereo, s16p, 128 kb/s
Metadata:
encoder : Lavc57.10
Stream mapping:
Stream #0:0 (h264) -> concat:in0:v0
Stream #1:0 (mp3) -> concat:in0:a0
concat:out:a0 -> Stream #0:0 (aac)
concat:out:v0 -> Stream #0:1 (libx264)
Press [q] to stop, [?] for help
[libx264 @ 0x56011ee5cbc0] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX
Error initializing output stream 0:1 -- Error while opening encoder for output stream #0:1 - maybe incorrect parameters such as bit_rate, rate, width or height
[aac @ 0x56011ee5b260] Qavg: -nan
Conversion failed!
但是在没有另一个并行的情况下在同一个客户端上执行该部分也可以正常工作,输出如下:
ffmpeg version 3.4.8-0ubuntu0.2 Copyright (c) 2000-2020 the FFmpeg developers
built with gcc 7 (Ubuntu 7.5.0-3ubuntu1~18.04)
configuration: --prefix=/usr --extra-version=0ubuntu0.2 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --enable-gpl --disable-stripping --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librubberband --enable-librsvg --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libopencv --enable-libx264 --enable-shared
libavutil 55. 78.100 / 55. 78.100
libavcodec 57.107.100 / 57.107.100
libavformat 57. 83.100 / 57. 83.100
libavdevice 57. 10.100 / 57. 10.100
libavfilter 6.107.100 / 6.107.100
libavresample 3. 7. 0 / 3. 7. 0
libswscale 4. 8.100 / 4. 8.100
libswresample 2. 9.100 / 2. 9.100
libpostproc 54. 7.100 / 54. 7.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/path/to/movie.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf57.83.100
Duration: 00:00:11.50, start: 0.000000, bitrate: 1053 kb/s
Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1920x1080, 1050 kb/s, 30 fps, 30 tbr, 15360 tbn, 60 tbc (default)
Metadata:
handler_name : VideoHandler
Input #1, mp3, from '/path/to/audio.mp3':
Metadata:
encoder : Lavf57.83.100
Duration: 00:00:11.55, start: 0.025057, bitrate: 128 kb/s
Stream #1:0: Audio: mp3, 44100 Hz, stereo, s16p, 128 kb/s
Metadata:
encoder : Lavc57.10
Stream mapping:
Stream #0:0 (h264) -> concat:in0:v0
Stream #1:0 (mp3) -> concat:in0:a0
concat:out:a0 -> Stream #0:0 (aac)
concat:out:v0 -> Stream #0:1 (libx264)
Press [q] to stop, [?] for help
[libx264 @ 0x55ae2ada7bc0] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX
[libx264 @ 0x55ae2ada7bc0] profile High, level 4.0
[libx264 @ 0x55ae2ada7bc0] 264 - core 152 r2854 e9a5903 - H.264/MPEG-4 AVC codec - Copyleft 2003-2017 - 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=9 lookahead_threads=1 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=25 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, mp4, to '/path/to/movie-WITH-AUDIO.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf57.83.100
Stream #0:0: Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 128 kb/s (default)
Metadata:
encoder : Lavc57.107.100 aac
Stream #0:1: Video: h264 (libx264) (avc1 / 0x31637661), yuv420p, 1920x1080, q=-1--1, 30 fps, 15360 tbn, 30 tbc (default)
Metadata:
encoder : Lavc57.107.100 libx264
Side data:
cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
frame= 42 fps=0.0 q=0.0 size= 0kB time=00:00:01.34 bitrate= 0.0kbits/s speed=2.68x
frame= 46 fps= 39 q=0.0 size= 0kB time=00:00:01.48 bitrate= 0.0kbits/s speed=1.25x
frame= 57 fps= 34 q=29.0 size= 0kB time=00:00:01.85 bitrate= 0.2kbits/s speed= 1.1x
frame= 70 fps= 30 q=29.0 size= 0kB time=00:00:02.25 bitrate= 0.2kbits/s speed=0.966x
frame= 82 fps= 28 q=29.0 size= 256kB time=00:00:02.69 bitrate= 778.7kbits/s speed=0.927x
frame= 92 fps= 26 q=29.0 size= 256kB time=00:00:03.01 bitrate= 694.9kbits/s speed=0.868x
frame= 102 fps= 25 q=29.0 size= 256kB time=00:00:03.34 bitrate= 627.3kbits/s speed=0.831x
frame= 114 fps= 25 q=29.0 size= 512kB time=00:00:03.71 bitrate=1129.1kbits/s speed=0.81x
frame= 134 fps= 26 q=29.0 size= 512kB time=00:00:04.41 bitrate= 950.8kbits/s speed=0.864x
frame= 152 fps= 27 q=29.0 size= 512kB time=00:00:05.01 bitrate= 836.3kbits/s speed=0.886x
frame= 169 fps= 27 q=29.0 size= 512kB time=00:00:05.59 bitrate= 749.6kbits/s speed=0.902x
frame= 189 fps= 28 q=29.0 size= 512kB time=00:00:06.22 bitrate= 674.1kbits/s speed=0.927x
frame= 203 fps= 28 q=29.0 size= 768kB time=00:00:06.71 bitrate= 937.6kbits/s speed=0.912x
frame= 215 fps= 27 q=29.0 size= 1024kB time=00:00:07.10 bitrate=1180.7kbits/s speed=0.885x
frame= 240 fps= 28 q=29.0 size= 1024kB time=00:00:07.94 bitrate=1056.4kbits/s speed=0.921x
frame= 258 fps= 28 q=29.0 size= 1024kB time=00:00:08.52 bitrate= 984.4kbits/s speed=0.934x
frame= 281 fps= 29 q=29.0 size= 1024kB time=00:00:09.28 bitrate= 903.2kbits/s speed=0.965x
frame= 302 fps= 30 q=29.0 size= 1024kB time=00:00:09.98 bitrate= 840.2kbits/s speed=0.984x
frame= 318 fps= 30 q=29.0 size= 1280kB time=00:00:10.54 bitrate= 994.7kbits/s speed=0.989x
frame= 335 fps= 30 q=29.0 size= 1280kB time=00:00:11.12 bitrate= 942.8kbits/s speed=0.989x
frame= 345 fps= 27 q=-1.0 Lsize= 1765kB time=00:00:11.51 bitrate=1255.3kbits/s speed=0.887x
video:1569kB audio:183kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.768725%
[aac @ 0x55ae2ada6260] Qavg: 1450.385
[libx264 @ 0x55ae2ada7bc0] frame I:2 Avg QP:11.26 size: 96372
[libx264 @ 0x55ae2ada7bc0] frame P:99 Avg QP:18.02 size: 11184
[libx264 @ 0x55ae2ada7bc0] frame B:244 Avg QP:17.15 size: 1253
[libx264 @ 0x55ae2ada7bc0] consecutive B-frames: 2.6% 8.1% 3.5% 85.8%
[libx264 @ 0x55ae2ada7bc0] mb I I16..4: 54.0% 36.8% 9.2%
[libx264 @ 0x55ae2ada7bc0] mb P I16..4: 1.7% 8.2% 0.2% P16..4: 16.8% 2.9% 2.6% 0.0% 0.0% skip:67.7%
[libx264 @ 0x55ae2ada7bc0] mb B I16..4: 0.3% 0.3% 0.0% B16..8: 8.1% 0.2% 0.1% direct: 1.8% skip:89.2% L0:35.2% L1:62.5% BI: 2.3%
[libx264 @ 0x55ae2ada7bc0] 8x8 transform intra:71.5% inter:83.8%
[libx264 @ 0x55ae2ada7bc0] coded y,uvDC,uvAC intra: 18.8% 23.1% 7.1% inter: 2.4% 6.6% 0.1%
[libx264 @ 0x55ae2ada7bc0] i16 v,h,dc,p: 62% 22% 7% 8%
[libx264 @ 0x55ae2ada7bc0] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 33% 16% 41% 1% 1% 1% 2% 1% 2%
[libx264 @ 0x55ae2ada7bc0] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 18% 25% 12% 6% 8% 6% 11% 6% 8%
[libx264 @ 0x55ae2ada7bc0] i8c dc,h,v,p: 72% 14% 12% 1%
[libx264 @ 0x55ae2ada7bc0] Weighted P-Frames: Y:53.5% UV:48.5%
[libx264 @ 0x55ae2ada7bc0] ref P L0: 75.9% 11.4% 10.0% 2.4% 0.3%
[libx264 @ 0x55ae2ada7bc0] ref B L0: 89.7% 9.5% 0.8%
[libx264 @ 0x55ae2ada7bc0] ref B L1: 97.9% 2.1%
[libx264 @ 0x55ae2ada7bc0] kb/s:1117.06
我试图在我的虚拟机中重现此错误 运行 相同的 Ubuntu 18.04 版本,具有 mpm 事件的相同 apache 版本,相同的 python 版本,相同的 ffmpeg-python 版本和 ffmpeg 版本,但在我的本地主机 VM 上,一切正常,没有任何问题。
现在我需要帮助,因为我不知道为什么这个编码器无法打开(当另一个正在使用它时?-但我的 VM 没有问题?)
如果有帮助,我也使用 opencv 并使用 h264 编码器获得以下部分:
video = cv.VideoWriter(output, cv.VideoWriter_fourcc('a', 'v', 'c', '1'), 30, 1920, 1080))
编写此视频的程序部分通常需要很长时间,如果这些知识有帮助的话,但此时多个客户端使用它时编码器没有问题。
我真的希望有人能帮助我,我感谢你为我投入的时间,谢谢!
如果我忘记发送东西或者我需要提供更详细的信息或任何东西,请给我发短信 :)
版本
- Ubuntu 18.04 LTS
- Apache/2.4.29
- ffmpeg 版本 3.4.8-0ubuntu0.2
- Python 3.6.9
- 烧瓶 2.0.2
- opencv 3.4.1
- ffmpeg-python 0.2.0
好吧,看在上帝的份上,我已经完成了...需要 4 天的时间让这个 **** 找到答案,我激活了一个 apache mod (fcgid),它从字面上分配了每一行您的代码到单个线程...所以我停用了那个线程,现在它可以正常工作...
简而言之 - 我做了什么:
a2dismod fcgid
systemctl restart apache2
现在可以使用了。
感谢 @Rotem 的帮助!对于那个奇怪的问题和我自己的愚蠢感到抱歉...
编辑:
我有点明白了,问题需要处理 apache mpm 事件...当我在第一个客户端上发送请求时,我的脚本是线性执行的。当我从第二个客户端发送我的请求时,他实际上是从代码中最后一个请求当前所在的那一点开始的。所以这可能是这些线程之间共享内存的问题,但我不是 apache 专家,也许有人有想法?
我以前用过 apache mpm prefork,所以每个请求都有自己的进程和自己的内存等,但是用那个读取 jpg 文件时出现问题,在我将 apache 更改为 mpm 事件后它起作用了,请参见以下内容:https://github.com/python-pillow/Pillow/issues/5834#issue-comment-box
在我的 VM 中(运行 与 mpm 事件相同的 apache 版本)一切正常。
我在 apache2 网络服务器上通过 wsgi 获得了一个带有 flask 运行 的 python 脚本。在该脚本中,我得到以下几行 (458-461):
video_stream = ffmpeg.input(pathToVideo)
audio_file = ffmpeg.input(pathToAudio)
ffmpeg.concat(video_stream, audio_file, v=1, a=1).output(
pathToOutVid).run()
因此,该代码片段在单击按钮时成功地将我的视频和音频文件合并为一个新的视频文件。 当我从 2 个客户端 访问网页并启动该脚本时,我的 问题 就开始了。两者都有不同的输入音视频文件和不同的输出文件,但是当它们同时运行时,其中一个通过成功,另一个客户端得到以下错误:
ffmpeg version 3.4.8-0ubuntu0.2 Copyright (c) 2000-2020 the FFmpeg developers
built with gcc 7 (Ubuntu 7.5.0-3ubuntu1~18.04)
configuration: --prefix=/usr --extra-version=0ubuntu0.2 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --enable-gpl --disable-stripping --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librubberband --enable-librsvg --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libopencv --enable-libx264 --enable-shared
libavutil 55. 78.100 / 55. 78.100
libavcodec 57.107.100 / 57.107.100
libavformat 57. 83.100 / 57. 83.100
libavdevice 57. 10.100 / 57. 10.100
libavfilter 6.107.100 / 6.107.100
libavresample 3. 7. 0 / 3. 7. 0
libswscale 4. 8.100 / 4. 8.100
libswresample 2. 9.100 / 2. 9.100
libpostproc 54. 7.100 / 54. 7.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/path/to/movie.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf57.83.100
Duration: 00:00:11.50, start: 0.000000, bitrate: 1053 kb/s
Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1920x1080, 1050 kb/s, 30 fps, 30 tbr, 15360 tbn, 60 tbc (default)
Metadata:
handler_name : VideoHandler
Input #1, mp3, from '/path/to/audio.mp3':
Metadata:
encoder : Lavf57.83.100
Duration: 00:00:11.55, start: 0.025057, bitrate: 128 kb/s
Stream #1:0: Audio: mp3, 44100 Hz, stereo, s16p, 128 kb/s
Metadata:
encoder : Lavc57.10
Stream mapping:
Stream #0:0 (h264) -> concat:in0:v0
Stream #1:0 (mp3) -> concat:in0:a0
concat:out:a0 -> Stream #0:0 (aac)
concat:out:v0 -> Stream #0:1 (libx264)
Press [q] to stop, [?] for help
[libx264 @ 0x56011ee5cbc0] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX
Error initializing output stream 0:1 -- Error while opening encoder for output stream #0:1 - maybe incorrect parameters such as bit_rate, rate, width or height
[aac @ 0x56011ee5b260] Qavg: -nan
Conversion failed!
但是在没有另一个并行的情况下在同一个客户端上执行该部分也可以正常工作,输出如下:
ffmpeg version 3.4.8-0ubuntu0.2 Copyright (c) 2000-2020 the FFmpeg developers
built with gcc 7 (Ubuntu 7.5.0-3ubuntu1~18.04)
configuration: --prefix=/usr --extra-version=0ubuntu0.2 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --enable-gpl --disable-stripping --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librubberband --enable-librsvg --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libopencv --enable-libx264 --enable-shared
libavutil 55. 78.100 / 55. 78.100
libavcodec 57.107.100 / 57.107.100
libavformat 57. 83.100 / 57. 83.100
libavdevice 57. 10.100 / 57. 10.100
libavfilter 6.107.100 / 6.107.100
libavresample 3. 7. 0 / 3. 7. 0
libswscale 4. 8.100 / 4. 8.100
libswresample 2. 9.100 / 2. 9.100
libpostproc 54. 7.100 / 54. 7.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/path/to/movie.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf57.83.100
Duration: 00:00:11.50, start: 0.000000, bitrate: 1053 kb/s
Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1920x1080, 1050 kb/s, 30 fps, 30 tbr, 15360 tbn, 60 tbc (default)
Metadata:
handler_name : VideoHandler
Input #1, mp3, from '/path/to/audio.mp3':
Metadata:
encoder : Lavf57.83.100
Duration: 00:00:11.55, start: 0.025057, bitrate: 128 kb/s
Stream #1:0: Audio: mp3, 44100 Hz, stereo, s16p, 128 kb/s
Metadata:
encoder : Lavc57.10
Stream mapping:
Stream #0:0 (h264) -> concat:in0:v0
Stream #1:0 (mp3) -> concat:in0:a0
concat:out:a0 -> Stream #0:0 (aac)
concat:out:v0 -> Stream #0:1 (libx264)
Press [q] to stop, [?] for help
[libx264 @ 0x55ae2ada7bc0] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX
[libx264 @ 0x55ae2ada7bc0] profile High, level 4.0
[libx264 @ 0x55ae2ada7bc0] 264 - core 152 r2854 e9a5903 - H.264/MPEG-4 AVC codec - Copyleft 2003-2017 - 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=9 lookahead_threads=1 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=25 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, mp4, to '/path/to/movie-WITH-AUDIO.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf57.83.100
Stream #0:0: Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 128 kb/s (default)
Metadata:
encoder : Lavc57.107.100 aac
Stream #0:1: Video: h264 (libx264) (avc1 / 0x31637661), yuv420p, 1920x1080, q=-1--1, 30 fps, 15360 tbn, 30 tbc (default)
Metadata:
encoder : Lavc57.107.100 libx264
Side data:
cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
frame= 42 fps=0.0 q=0.0 size= 0kB time=00:00:01.34 bitrate= 0.0kbits/s speed=2.68x
frame= 46 fps= 39 q=0.0 size= 0kB time=00:00:01.48 bitrate= 0.0kbits/s speed=1.25x
frame= 57 fps= 34 q=29.0 size= 0kB time=00:00:01.85 bitrate= 0.2kbits/s speed= 1.1x
frame= 70 fps= 30 q=29.0 size= 0kB time=00:00:02.25 bitrate= 0.2kbits/s speed=0.966x
frame= 82 fps= 28 q=29.0 size= 256kB time=00:00:02.69 bitrate= 778.7kbits/s speed=0.927x
frame= 92 fps= 26 q=29.0 size= 256kB time=00:00:03.01 bitrate= 694.9kbits/s speed=0.868x
frame= 102 fps= 25 q=29.0 size= 256kB time=00:00:03.34 bitrate= 627.3kbits/s speed=0.831x
frame= 114 fps= 25 q=29.0 size= 512kB time=00:00:03.71 bitrate=1129.1kbits/s speed=0.81x
frame= 134 fps= 26 q=29.0 size= 512kB time=00:00:04.41 bitrate= 950.8kbits/s speed=0.864x
frame= 152 fps= 27 q=29.0 size= 512kB time=00:00:05.01 bitrate= 836.3kbits/s speed=0.886x
frame= 169 fps= 27 q=29.0 size= 512kB time=00:00:05.59 bitrate= 749.6kbits/s speed=0.902x
frame= 189 fps= 28 q=29.0 size= 512kB time=00:00:06.22 bitrate= 674.1kbits/s speed=0.927x
frame= 203 fps= 28 q=29.0 size= 768kB time=00:00:06.71 bitrate= 937.6kbits/s speed=0.912x
frame= 215 fps= 27 q=29.0 size= 1024kB time=00:00:07.10 bitrate=1180.7kbits/s speed=0.885x
frame= 240 fps= 28 q=29.0 size= 1024kB time=00:00:07.94 bitrate=1056.4kbits/s speed=0.921x
frame= 258 fps= 28 q=29.0 size= 1024kB time=00:00:08.52 bitrate= 984.4kbits/s speed=0.934x
frame= 281 fps= 29 q=29.0 size= 1024kB time=00:00:09.28 bitrate= 903.2kbits/s speed=0.965x
frame= 302 fps= 30 q=29.0 size= 1024kB time=00:00:09.98 bitrate= 840.2kbits/s speed=0.984x
frame= 318 fps= 30 q=29.0 size= 1280kB time=00:00:10.54 bitrate= 994.7kbits/s speed=0.989x
frame= 335 fps= 30 q=29.0 size= 1280kB time=00:00:11.12 bitrate= 942.8kbits/s speed=0.989x
frame= 345 fps= 27 q=-1.0 Lsize= 1765kB time=00:00:11.51 bitrate=1255.3kbits/s speed=0.887x
video:1569kB audio:183kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.768725%
[aac @ 0x55ae2ada6260] Qavg: 1450.385
[libx264 @ 0x55ae2ada7bc0] frame I:2 Avg QP:11.26 size: 96372
[libx264 @ 0x55ae2ada7bc0] frame P:99 Avg QP:18.02 size: 11184
[libx264 @ 0x55ae2ada7bc0] frame B:244 Avg QP:17.15 size: 1253
[libx264 @ 0x55ae2ada7bc0] consecutive B-frames: 2.6% 8.1% 3.5% 85.8%
[libx264 @ 0x55ae2ada7bc0] mb I I16..4: 54.0% 36.8% 9.2%
[libx264 @ 0x55ae2ada7bc0] mb P I16..4: 1.7% 8.2% 0.2% P16..4: 16.8% 2.9% 2.6% 0.0% 0.0% skip:67.7%
[libx264 @ 0x55ae2ada7bc0] mb B I16..4: 0.3% 0.3% 0.0% B16..8: 8.1% 0.2% 0.1% direct: 1.8% skip:89.2% L0:35.2% L1:62.5% BI: 2.3%
[libx264 @ 0x55ae2ada7bc0] 8x8 transform intra:71.5% inter:83.8%
[libx264 @ 0x55ae2ada7bc0] coded y,uvDC,uvAC intra: 18.8% 23.1% 7.1% inter: 2.4% 6.6% 0.1%
[libx264 @ 0x55ae2ada7bc0] i16 v,h,dc,p: 62% 22% 7% 8%
[libx264 @ 0x55ae2ada7bc0] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 33% 16% 41% 1% 1% 1% 2% 1% 2%
[libx264 @ 0x55ae2ada7bc0] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 18% 25% 12% 6% 8% 6% 11% 6% 8%
[libx264 @ 0x55ae2ada7bc0] i8c dc,h,v,p: 72% 14% 12% 1%
[libx264 @ 0x55ae2ada7bc0] Weighted P-Frames: Y:53.5% UV:48.5%
[libx264 @ 0x55ae2ada7bc0] ref P L0: 75.9% 11.4% 10.0% 2.4% 0.3%
[libx264 @ 0x55ae2ada7bc0] ref B L0: 89.7% 9.5% 0.8%
[libx264 @ 0x55ae2ada7bc0] ref B L1: 97.9% 2.1%
[libx264 @ 0x55ae2ada7bc0] kb/s:1117.06
我试图在我的虚拟机中重现此错误 运行 相同的 Ubuntu 18.04 版本,具有 mpm 事件的相同 apache 版本,相同的 python 版本,相同的 ffmpeg-python 版本和 ffmpeg 版本,但在我的本地主机 VM 上,一切正常,没有任何问题。 现在我需要帮助,因为我不知道为什么这个编码器无法打开(当另一个正在使用它时?-但我的 VM 没有问题?)
如果有帮助,我也使用 opencv 并使用 h264 编码器获得以下部分:
video = cv.VideoWriter(output, cv.VideoWriter_fourcc('a', 'v', 'c', '1'), 30, 1920, 1080))
编写此视频的程序部分通常需要很长时间,如果这些知识有帮助的话,但此时多个客户端使用它时编码器没有问题。
我真的希望有人能帮助我,我感谢你为我投入的时间,谢谢!
如果我忘记发送东西或者我需要提供更详细的信息或任何东西,请给我发短信 :)
版本
- Ubuntu 18.04 LTS
- Apache/2.4.29
- ffmpeg 版本 3.4.8-0ubuntu0.2
- Python 3.6.9
- 烧瓶 2.0.2
- opencv 3.4.1
- ffmpeg-python 0.2.0
好吧,看在上帝的份上,我已经完成了...需要 4 天的时间让这个 **** 找到答案,我激活了一个 apache mod (fcgid),它从字面上分配了每一行您的代码到单个线程...所以我停用了那个线程,现在它可以正常工作...
简而言之 - 我做了什么:
a2dismod fcgid
systemctl restart apache2
现在可以使用了。
感谢 @Rotem 的帮助!对于那个奇怪的问题和我自己的愚蠢感到抱歉...