Я использую ffmpeg.exe для перекодирования источника видео, в этом примере ниже из файла и хочу одновременно потоковую передачу rmtp и сохранение в файл. Я не могу понять, что я делаю не так с «псевдослушателем». Вот мой пример:

ffmpeg -re -i bbb1.mp4 -threads 2 -c:v libx264 -c:a aac -profile:v baseline -b:a 96k -strict:a -2 -b:v 200K -g 10 -s:v
320x280 -f tee -map 0:v -map 0:a "rtmp://127.0.0.1:1937/test_mid_002/t1.flv|output3.mp4"

ffmpeg version N-76741-g8eadabf Copyright (c) 2000-2015 the FFmpeg developers  
  built with gcc 5.2.0 (GCC)  
  configuration: --enable-gpl --enable-version3 --disable-w32threads   --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r   --enable-gnutls --enable-iconv --enable-libass --enable-libblu  
ray --enable-libbs2b --enable-libcaca --enable-libdcadec --enable-  libfreetype --enable-libgme --enable-libgsm --enable-libilbc --enable-  libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enab  
le-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp   --enable-libschroedinger --enable-libsoxr --enable-libspeex   --enable-libtheora --enable-libtwolame --enable-libvidstab --ena  
ble-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx   --enable-libwavpack --enable-libwebp --enable-libx264 --enable-  libx265 --enable-libxavs --enable-libxvid --enable-libzimg --  
enable-lzma --enable-decklink --enable-zlib  
  libavutil      55.  7.100 / 55.  7.100  
  libavcodec     57. 15.100 / 57. 15.100  
  libavformat    57. 16.100 / 57. 16.100  
  libavdevice    57.  0.100 / 57.  0.100  
  libavfilter     6. 15.100 /  6. 15.100  
  libswscale      4.  0.100 /  4.  0.100  
  libswresample   2.  0.101 /  2.  0.101  
  libpostproc    54.  0.100 / 54.  0.100  
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'bbb1.mp4':  
  Metadata:  
    major_brand     : isom  
    minor_version   : 1  
    compatible_brands: isomavc1  
    creation_time   : 2013-12-16 17:44:39  
    title           : Big Buck Bunny, Sunflower version  
    artist          : Blender Foundation 2008, Janus Bager Kristensen 2013  
    comment         : Creative Commons Attribution 3.0 -   http://bbb3d.renderfarming.net  
    genre           : Animation  
    composer        : Sacha Goedegebure  
  Duration: 00:10:34.53, start: 0.000000, bitrate: 3481 kb/s  
    Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p,   1920x1080 [SAR 1:1 DAR 16:9], 2998 kb/s, 30 fps, 30 tbr, 30k tbn, 60 tbc   (default)  
    Metadata:  
      creation_time   : 2013-12-16 17:44:39  
      handler_name    : GPAC ISO Video Handler  
    Stream #0:1(und): Audio: mp3 (mp4a / 0x6134706D), 48000 Hz, stereo,   s16p, 160 kb/s (default)  
    Metadata:  
      creation_time   : 2013-12-16 17:44:42  
      handler_name    : GPAC ISO Audio Handler  
    Stream #0:2(und): Audio: ac3 (ac-3 / 0x332D6361), 48000 Hz, 5.1(side),   fltp, 320 kb/s (default)  
    Metadata:  
      creation_time   : 2013-12-16 17:44:42  
      handler_name    : GPAC ISO Audio Handler  
    Side data:  
      audio service type: main  
[libx264 @ 059779a0] using SAR=14/9  
[libx264 @ 059779a0] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX  
[libx264 @ 059779a0] profile Constrained Baseline, level 1.3  
[flv @ 0708a100] Codec for stream 0 does not use global headers but   container format requires global headers  
[flv @ 0708a100] Codec for stream 1 does not use global headers but   container format requires global headers  
[flv @ 0708a100] Codec for stream 2 does not use global headers but   container format requires global headers  
[flv @ 0708a100] at most one audio stream is supported in flv  
[tee @ 05977040] Slave 'rtmp://127.0.0.1:1937/test_mid_002/t1.flv': error   writing header: Invalid argument  
Output #0, tee, to 'rtmp://127.0.0.1:1937/test_mid_002/t1.flv|output3.mp4':  
  Metadata:    
    major_brand     : isom    
    minor_version   : 1    
    compatible_brands: isomavc1    
    composer        : Sacha Goedegebure    
    title           : Big Buck Bunny, Sunflower version    
    artist          : Blender Foundation 2008, Janus Bager Kristensen 2013    
    comment         : Creative Commons Attribution 3.0 -     http://bbb3d.renderfarming.net  
    genre           : Animation  
    encoder         : Lavf57.16.100  
    Stream #0:0(und): Video: h264 (libx264), yuv420p, 320x280 [SAR 14:9 DAR   16:9], q=-1--1, 200 kb/s, 30 fps, 30 tbn, 30 tbc (default)
    Metadata:  
      creation_time   : 2013-12-16 17:44:39  
      handler_name    : GPAC ISO Video Handler  
      encoder         : Lavc57.15.100 libx264  
    Stream #0:1(und): Audio: aac, 48000 Hz, stereo, fltp, 96 kb/s (default)  
    Metadata:  
      creation_time   : 2013-12-16 17:44:42  
      handler_name    : GPAC ISO Audio Handler  
      encoder         : Lavc57.15.100 aac  
    Stream #0:2(und): Audio: aac, 48000 Hz, 5.1(side), fltp, 96 kb/s   (default)  
    Metadata:  
      creation_time   : 2013-12-16 17:44:42  
      handler_name    : GPAC ISO Audio Handler  
      encoder         : Lavc57.15.100 aac  
Stream mapping:  
  Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))  
  Stream #0:1 -> #0:1 (mp3 (native) -> aac (native))  
  Stream #0:2 -> #0:2 (ac3 (native) -> aac (native))  
Could not write header for output file #0 (incorrect codec parameters ?):   Invalid argument  
[libx264 @ 059779a0] final ratefactor: 33.90  
[aac @ 00d9c3a0] Qavg: nan  
[aac @ 00d9ce80] Qavg: nan  

Press any key to continue . . .  

1 ответ1

1

Как говорится в сообщении об ошибке, вы можете использовать мультиплексирование только одного аудиопотока в FLV

Пытаться

ffmpeg -re -i bbb1.mp4 -threads 2 -c:v libx264 -c:a aac \
-profile:v baseline -b:a 96k -strict:a -2 -b:v 200K -g 10 -s:v 320x280 \
-f tee -flags +global_header -map 0:v -map 0:a \
"[select=v,\'a:0\']rtmp://127.0.0.1:1937/test_mid_002/t1.flv|output3.mp4"

Всё ещё ищете ответ? Посмотрите другие вопросы с метками .