ffmepg - когда я запускаю второй экземпляр, первый останавливается - PullRequest
0 голосов
/ 24 апреля 2020

Я пытаюсь преобразовать поток видео на мой сервер rtmp с помощью ffmpeg. Я использую Node-Media-Server для получения моего потока rtmp.

Моя версия ffmpeg:

ffmpeg version N-93447-g5252d594a1 Copyright (c) 2000-2019 the FFmpeg developers
  built with Apple LLVM version 10.0.0 (clang-1000.11.45.5)
  configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libdav1d --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-appkit --enable-avfoundation --enable-coreimage --enable-audiotoolbox
  libavutil      56. 26.100 / 56. 26.100
  libavcodec     58. 47.105 / 58. 47.105
  libavformat    58. 26.101 / 58. 26.101
  libavdevice    58.  7.100 / 58.  7.100
  libavfilter     7. 48.100 /  7. 48.100
  libswscale      5.  4.100 /  5.  4.100
  libswresample   3.  4.100 /  3.  4.100
  libpostproc    55.  4.100 / 55.  4.100

Моя проблема в том, что когда я запускаю этот cmd, он работает хорошо :

ffmpeg -i http://server_ip:8080/19871 -bsf:a aac_adtstoasc -c copy -f flv rtmp://localhost/live/test

Но когда я запускаю другой экземпляр ffmpeg в другой оболочке, первое убийство и второе запускаются хорошо:

ffmpeg -i http://server_ip:8080/12222 -bsf:a aac_adtstoasc -c copy -f flv rtmp://localhost/live/test2

Первый вывод:

> ffmpeg -i http://server_ip:8080/19871 -bsf:a aac_adtstoasc  -c copy -f flv rtmp://localhost/live/test
ffmpeg version N-93447-g5252d594a1 Copyright (c) 2000-2019 the FFmpeg developers
  built with Apple LLVM version 10.0.0 (clang-1000.11.45.5)
  configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libdav1d --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-appkit --enable-avfoundation --enable-coreimage --enable-audiotoolbox
  libavutil      56. 26.100 / 56. 26.100
  libavcodec     58. 47.105 / 58. 47.105
  libavformat    58. 26.101 / 58. 26.101
  libavdevice    58.  7.100 / 58.  7.100
  libavfilter     7. 48.100 /  7. 48.100
  libswscale      5.  4.100 /  5.  4.100
  libswresample   3.  4.100 /  3.  4.100
  libpostproc    55.  4.100 / 55.  4.100
[h264 @ 0x7f8ee1808200] Increasing reorder buffer to 2
Input #0, mpegts, from 'http://server_ip:8080/19871':
  Duration: N/A, start: 50.009344, bitrate: N/A
  Program 1
    Metadata:
      service_name    : Service01
      service_provider: FFmpeg
    Stream #0:0[0x100]: Video: h264 (Main) ([27][0][0][0] / 0x001B), yuv420p(tv, bt470bg, progressive), 640x360 [SAR 1:1 DAR 16:9], 25 fps, 25 tbr, 90k tbn, 50 tbc
    Stream #0:1[0x101]: Audio: aac (HE-AAC) ([15][0][0][0] / 0x000F), 48000 Hz, stereo, fltp, 48 kb/s
Output #0, flv, to 'rtmp://localhost/live/test':
  Metadata:
    encoder         : Lavf58.26.101
    Stream #0:0: Video: h264 (Main) ([7][0][0][0] / 0x0007), yuv420p(tv, bt470bg, progressive), 640x360 [SAR 1:1 DAR 16:9], q=2-31, 25 fps, 25 tbr, 1k tbn, 90k tbc
    Stream #0:1: Audio: aac (HE-AAC) ([10][0][0][0] / 0x000A), 48000 Hz, stereo, fltp, 48 kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
  Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
[flv @ 0x7f8ee3025800] Failed to update header with correct duration.241.4kbits/s speed= 5.6x
[flv @ 0x7f8ee3025800] Failed to update header with correct filesize.
frame=  825 fps=140 q=-1.0 Lsize=    5046kB time=00:00:32.95 bitrate=1254.3kbits/s speed= 5.6x
video:4825kB audio:192kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.583293%

Выход за секунду:

> ffmpeg -i http://server_ip:8080/12222 -bsf:a aac_adtstoasc  -c copy  -f flv rtmp://localhost/live/test2
ffmpeg version N-93447-g5252d594a1 Copyright (c) 2000-2019 the FFmpeg developers
  built with Apple LLVM version 10.0.0 (clang-1000.11.45.5)
  configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libdav1d --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-appkit --enable-avfoundation --enable-coreimage --enable-audiotoolbox
  libavutil      56. 26.100 / 56. 26.100
  libavcodec     58. 47.105 / 58. 47.105
  libavformat    58. 26.101 / 58. 26.101
  libavdevice    58.  7.100 / 58.  7.100
  libavfilter     7. 48.100 /  7. 48.100
  libswscale      5.  4.100 /  5.  4.100
  libswresample   3.  4.100 /  3.  4.100
  libpostproc    55.  4.100 / 55.  4.100
[h264 @ 0x7faf1a808200] Increasing reorder buffer to 2
Input #0, mpegts, from 'http://server_ip:8080/12222':
  Duration: N/A, start: 60.036011, bitrate: N/A
  Program 1
    Metadata:
      service_name    : Service01
      service_provider: FFmpeg
    Stream #0:0[0x100]: Video: h264 (Main) ([27][0][0][0] / 0x001B), yuv420p(tv, bt470bg, progressive), 640x360 [SAR 1:1 DAR 16:9], 25 fps, 25 tbr, 90k tbn, 50 tbc
    Stream #0:1[0x101]: Audio: aac (HE-AAC) ([15][0][0][0] / 0x000F), 48000 Hz, stereo, fltp, 61 kb/s
Output #0, flv, to 'rtmp://localhost/live/test':
  Metadata:
    encoder         : Lavf58.26.101
    Stream #0:0: Video: h264 (Main) ([7][0][0][0] / 0x0007), yuv420p(tv, bt470bg, progressive), 640x360 [SAR 1:1 DAR 16:9], q=2-31, 25 fps, 25 tbr, 1k tbn, 90k tbc
    Stream #0:1: Audio: aac (HE-AAC) ([10][0][0][0] / 0x000A), 48000 Hz, stereo, fltp, 61 kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
  Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
frame=  650 fps=205 q=-1.0 Lsize=    3974kB time=00:00:25.92 bitrate=1255.8kbits/s speed=8.16x

Как запустить 2 экземпляра потока ffmpeg?

Заранее благодарен за ответы.

...