@alexdora
Топ-менеджер

Как решить проблему ffmpeg перекодирования потока?

Есть устройство, которое выдает это:
ffmpeg -f decklink -list_formats 1 -i 'UltraStudio Mini Recorder'

ffmpeg version 2.8.3 Copyright (c) 2000-2015 the FFmpeg developers
built with Apple LLVM version 8.0.0 (clang-800.0.42.1)
configuration: --prefix=/usr/local/Cellar/ffmpeg/2.8.3 --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-opencl --enable-libx264 --enable-libmp3lame --enable-libvo-aacenc --enable-libxvid --enable-decklink --enable-vda
libavutil 54. 31.100 / 54. 31.100
libavcodec 56. 60.100 / 56. 60.100
libavformat 56. 40.101 / 56. 40.101
libavdevice 56. 4.100 / 56. 4.100
libavfilter 5. 40.101 / 5. 40.101
libavresample 2. 1. 0 / 2. 1. 0
libswscale 3. 1.101 / 3. 1.101
libswresample 1. 2.101 / 1. 2.101
libpostproc 53. 3.100 / 53. 3.100
[decklink @ 0x7fd176000000] Supported formats for 'UltraStudio Mini Recorder':
[decklink @ 0x7fd176000000] 1 720x486 at 30000/1001 fps (interlaced, lower field first)
[decklink @ 0x7fd176000000] 2 720x486 at 24000/1001 fps
[decklink @ 0x7fd176000000] 3 720x576 at 25000/1000 fps (interlaced, upper field first)
[decklink @ 0x7fd176000000] 4 720x486 at 60000/1001 fps
[decklink @ 0x7fd176000000] 5 720x576 at 50000/1000 fps
[decklink @ 0x7fd176000000] 6 1920x1080 at 24000/1001 fps
[decklink @ 0x7fd176000000] 7 1920x1080 at 24000/1000 fps
[decklink @ 0x7fd176000000] 8 1920x1080 at 25000/1000 fps
[decklink @ 0x7fd176000000] 9 1920x1080 at 30000/1001 fps
[decklink @ 0x7fd176000000] 10 1920x1080 at 30000/1000 fps
[decklink @ 0x7fd176000000] 11 1920x1080 at 25000/1000 fps (interlaced, upper field first)
[decklink @ 0x7fd176000000] 12 1920x1080 at 30000/1001 fps (interlaced, upper field first)
[decklink @ 0x7fd176000000] 13 1920x1080 at 30000/1000 fps (interlaced, upper field first)
[decklink @ 0x7fd176000000] 14 1280x720 at 50000/1000 fps
[decklink @ 0x7fd176000000] 15 1280x720 at 60000/1001 fps
[decklink @ 0x7fd176000000] 16 1280x720 at 60000/1000 fps
Segmentation fault: 11

Надо отправить видео по RTMP, в лоб почему-то не получается:

ffmpeg -f decklink -i 'UltraStudio Mini Recorder@10' -threads 1 -c:v libx264 -g 60 -profile:v baseline -b:v 1200K -s 1280x720 -f flv -c:a aac -ac 1 -strict -2 -b:a 128k rtmp://somertmpserv/live/alexdora

ffmpeg version 2.8.3 Copyright (c) 2000-2015 the FFmpeg developers
built with Apple LLVM version 8.0.0 (clang-800.0.42.1)
configuration: --prefix=/usr/local/Cellar/ffmpeg/2.8.3 --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-opencl --enable-libx264 --enable-libmp3lame --enable-libvo-aacenc --enable-libxvid --enable-decklink --enable-vda
libavutil 54. 31.100 / 54. 31.100
libavcodec 56. 60.100 / 56. 60.100
libavformat 56. 40.101 / 56. 40.101
libavdevice 56. 4.100 / 56. 4.100
libavfilter 5. 40.101 / 5. 40.101
libavresample 2. 1. 0 / 2. 1. 0
libswscale 3. 1.101 / 3. 1.101
libswresample 1. 2.101 / 1. 2.101
libpostproc 53. 3.100 / 53. 3.100
[decklink @ 0x7fdc75002c00] Found Decklink mode 1920 x 1080 with rate 30.00
[decklink @ 0x7fdc75002c00] Frame received (#1) - No input signal detected - Frames dropped 1
Guessed Channel Layout for Input Stream #0.0 : stereo
Input #0, decklink, from 'UltraStudio Mini Recorder@10':
Duration: N/A, start: 0.000000, bitrate: 1536 kb/s
Stream #0:0: Audio: pcm_s16le, 48000 Hz, 2 channels, s16, 1536 kb/s
Stream #0:1: Video: rawvideo (UYVY / 0x59565955), uyvy422, 1920x1080, -5 kb/s, 30 tbr, 1000k tbn, 30 tbc
No pixel format specified, yuv422p for H.264 encoding chosen.
Use -pix_fmt yuv420p for compatibility with outdated media players.
x264 [error]: baseline profile doesn't support 4:2:2
[libx264 @ 0x7fdc75808400] Error setting profile baseline.
[libx264 @ 0x7fdc75808400] Possible profiles: baseline main high high10 high422 high444
Output #0, flv, to '':
Stream #0:0: Video: h264, none, q=2-31, 128 kb/s, 30 fps
Metadata:
encoder : Lavc56.60.100 libx264
Stream #0:1: Audio: aac, 0 channels, 128 kb/s
Metadata:
encoder : Lavc56.60.100 aac
Stream mapping:
Stream #0:1 -> #0:0 (rawvideo (native) -> h264 (libx264))
Stream #0:0 -> #0:1 (pcm_s16le (native) -> aac (native))
Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height
Segmentation fault: 11


Вопрос, как исправить. Существует маленькая вероятность, что звук льется через другой девайс
ffmpeg -f avfoundation -list_devices true -i ""

ffmpeg version 2.8.3 Copyright (c) 2000-2015 the FFmpeg developers
built with Apple LLVM version 8.0.0 (clang-800.0.42.1)
configuration: --prefix=/usr/local/Cellar/ffmpeg/2.8.3 --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-opencl --enable-libx264 --enable-libmp3lame --enable-libvo-aacenc --enable-libxvid --enable-decklink --enable-vda
libavutil 54. 31.100 / 54. 31.100
libavcodec 56. 60.100 / 56. 60.100
libavformat 56. 40.101 / 56. 40.101
libavdevice 56. 4.100 / 56. 4.100
libavfilter 5. 40.101 / 5. 40.101
libavresample 2. 1. 0 / 2. 1. 0
libswscale 3. 1.101 / 3. 1.101
libswresample 1. 2.101 / 1. 2.101
libpostproc 53. 3.100 / 53. 3.100
[AVFoundation input device @ 0x7ff31b4003e0] AVFoundation video devices:
[AVFoundation input device @ 0x7ff31b4003e0] [0] HD-камера FaceTime (встроенная)
[AVFoundation input device @ 0x7ff31b4003e0] [1] Capture screen 0
[AVFoundation input device @ 0x7ff31b4003e0] AVFoundation audio devices:
[AVFoundation input device @ 0x7ff31b4003e0] [0] Blackmagic Audio 7
[AVFoundation input device @ 0x7ff31b4003e0] [1] Built-in Microphone
: Input/output error
  • Вопрос задан
  • 1318 просмотров
Решения вопроса 1
@alexdora Автор вопроса
Топ-менеджер
ADD Решение:
Задался почему устройство Blackmagic в Source отображает черный экран при использовании OBS. Но при этом ты можешь добавить устройство изображения и устройство звука отдельно.
Я нашел тему где люди обсуждали, что сама железка настраивается через Black Magic Express не явным образом. И действительно, сработало и для меня. Black Magic Express выбрал цветовой профиль и качество. Выключил и загрузил с этими параметрами - все тип топ. ЗАРАБОТАЛО

ADD:
Я тоже не сижу без дела.

ffmpeg -f decklink -i 'UltraStudio Mini Recorder@10' -pix_fmt uyvy422 -bm_v210 0 -c:v libx264 -pix_fmt yuv420p -aspect 16:9 -g 60 -r 30000/1000 -vf "scale=1280:720" -profile:v baseline -b:v 1000K -f flv -c:a libvo_aacenc -ab 64k -ar 44100 -ac 2 rtmp://link

ffmpeg version 2.8.3 Copyright (c) 2000-2015 the FFmpeg developers
built with Apple LLVM version 8.0.0 (clang-800.0.42.1)
configuration: --prefix=/usr/local/Cellar/ffmpeg/2.8.3 --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-opencl --enable-libx264 --enable-libmp3lame --enable-libvo-aacenc --enable-libxvid --enable-decklink --enable-vda
libavutil 54. 31.100 / 54. 31.100
libavcodec 56. 60.100 / 56. 60.100
libavformat 56. 40.101 / 56. 40.101
libavdevice 56. 4.100 / 56. 4.100
libavfilter 5. 40.101 / 5. 40.101
libavresample 2. 1. 0 / 2. 1. 0
libswscale 3. 1.101 / 3. 1.101
libswresample 1. 2.101 / 1. 2.101
libpostproc 53. 3.100 / 53. 3.100
[decklink @ 0x7f8bdc000000] Found Decklink mode 1920 x 1080 with rate 30.00
[decklink @ 0x7f8bdc000000] Frame received (#1) - No input signal detected - Frames dropped 1
Guessed Channel Layout for Input Stream #0.0 : stereo
Input #0, decklink, from 'UltraStudio Mini Recorder@10':
Duration: N/A, start: 0.000000, bitrate: 1536 kb/s
Stream #0:0: Audio: pcm_s16le, 48000 Hz, 2 channels, s16, 1536 kb/s
Stream #0:1: Video: rawvideo (UYVY / 0x59565955), uyvy422, 1920x1080, -5 kb/s, 30 tbr, 1000k tbn, 30 tbc
[libx264 @ 0x7f8bdc805200] using SAR=1/1
[libx264 @ 0x7f8bdc805200] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX
[libx264 @ 0x7f8bdc805200] profile Constrained Baseline, level 4.0
[libx264 @ 0x7f8bdc805200] 264 - core 148 r2728 4d5c8b0 - H.264/MPEG-4 AVC codec - Copyleft 2003-2016 - www.videolan.org/x264.html - options: cabac=0 ref=3 deblock=1:0:0 analyse=0x1:0x111 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=0 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=6 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=0 weightp=0 keyint=60 keyint_min=6 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=abr mbtree=1 bitrate=1000 ratetol=1.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
Output #0, flv, to '*':
Metadata:
encoder : Lavf56.40.101
Stream #0:0: Video: h264 (libx264) ([7][0][0][0] / 0x0007), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], q=-1--1, 1000 kb/s, 30 fps, 1k tbn, 30 tbc
Metadata:
encoder : Lavc56.60.100 libx264
Stream #0:1: Audio: aac (libvo_aacenc) ([10][0][0][0] / 0x000A), 44100 Hz, stereo, s16, 64 kb/s
Metadata:
encoder : Lavc56.60.100 libvo_aacenc
Stream mapping:
Stream #0:1 -> #0:0 (rawvideo (native) -> h264 (libx264))
Stream #0:0 -> #0:1 (pcm_s16le (native) -> aac (libvo_aacenc))
Press [q] to stop, [?] for help
[flv @ 0x7f8bdc804600] Failed to update header with correct duration.76.0kbits/s
[flv @ 0x7f8bdc804600] Failed to update header with correct filesize.
frame= 146 fps= 32 q=-1.0 Lsize= 66kB time=00:00:04.86 bitrate= 110.5kbits/s
video:21kB audio:38kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 11.455467%
[libx264 @ 0x7f8bdc805200] frame I:3 Avg QP: 7.33 size: 6376
[libx264 @ 0x7f8bdc805200] frame P:143 Avg QP: 2.04 size: 12
[libx264 @ 0x7f8bdc805200] mb I I16..4: 100.0% 0.0% 0.0%
[libx264 @ 0x7f8bdc805200] mb P I16..4: 0.0% 0.0% 0.0% P16..4: 0.0% 0.0% 0.0% 0.0% 0.0% skip:100.0%
[libx264 @ 0x7f8bdc805200] final ratefactor: -1.31
[libx264 @ 0x7f8bdc805200] coded y,uvDC,uvAC intra: 0.0% 0.1% 0.0% inter: 0.0% 0.0% 0.0%
[libx264 @ 0x7f8bdc805200] i16 v,h,dc,p: 99% 0% 1% 0%
[libx264 @ 0x7f8bdc805200] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 0% 0% 100% 0% 0% 0% 0% 0% 0%
[libx264 @ 0x7f8bdc805200] i8c dc,h,v,p: 94% 0% 6% 0%
[libx264 @ 0x7f8bdc805200] kb/s:34.27
Segmentation fault: 11


Но ffplay выводит цветные полосы на весь экран (судя по всему брендовый стиль blackmagic).
Пробовал разное - не получается картинку получить. OBS исправно ловит изображение с камеры...3caa7b82648f445f9187b4fda06ffd33.pngADD
Собственно говоря да, цветные полосы - брендовая тема при потере сигнала или при неверных входящих данных. Я не знаю что еще изменить, поправить. OBS или родная Media Express видят поток с камеры
Ответ написан
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы