lipku / python_rtmpstream

python库,实现推送实时rtmp音视频流
MIT License
66 stars 20 forks source link

执行到pip install .这一步时报错了 #28

Open gavid0124 opened 1 month ago

gavid0124 commented 1 month ago

报错信息如下: subprocess.CalledProcessError: Command '['cmake', '--build', '.']' returned non-zero exit status 1.

详细报错信息: Processing /opt/dev/python_rtmpstream/python Preparing metadata (setup.py) ... done Building wheels for collected packages: rtmp_streaming Building wheel for rtmp_streaming (setup.py) ... error error: subprocess-exited-with-error

× python setup.py bdist_wheel did not run successfully. │ exit code: 1 ╰─> [181 lines of output] running bdist_wheel running build running build_ext Building with cfg = Release -- The C compiler identification is GNU 10.2.1 -- The CXX compiler identification is GNU 10.2.1 -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Check for working C compiler: /usr/bin/cc - skipped -- Detecting C compile features -- Detecting C compile features - done -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Check for working CXX compiler: /usr/bin/c++ - skipped -- Detecting CXX compile features -- Detecting CXX compile features - done -- pybind11 v2.12.0 dev1 -- Found Python: /opt/conda/envs/nerfstream/bin/python3.10 (found suitable version "3.10.13", minimum required is "3.6") found components: Interpreter Development.Module Development.Embed -- Performing Test HAS_FLTO -- Performing Test HAS_FLTO - Success -- Configuring done (2.4s) -- Generating done (0.0s) CMake Warning: Manually-specified variables were not used by the project:

      EXAMPLE_VERSION_INFO

  -- Build files have been written to: /opt/dev/python_rtmpstream/python/build/temp.linux-x86_64-cpython-310
  Change Dir: '/opt/dev/python_rtmpstream/python/build/temp.linux-x86_64-cpython-310'

  Run Build Command(s): /opt/conda/envs/nerfstream/bin/ninja -v
  [1/3] /usr/bin/c++ -Drtmp_streaming_EXPORTS -I/opt/dev/python_rtmpstream/python/../streamer -I/opt/conda/envs/nerfstream/include -isystem /opt/conda/envs/nerfstream/include/python3.10 -isystem /opt/dev/python_rtmpstream/python/pybind11/include -O3 -DNDEBUG -O3 -std=c++14 -Wall -std=gnu++14 -fPIC -fvisibility=hidden -flto -fno-fat-lto-objects -MD -MT CMakeFiles/rtmp_streaming.dir/opt/dev/python_rtmpstream/streamer/streamer.cpp.o -MF CMakeFiles/rtmp_streaming.dir/opt/dev/python_rtmpstream/streamer/streamer.cpp.o.d -o CMakeFiles/rtmp_streaming.dir/opt/dev/python_rtmpstream/streamer/streamer.cpp.o -c /opt/dev/python_rtmpstream/streamer/streamer.cpp
  FAILED: CMakeFiles/rtmp_streaming.dir/opt/dev/python_rtmpstream/streamer/streamer.cpp.o
  /usr/bin/c++ -Drtmp_streaming_EXPORTS -I/opt/dev/python_rtmpstream/python/../streamer -I/opt/conda/envs/nerfstream/include -isystem /opt/conda/envs/nerfstream/include/python3.10 -isystem /opt/dev/python_rtmpstream/python/pybind11/include -O3 -DNDEBUG -O3 -std=c++14 -Wall -std=gnu++14 -fPIC -fvisibility=hidden -flto -fno-fat-lto-objects -MD -MT CMakeFiles/rtmp_streaming.dir/opt/dev/python_rtmpstream/streamer/streamer.cpp.o -MF CMakeFiles/rtmp_streaming.dir/opt/dev/python_rtmpstream/streamer/streamer.cpp.o.d -o CMakeFiles/rtmp_streaming.dir/opt/dev/python_rtmpstream/streamer/streamer.cpp.o -c /opt/dev/python_rtmpstream/streamer/streamer.cpp
  In file included from /opt/dev/python_rtmpstream/streamer/streamer.cpp:1:
  /opt/dev/python_rtmpstream/streamer/streamer.hpp: In member function ‘int streamer::AudioFrame::init(AVSampleFormat, int, uint64_t)’:
  /opt/dev/python_rtmpstream/streamer/streamer.hpp:132:16: error: ‘AVFrame’ {aka ‘struct AVFrame’} has no member named ‘channel_layout’; did you mean ‘ch_layout’?
    132 |         frame->channel_layout = channel_layout;
        |                ^~~~~~~~~~~~~~
        |                ch_layout
  /opt/dev/python_rtmpstream/streamer/streamer.cpp: In function ‘void streamer::log_packet(const AVFormatContext*, const AVPacket*)’:
  /opt/dev/python_rtmpstream/streamer/streamer.cpp:38:18: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘long int’ [-Wformat=]
     38 |     printf("pts:%d dts:%d duration:%d stream_index:%d timebase:%d/%d\n",
        |                 ~^
        |                  |
        |                  int
        |                 %ld
     39 |            pkt->pts,
        |            ~~~~~~~~
        |                 |
        |                 long int
  /opt/dev/python_rtmpstream/streamer/streamer.cpp:38:25: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘long int’ [-Wformat=]
     38 |     printf("pts:%d dts:%d duration:%d stream_index:%d timebase:%d/%d\n",
        |                        ~^
        |                         |
        |                         int
        |                        %ld
     39 |            pkt->pts,
     40 |            pkt->dts,
        |            ~~~~~~~~
        |                 |
        |                 long int
  /opt/dev/python_rtmpstream/streamer/streamer.cpp:38:37: warning: format ‘%d’ expects argument of type ‘int’, but argument 4 has type ‘long int’ [-Wformat=]
     38 |     printf("pts:%d dts:%d duration:%d stream_index:%d timebase:%d/%d\n",
        |                                    ~^
        |                                     |
        |                                     int
        |                                    %ld
  ......
     41 |            pkt->duration,
        |            ~~~~~~~~~~~~~
        |                 |
        |                 long int
  /opt/dev/python_rtmpstream/streamer/streamer.cpp: In function ‘int streamer::encode_and_write_frame(AVCodecContext*, AVFormatContext*, AVStream*, AVFrame*, int64_t)’:
  /opt/dev/python_rtmpstream/streamer/streamer.cpp:48:24: warning: ‘void av_init_packet(AVPacket*)’ is deprecated [-Wdeprecated-declarations]
     48 |     av_init_packet(&pkt);
        |                        ^
  In file included from /opt/conda/envs/nerfstream/include/libavcodec/avcodec.h:44,
                   from /opt/dev/python_rtmpstream/streamer/streamer.hpp:6,
                   from /opt/dev/python_rtmpstream/streamer/streamer.cpp:1:
  /opt/conda/envs/nerfstream/include/libavcodec/packet.h:653:6: note: declared here
    653 | void av_init_packet(AVPacket *pkt);
        |      ^~~~~~~~~~~~~~
  /opt/dev/python_rtmpstream/streamer/streamer.cpp: In function ‘int streamer::set_options_and_open_encoder_audio(AVFormatContext*, AVStream*, AVCodecContext*, AVCodec*, int, int, AVCodecID)’:
  /opt/dev/python_rtmpstream/streamer/streamer.cpp:138:16: error: ‘AVCodecContext’ {aka ‘struct AVCodecContext’} has no member named ‘channels’
    138 |     codec_ctx->channels = channel;
        |                ^~~~~~~~
  /opt/dev/python_rtmpstream/streamer/streamer.cpp:139:16: error: ‘AVCodecContext’ {aka ‘struct AVCodecContext’} has no member named ‘channel_layout’; did you mean ‘ch_layout’?
    139 |     codec_ctx->channel_layout = av_get_default_channel_layout(channel);
        |                ^~~~~~~~~~~~~~
        |                ch_layout
  /opt/dev/python_rtmpstream/streamer/streamer.cpp:139:33: error: ‘av_get_default_channel_layout’ was not declared in this scope
    139 |     codec_ctx->channel_layout = av_get_default_channel_layout(channel);
        |                                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  /opt/dev/python_rtmpstream/streamer/streamer.cpp: In member function ‘void streamer::Streamer::cleanup()’:
  /opt/dev/python_rtmpstream/streamer/streamer.cpp:192:36: warning: ‘int avcodec_close(AVCodecContext*)’ is deprecated [-Wdeprecated-declarations]
    192 |         avcodec_close(out_codec_ctx);
        |                                    ^
  In file included from /opt/dev/python_rtmpstream/streamer/streamer.hpp:6,
                   from /opt/dev/python_rtmpstream/streamer/streamer.cpp:1:
  /opt/conda/envs/nerfstream/include/libavcodec/avcodec.h:2387:5: note: declared here
   2387 | int avcodec_close(AVCodecContext *avctx);
        |     ^~~~~~~~~~~~~
  /opt/dev/python_rtmpstream/streamer/streamer.cpp:196:42: warning: ‘int avcodec_close(AVCodecContext*)’ is deprecated [-Wdeprecated-declarations]
    196 |         avcodec_close(out_codec_audio_ctx);
        |                                          ^
  In file included from /opt/dev/python_rtmpstream/streamer/streamer.hpp:6,
                   from /opt/dev/python_rtmpstream/streamer/streamer.cpp:1:
  /opt/conda/envs/nerfstream/include/libavcodec/avcodec.h:2387:5: note: declared here
   2387 | int avcodec_close(AVCodecContext *avctx);
        |     ^~~~~~~~~~~~~
  /opt/dev/python_rtmpstream/streamer/streamer.cpp: In member function ‘int streamer::Streamer::init(const streamer::StreamerConfig&)’:
  /opt/dev/python_rtmpstream/streamer/streamer.cpp:379:108: error: ‘AVCodecContext’ {aka ‘struct AVCodecContext’} has no member named ‘channel_layout’; did you mean ‘ch_layout’?
    379 |     audioframe.init(out_codec_audio_ctx->sample_fmt, out_codec_audio_ctx->frame_size, out_codec_audio_ctx->channel_layout);
        |                                                                                                            ^~~~~~~~~~~~~~
        |                                                                                                            ch_layout
  /opt/dev/python_rtmpstream/streamer/streamer.cpp:381:60: error: ‘AVCodecContext’ {aka ‘struct AVCodecContext’} has no member named ‘channels’
    381 |                                       out_codec_audio_ctx->channels, 1))) {
        |                                                            ^~~~~~~~
  /opt/dev/python_rtmpstream/streamer/streamer.cpp: At global scope:
  /opt/dev/python_rtmpstream/streamer/streamer.cpp:35:13: warning: ‘void streamer::log_packet(const AVFormatContext*, const AVPacket*)’ defined but not used [-Wunused-function]
     35 | static void log_packet(const AVFormatContext *fmt_ctx, const AVPacket *pkt)
        |             ^~~~~~~~~~
  [2/3] /usr/bin/c++ -Drtmp_streaming_EXPORTS -I/opt/dev/python_rtmpstream/python/../streamer -I/opt/conda/envs/nerfstream/include -isystem /opt/conda/envs/nerfstream/include/python3.10 -isystem /opt/dev/python_rtmpstream/python/pybind11/include -O3 -DNDEBUG -O3 -std=c++14 -Wall -std=gnu++14 -fPIC -fvisibility=hidden -flto -fno-fat-lto-objects -MD -MT CMakeFiles/rtmp_streaming.dir/rtmp_streaming.cpp.o -MF CMakeFiles/rtmp_streaming.dir/rtmp_streaming.cpp.o.d -o CMakeFiles/rtmp_streaming.dir/rtmp_streaming.cpp.o -c /opt/dev/python_rtmpstream/python/rtmp_streaming.cpp
  FAILED: CMakeFiles/rtmp_streaming.dir/rtmp_streaming.cpp.o
  /usr/bin/c++ -Drtmp_streaming_EXPORTS -I/opt/dev/python_rtmpstream/python/../streamer -I/opt/conda/envs/nerfstream/include -isystem /opt/conda/envs/nerfstream/include/python3.10 -isystem /opt/dev/python_rtmpstream/python/pybind11/include -O3 -DNDEBUG -O3 -std=c++14 -Wall -std=gnu++14 -fPIC -fvisibility=hidden -flto -fno-fat-lto-objects -MD -MT CMakeFiles/rtmp_streaming.dir/rtmp_streaming.cpp.o -MF CMakeFiles/rtmp_streaming.dir/rtmp_streaming.cpp.o.d -o CMakeFiles/rtmp_streaming.dir/rtmp_streaming.cpp.o -c /opt/dev/python_rtmpstream/python/rtmp_streaming.cpp
  In file included from /opt/dev/python_rtmpstream/python/rtmp_streaming.cpp:12:
  /opt/dev/python_rtmpstream/python/../streamer/streamer.hpp: In member function ‘int streamer::AudioFrame::init(AVSampleFormat, int, uint64_t)’:
  /opt/dev/python_rtmpstream/python/../streamer/streamer.hpp:132:16: error: ‘AVFrame’ {aka ‘struct AVFrame’} has no member named ‘channel_layout’; did you mean ‘ch_layout’?
    132 |         frame->channel_layout = channel_layout;
        |                ^~~~~~~~~~~~~~
        |                ch_layout
  ninja: build stopped: subcommand failed.

  Traceback (most recent call last):
    File "<string>", line 2, in <module>
    File "<pip-setuptools-caller>", line 34, in <module>
    File "/opt/dev/python_rtmpstream/python/setup.py", line 125, in <module>
      setup(
    File "/opt/conda/envs/nerfstream/lib/python3.10/site-packages/setuptools/__init__.py", line 104, in setup
      return distutils.core.setup(**attrs)
    File "/opt/conda/envs/nerfstream/lib/python3.10/site-packages/setuptools/_distutils/core.py", line 184, in setup
      return run_commands(dist)
    File "/opt/conda/envs/nerfstream/lib/python3.10/site-packages/setuptools/_distutils/core.py", line 200, in run_commands
      dist.run_commands()
    File "/opt/conda/envs/nerfstream/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 969, in run_commands
      self.run_command(cmd)
    File "/opt/conda/envs/nerfstream/lib/python3.10/site-packages/setuptools/dist.py", line 967, in run_command
      super().run_command(command)
    File "/opt/conda/envs/nerfstream/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
      cmd_obj.run()
    File "/opt/conda/envs/nerfstream/lib/python3.10/site-packages/wheel/bdist_wheel.py", line 368, in run
      self.run_command("build")
    File "/opt/conda/envs/nerfstream/lib/python3.10/site-packages/setuptools/_distutils/cmd.py", line 316, in run_command
      self.distribution.run_command(command)
    File "/opt/conda/envs/nerfstream/lib/python3.10/site-packages/setuptools/dist.py", line 967, in run_command
      super().run_command(command)
    File "/opt/conda/envs/nerfstream/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
      cmd_obj.run()
    File "/opt/conda/envs/nerfstream/lib/python3.10/site-packages/setuptools/_distutils/command/build.py", line 132, in run
      self.run_command(cmd_name)
    File "/opt/conda/envs/nerfstream/lib/python3.10/site-packages/setuptools/_distutils/cmd.py", line 316, in run_command
      self.distribution.run_command(command)
    File "/opt/conda/envs/nerfstream/lib/python3.10/site-packages/setuptools/dist.py", line 967, in run_command
      super().run_command(command)
    File "/opt/conda/envs/nerfstream/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
      cmd_obj.run()
    File "/opt/conda/envs/nerfstream/lib/python3.10/site-packages/setuptools/command/build_ext.py", line 91, in run
      _build_ext.run(self)
    File "/opt/conda/envs/nerfstream/lib/python3.10/site-packages/setuptools/_distutils/command/build_ext.py", line 359, in run
      self.build_extensions()
    File "/opt/conda/envs/nerfstream/lib/python3.10/site-packages/setuptools/_distutils/command/build_ext.py", line 479, in build_extensions
      self._build_extensions_serial()
    File "/opt/conda/envs/nerfstream/lib/python3.10/site-packages/setuptools/_distutils/command/build_ext.py", line 505, in _build_extensions_serial
      self.build_extension(ext)
    File "/opt/dev/python_rtmpstream/python/setup.py", line 116, in build_extension
      subprocess.check_call(
    File "/opt/conda/envs/nerfstream/lib/python3.10/subprocess.py", line 369, in check_call
      raise CalledProcessError(retcode, cmd)
  subprocess.CalledProcessError: Command '['cmake', '--build', '.']' returned non-zero exit status 1.
  [end of output]

note: This error originates from a subprocess, and is likely not a problem with pip. ERROR: Failed building wheel for rtmp_streaming Running setup.py clean for rtmp_streaming Failed to build rtmp_streaming ERROR: Could not build wheels for rtmp_streaming, which is required to install pyproject.toml-based projects

yanhn commented 2 weeks ago

In my case, I encountered this using ffmpeg version>=7. please downgrade your ffmpeg to 6.1.1, use conda install ffmpeg==6.1.1. And problem solved.

gavid0124 commented 2 weeks ago

In my case, I encountered this using ffmpeg version>=7. please downgrade your ffmpeg to 6.1.1, use conda install ffmpeg==6.1.1. And problem solved.

Thank you very much.I have downgrade the ffmpeg to 6.1.1, but still error.