pkviet / obs-studio

OBS - Free and open source software for live streaming and screen recording
https://obsproject.com/mantis/
GNU General Public License v2.0
151 stars 20 forks source link

octagonal and hexadecagonal channel mapping AAC #29

Closed ohmercy closed 3 years ago

ohmercy commented 4 years ago

I'm trying to push multilingual livestreams using multi-channel AAC.

OBS ME 25.08 Hardware setup: BMD Decklink capture card with 16 audio channels.

When streaming RTMP with 4.0 audio configured (sources>BM card and Settings>audio) everything works fine. All 4 channels are received server side in the right order (using FFmpeg)

But when using 8.0 (or 16.0) the channels seem to arrive in a differenent order. eg. first input channel seems to be encoded to output as 3th audio channel. FFmpeg seems to detect the incoming stream as octagonal though.

Tried both the default RTMP 'streaming' output method as the Recording > FFmpeg output with audio encoder setting : channel_layout=octagonal

pkviet commented 4 years ago

An easy workaround is to reorder the channels using the rematrix plugin which is included. As to your issue, I don't have it; you could try recompiling ffmpeg against my pce2 branch. It improves the aac encoder and decoder capabilities: https://github.com/pkviet/FFmpeg/commits/pce2 Also with blackmagic source, maybe try to check the swap LFE<->FC checkbox. Channel 3 is often FC (front channel). If you capture w/ sdi there should be no ordering issues; there might be with hdmi (with audio being treated as 7.1 instead of 8.0). Your issue seems related to that.

ohmercy commented 4 years ago

Thank you!

We are using Decklink Duo with SDI input. I'll try the LFE<->FC checkbox tommorrow to see if it makes a difference (if this is present wth SDI as well)

Does OBS use FFmpeg native aac for both regular RTMP streaming and Output > ffmpeg recording? So in theory it would be possible streaming 16 AAC channels/languages via RTMP and SRT?

(yes I noticed it could be fixed with the rematrix plugin, which is a great tool, but direct mapping would be easier for long-term use)

pkviet commented 4 years ago

ffmpeg native aac encoder is the only one which can encode 16.0. So obs will rely on it. For up to 7.1, other encoders can be used by obs (coreaudio, libfdk-aac, win-mf ...). Most aac encoders only support default channel layouts spelled out by the spec although the aac spec allows up to 48 channels. So octagonal would not be supported usually. Coreaudio does support it though. But not fdk-aac.

ohmercy commented 4 years ago

My output channels are still in a different order than input

input: en ch cz fi fr de no po ouput: ch cz en de no po fi fr

Things I have tried:

Remote FFmpeg seems to start the input with correct channel_layout Audio: aac (LC), 48000 Hz, octagonal, fltp, 1048 kb/s

pkviet commented 4 years ago

post the uncut log of ffmpeg command with -loglevel debug option. I want to check if a filter is auto inserted.

ohmercy commented 4 years ago

Thanks for your time !

ffmpeg -loglevel debug -f live_flv -i rtmp://server.net/app/incoming.stream -filter_complex "[0:a]aformat=channel_layouts=octagonal,pan=mono|c0=c0[a0]"  -map "0:v" -map [a0] -c:v:0 libx264 -b:v:0 3.8M -profile:v:0 high -c:a:0 aac -b:a:0 64k -f flv rtmp://server.net/app/outme.stream
ffmpeg version N-88547-g1358f7ddb3 Copyright (c) 2000-2017 the FFmpeg developers
  built with gcc 6.3.0 (Debian 6.3.0-18+deb9u1) 20170516
  configuration: --prefix=/data/local/home/hans/ffmpeg-pce2 --enable-gpl --enable-version3 --enable-nonfree --enable-openssl --enable-postproc --enable-avfilter --enable-pthreads --enable-libzmq --enable-filter=movie --enable-libmp3lame --enable-libopenjpeg --enable-gmp --enable-libopus --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libfdk-aac
  libavutil      56.  0.100 / 56.  0.100
  libavcodec     58.  1.100 / 58.  1.100
  libavformat    58.  0.102 / 58.  0.102
  libavdevice    58.  0.100 / 58.  0.100
  libavfilter     7.  0.101 /  7.  0.101
  libswscale      5.  0.101 /  5.  0.101
  libswresample   3.  0.101 /  3.  0.101
  libpostproc    55.  0.100 / 55.  0.100
Splitting the commandline.
Reading option '-loglevel' ... matched as option 'loglevel' (set logging level) with argument 'debug'.
Reading option '-f' ... matched as option 'f' (force format) with argument 'live_flv'.
Reading option '-i' ... matched as input url with argument 'rtmp://server.net/app/incoming.stream'.
Reading option '-filter_complex' ... matched as option 'filter_complex' (create a complex filtergraph) with argument '[0:a]aformat=channel_layouts=octagonal,pan=mono|c0=c0[a0]'.
Reading option '-map' ... matched as option 'map' (set input stream mapping) with argument '0:v'.
Reading option '-map' ... matched as option 'map' (set input stream mapping) with argument '[a0]'.
Reading option '-c:v:0' ... matched as option 'c' (codec name) with argument 'libx264'.
Reading option '-b:v:0' ... matched as option 'b' (video bitrate (please use -b:v)) with argument '3.8M'.
Reading option '-profile:v:0' ... matched as option 'profile' (set profile) with argument 'high'.
Reading option '-c:a:0' ... matched as option 'c' (codec name) with argument 'aac'.
Reading option '-b:a:0' ... matched as option 'b' (video bitrate (please use -b:v)) with argument '64k'.
Reading option '-f' ... matched as option 'f' (force format) with argument 'flv'.
Reading option 'rtmp://server.net/app/outme.stream' ... matched as output url.
Finished splitting the commandline.
Parsing a group of options: global .
Applying option loglevel (set logging level) with argument debug.
Applying option filter_complex (create a complex filtergraph) with argument [0:a]aformat=channel_layouts=octagonal,pan=mono|c0=c0[a0].
Successfully parsed a group of options.
Parsing a group of options: input url rtmp://server.net/app/incoming.stream.
Applying option f (force format) with argument live_flv.
Successfully parsed a group of options.
Opening an input file: rtmp://server.net/app/incoming.stream.
[live_flv @ 0x55ca12773540] Opening 'rtmp://server.net/app/incoming.stream' for reading
[rtmp @ 0x55ca12773e40] No default whitelist set
[tcp @ 0x55ca127743c0] No default whitelist set
[rtmp @ 0x55ca12773e40] Handshaking...
[rtmp @ 0x55ca12773e40] Type answer 3
[rtmp @ 0x55ca12773e40] Server version 3.0.1.1
[rtmp @ 0x55ca12773e40] Proto = rtmp, path = /app/incoming.stream, app = app, fname = incoming.stream
[rtmp @ 0x55ca12773e40] Window acknowledgement size = 2500000
[rtmp @ 0x55ca12773e40] Max sent, unacked = 2500000
[rtmp @ 0x55ca12773e40] New incoming chunk size = 4096
[rtmp @ 0x55ca12773e40] Creating stream...
[rtmp @ 0x55ca12773e40] Sending play command for 'incoming.stream'
[live_flv @ 0x55ca12773540] Before avformat_find_stream_info() pos: 13 bytes read:700 seeks:0 nb_streams:0
[live_flv @ 0x55ca12773540] Unknown type |RtmpSampleAccess
[live_flv @ 0x55ca12773540] Unknown type onStatus
[NULL @ 0x55ca1277ff60] nal_unit_type: 7, nal_ref_idc: 3
[NULL @ 0x55ca1277ff60] nal_unit_type: 8, nal_ref_idc: 3
[h264 @ 0x55ca1277ff60] nal_unit_type: 7, nal_ref_idc: 3
[h264 @ 0x55ca1277ff60] nal_unit_type: 8, nal_ref_idc: 3
[h264 @ 0x55ca1277ff60] nal_unit_type: 7, nal_ref_idc: 3
[h264 @ 0x55ca1277ff60] nal_unit_type: 8, nal_ref_idc: 3
[h264 @ 0x55ca1277ff60] nal_unit_type: 5, nal_ref_idc: 3
[h264 @ 0x55ca1277ff60] Reinit context to 1280x720, pix_fmt: yuv420p
[h264 @ 0x55ca1277ff60] no picture 
[live_flv @ 0x55ca12773540] Negative cts, previous timestamps might be wrong.
[live_flv @ 0x55ca12773540] Invalid timestamps stream=0, pts=-998, dts=0, size=18085
[live_flv @ 0x55ca12773540] Invalid timestamps stream=0, pts=-1065, dts=0, size=2938
[live_flv @ 0x55ca12773540] Invalid timestamps stream=0, pts=-1097, dts=0, size=629
[live_flv @ 0x55ca12773540] Non-increasing DTS in stream 0: packet 2 with DTS 0, packet 3 with DTS 0
[live_flv @ 0x55ca12773540] Invalid timestamps stream=0, pts=-1031, dts=0, size=1445
[live_flv @ 0x55ca12773540] Non-increasing DTS in stream 0: packet 3 with DTS 0, packet 4 with DTS 0
[live_flv @ 0x55ca12773540] Invalid timestamps stream=0, pts=-865, dts=0, size=16995
[live_flv @ 0x55ca12773540] Non-increasing DTS in stream 0: packet 4 with DTS 0, packet 5 with DTS 0
[live_flv @ 0x55ca12773540] Invalid timestamps stream=0, pts=-931, dts=0, size=2886
[live_flv @ 0x55ca12773540] Non-increasing DTS in stream 0: packet 5 with DTS 0, packet 6 with DTS 0
[live_flv @ 0x55ca12773540] Invalid timestamps stream=0, pts=-964, dts=0, size=232
[live_flv @ 0x55ca12773540] Non-increasing DTS in stream 0: packet 6 with DTS 0, packet 7 with DTS 0
[live_flv @ 0x55ca12773540] Invalid timestamps stream=0, pts=-898, dts=0, size=2077
[live_flv @ 0x55ca12773540] Non-increasing DTS in stream 0: packet 7 with DTS 0, packet 8 with DTS 0
[live_flv @ 0x55ca12773540] Invalid timestamps stream=0, pts=-797, dts=0, size=22396
[live_flv @ 0x55ca12773540] Non-increasing DTS in stream 0: packet 8 with DTS 0, packet 9 with DTS 0
[live_flv @ 0x55ca12773540] Invalid timestamps stream=0, pts=-831, dts=0, size=2046
[live_flv @ 0x55ca12773540] Non-increasing DTS in stream 0: packet 9 with DTS 0, packet 10 with DTS 0
[live_flv @ 0x55ca12773540] Invalid timestamps stream=0, pts=-665, dts=0, size=17674
[live_flv @ 0x55ca12773540] Non-increasing DTS in stream 0: packet 10 with DTS 0, packet 11 with DTS 0
[live_flv @ 0x55ca12773540] Invalid timestamps stream=0, pts=-731, dts=0, size=2158
[live_flv @ 0x55ca12773540] Non-increasing DTS in stream 0: packet 11 with DTS 0, packet 12 with DTS 0
[live_flv @ 0x55ca12773540] Invalid timestamps stream=0, pts=-764, dts=0, size=185
[live_flv @ 0x55ca12773540] Non-increasing DTS in stream 0: packet 12 with DTS 0, packet 13 with DTS 0
[live_flv @ 0x55ca12773540] Invalid timestamps stream=0, pts=-698, dts=0, size=1141
[live_flv @ 0x55ca12773540] Non-increasing DTS in stream 0: packet 13 with DTS 0, packet 14 with DTS 0
[live_flv @ 0x55ca12773540] Invalid timestamps stream=0, pts=-597, dts=0, size=18292
[live_flv @ 0x55ca12773540] Non-increasing DTS in stream 0: packet 14 with DTS 0, packet 15 with DTS 0
[live_flv @ 0x55ca12773540] Invalid timestamps stream=0, pts=-631, dts=0, size=712
[live_flv @ 0x55ca12773540] Non-increasing DTS in stream 0: packet 15 with DTS 0, packet 16 with DTS 0
[live_flv @ 0x55ca12773540] Invalid timestamps stream=0, pts=-465, dts=0, size=14849
[live_flv @ 0x55ca12773540] Non-increasing DTS in stream 0: packet 16 with DTS 0, packet 17 with DTS 0
[live_flv @ 0x55ca12773540] Invalid timestamps stream=0, pts=-531, dts=0, size=1222
[live_flv @ 0x55ca12773540] Non-increasing DTS in stream 0: packet 17 with DTS 0, packet 18 with DTS 0
[live_flv @ 0x55ca12773540] Invalid timestamps stream=0, pts=-564, dts=0, size=137
[live_flv @ 0x55ca12773540] Non-increasing DTS in stream 0: packet 18 with DTS 0, packet 19 with DTS 0
[live_flv @ 0x55ca12773540] Invalid timestamps stream=0, pts=-498, dts=0, size=624
[live_flv @ 0x55ca12773540] Non-increasing DTS in stream 0: packet 19 with DTS 0, packet 20 with DTS 0
[live_flv @ 0x55ca12773540] Invalid timestamps stream=0, pts=-397, dts=0, size=16457
[live_flv @ 0x55ca12773540] Non-increasing DTS in stream 0: packet 20 with DTS 0, packet 21 with DTS 0
[live_flv @ 0x55ca12773540] Invalid timestamps stream=0, pts=-431, dts=0, size=620
[live_flv @ 0x55ca12773540] Non-increasing DTS in stream 0: packet 21 with DTS 0, packet 22 with DTS 0
[live_flv @ 0x55ca12773540] Invalid timestamps stream=0, pts=-265, dts=0, size=13678
[live_flv @ 0x55ca12773540] Non-increasing DTS in stream 0: packet 22 with DTS 0, packet 23 with DTS 0
[live_flv @ 0x55ca12773540] Invalid timestamps stream=0, pts=-331, dts=0, size=788
[live_flv @ 0x55ca12773540] Non-increasing DTS in stream 0: packet 23 with DTS 0, packet 24 with DTS 0
[live_flv @ 0x55ca12773540] Invalid timestamps stream=0, pts=-364, dts=0, size=2394
[live_flv @ 0x55ca12773540] Non-increasing DTS in stream 0: packet 24 with DTS 0, packet 25 with DTS 0
[live_flv @ 0x55ca12773540] Invalid timestamps stream=0, pts=-298, dts=0, size=10418
[live_flv @ 0x55ca12773540] Non-increasing DTS in stream 0: packet 25 with DTS 0, packet 26 with DTS 0
[live_flv @ 0x55ca12773540] Invalid timestamps stream=0, pts=-131, dts=0, size=15321
[live_flv @ 0x55ca12773540] Non-increasing DTS in stream 0: packet 26 with DTS 0, packet 27 with DTS 0
[live_flv @ 0x55ca12773540] Invalid timestamps stream=0, pts=-198, dts=0, size=5513
[live_flv @ 0x55ca12773540] Non-increasing DTS in stream 0: packet 27 with DTS 0, packet 28 with DTS 0
[live_flv @ 0x55ca12773540] Invalid timestamps stream=0, pts=-231, dts=0, size=10418
[live_flv @ 0x55ca12773540] Non-increasing DTS in stream 0: packet 28 with DTS 0, packet 29 with DTS 0
[live_flv @ 0x55ca12773540] Invalid timestamps stream=0, pts=-164, dts=0, size=10417
[live_flv @ 0x55ca12773540] Non-increasing DTS in stream 0: packet 29 with DTS 0, packet 30 with DTS 0
[live_flv @ 0x55ca12773540] Non-increasing DTS in stream 0: packet 30 with DTS 0, packet 31 with DTS 0
[live_flv @ 0x55ca12773540] Invalid timestamps stream=0, pts=-65, dts=0, size=3289
[live_flv @ 0x55ca12773540] Non-increasing DTS in stream 0: packet 31 with DTS 0, packet 32 with DTS 0
[live_flv @ 0x55ca12773540] Invalid timestamps stream=0, pts=-97, dts=0, size=10417
[live_flv @ 0x55ca12773540] Non-increasing DTS in stream 0: packet 32 with DTS 0, packet 33 with DTS 0
[live_flv @ 0x55ca12773540] Invalid timestamps stream=0, pts=-31, dts=0, size=10418
[live_flv @ 0x55ca12773540] Non-increasing DTS in stream 0: packet 33 with DTS 0, packet 34 with DTS 0
[live_flv @ 0x55ca12773540] Non-increasing DTS in stream 0: packet 34 with DTS 0, packet 35 with DTS 0
[live_flv @ 0x55ca12773540] All info found
[live_flv @ 0x55ca12773540] rfps: 29.666667 0.016552
[live_flv @ 0x55ca12773540] rfps: 29.750000 0.009347
[live_flv @ 0x55ca12773540] rfps: 29.833333 0.004197
[live_flv @ 0x55ca12773540] rfps: 29.916667 0.001104
[live_flv @ 0x55ca12773540] rfps: 30.000000 0.000067
    Last message repeated 1 times
[live_flv @ 0x55ca12773540] rfps: 60.000000 0.000270
    Last message repeated 1 times
[live_flv @ 0x55ca12773540] rfps: 120.000000 0.001079
    Last message repeated 1 times
[live_flv @ 0x55ca12773540] rfps: 240.000000 0.004316
    Last message repeated 1 times
[live_flv @ 0x55ca12773540] rfps: 29.970030 0.000204
    Last message repeated 1 times
[live_flv @ 0x55ca12773540] rfps: 59.940060 0.000814
    Last message repeated 1 times
[live_flv @ 0x55ca12773540] After avformat_find_stream_info() pos: 1020131 bytes read:1020131 seeks:0 frames:138
Input #0, live_flv, from 'rtmp://server.net/app/incoming.stream':
  Metadata:
    fileSize        : 0
    audiochannels   : 8
    2.1             : false
    3.0             : false
    4.0             : false
    quad            : false
    3.1             : false
    5.0             : false
    4.1             : false
    6.0             : false
    5.1             : false
    6.1             : false
    7.0             : false
    7.1             : true
    octagonal       : true
    9.0             : false
    10.0            : false
    11.0            : false
    12.0            : false
    13.0            : false
    14.0            : false
    15.0            : false
    16.0            : false
    encoder         : obs-output module (libobs version 25.0.8win-2-g4d8a00530)
  Duration: 00:00:00.00, start: 0.000000, bitrate: N/A
    Stream #0:0, 76, 1/1000: Video: h264 (High), 1 reference frame, yuv420p(progressive, left), 1280x720, 0/1, 2560 kb/s, 30 fps, 30 tbr, 1k tbn, 60 tbc
    Stream #0:1, 62, 1/1000: Audio: aac (LC), 48000 Hz, octagonal, fltp, 1048 kb/s
Successfully opened the file.
detected 24 logical cores
[Parsed_aformat_0 @ 0x55ca128cb0c0] Setting 'channel_layouts' to value 'octagonal'
[Parsed_pan_1 @ 0x55ca128cb680] Setting 'args' to value 'mono|c0=c0'
Parsing a group of options: output url rtmp://server.net/app/outme.stream.
Applying option map (set input stream mapping) with argument 0:v.
Applying option map (set input stream mapping) with argument [a0].
Applying option c:v:0 (codec name) with argument libx264.
Applying option b:v:0 (video bitrate (please use -b:v)) with argument 3.8M.
Applying option profile:v:0 (set profile) with argument high.
Applying option c:a:0 (codec name) with argument aac.
Applying option b:a:0 (video bitrate (please use -b:v)) with argument 64k.
Applying option f (force format) with argument flv.
Successfully parsed a group of options.
Opening an output file: rtmp://server.net/app/outme.stream.
[rtmp @ 0x55ca128cc980] No default whitelist set
[tcp @ 0x55ca128cb8e0] No default whitelist set
[rtmp @ 0x55ca128cc980] Handshaking...
[rtmp @ 0x55ca128cc980] Type answer 3
[rtmp @ 0x55ca128cc980] Server version 3.0.1.1
[rtmp @ 0x55ca128cc980] Proto = rtmp, path = /app/outme.stream, app = app, fname = outme.stream
[rtmp @ 0x55ca128cc980] Window acknowledgement size = 2500000
[rtmp @ 0x55ca128cc980] Max sent, unacked = 2500000
[rtmp @ 0x55ca128cc980] New incoming chunk size = 4096
[rtmp @ 0x55ca128cc980] Releasing stream...
[rtmp @ 0x55ca128cc980] FCPublish stream...
[rtmp @ 0x55ca128cc980] Creating stream...
[rtmp @ 0x55ca128cc980] Sending publish command for 'outme.stream'
Successfully opened the file.
[h264 @ 0x55ca128c6180] nal_unit_type: 7, nal_ref_idc: 3
[h264 @ 0x55ca128c6180] nal_unit_type: 8, nal_ref_idc: 3
Stream mapping:
  Stream #0:1 (aac) -> aformat (graph 0)
  Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
  pan (graph 0) -> Stream #0:1 (aac)
Press [q] to stop, [?] for help
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
    Last message repeated 1 times
[h264 @ 0x55ca128c6180] nal_unit_type: 7, nal_ref_idc: 3
[h264 @ 0x55ca128c6180] nal_unit_type: 8, nal_ref_idc: 3
[h264 @ 0x55ca128c6180] nal_unit_type: 5, nal_ref_idc: 3
[h264 @ 0x55ca128c6180] Reinit context to 1280x720, pix_fmt: yuv420p
[h264 @ 0x55ca128c6180] no picture 
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
[h264 @ 0x55ca12890d80] nal_unit_type: 1, nal_ref_idc: 2
[h264 @ 0x55ca12890d80] no picture 
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
[h264 @ 0x55ca127cd720] nal_unit_type: 1, nal_ref_idc: 2
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
[h264 @ 0x55ca128a35a0] nal_unit_type: 1, nal_ref_idc: 0
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
[h264 @ 0x55ca127b7940] nal_unit_type: 1, nal_ref_idc: 0
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
[h264 @ 0x55ca128b8ca0] nal_unit_type: 1, nal_ref_idc: 2
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
[h264 @ 0x55ca129509a0] nal_unit_type: 1, nal_ref_idc: 2
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
[h264 @ 0x55ca128115a0] nal_unit_type: 1, nal_ref_idc: 0
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
[h264 @ 0x55ca1286dde0] nal_unit_type: 1, nal_ref_idc: 0
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
[h264 @ 0x55ca128743c0] nal_unit_type: 1, nal_ref_idc: 2
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
[h264 @ 0x55ca12a9ec20] nal_unit_type: 1, nal_ref_idc: 0
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
[h264 @ 0x55ca12abab80] nal_unit_type: 1, nal_ref_idc: 2
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
[h264 @ 0x55ca12ad6ae0] nal_unit_type: 1, nal_ref_idc: 2
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
[h264 @ 0x55ca12af2a40] nal_unit_type: 1, nal_ref_idc: 0
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
[h264 @ 0x55ca12b0e9a0] nal_unit_type: 1, nal_ref_idc: 0
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
[h264 @ 0x55ca12b2a900] nal_unit_type: 1, nal_ref_idc: 2
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
[h264 @ 0x55ca128c6180] nal_unit_type: 1, nal_ref_idc: 0
[h264 @ 0x55ca12890d80] nal_unit_type: 1, nal_ref_idc: 2
[graph 1 input from stream 0:0 @ 0x55ca127a7380] Setting 'video_size' to value '1280x720'
[graph 1 input from stream 0:0 @ 0x55ca127a7380] Setting 'pix_fmt' to value '0'
[graph 1 input from stream 0:0 @ 0x55ca127a7380] Setting 'time_base' to value '1/1000'
[graph 1 input from stream 0:0 @ 0x55ca127a7380] Setting 'pixel_aspect' to value '0/1'
[graph 1 input from stream 0:0 @ 0x55ca127a7380] Setting 'sws_param' to value 'flags=2'
[graph 1 input from stream 0:0 @ 0x55ca127a7380] Setting 'frame_rate' to value '30/1'
[graph 1 input from stream 0:0 @ 0x55ca127a7380] w:1280 h:720 pixfmt:yuv420p tb:1/1000 fr:30/1 sar:0/1 sws_param:flags=2
[format @ 0x55ca127a7f80] Setting 'pix_fmts' to value 'yuv420p|yuvj420p|yuv422p|yuvj422p|yuv444p|yuvj444p|nv12|nv16|nv21'
[AVFilterGraph @ 0x55ca127a4100] query_formats: 4 queried, 3 merged, 0 already done, 0 delayed
[libx264 @ 0x55ca127b2720] using mv_range_thread = 24
[libx264 @ 0x55ca127b2720] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 AVX2 LZCNT BMI2
[libx264 @ 0x55ca127b2720] profile High, level 3.1
[libx264 @ 0x55ca127b2720] 264 - core 148 r2748 97eaef2 - H.264/MPEG-4 AVC codec - Copyleft 2003-2016 - 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=22 lookahead_threads=3 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=abr mbtree=1 bitrate=3800 ratetol=1.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
    Last message repeated 1 times
[h264 @ 0x55ca127cd720] nal_unit_type: 1, nal_ref_idc: 2
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
    Last message repeated 1 times
*** dropping frame 1 from stream 0 at ts -33
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
    Last message repeated 1 times
[h264 @ 0x55ca128a35a0] nal_unit_type: 1, nal_ref_idc: 0
*** dropping frame 1 from stream 0 at ts -32
[h264 @ 0x55ca127b7940] nal_unit_type: 1, nal_ref_idc: 0
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
    Last message repeated 1 times
*** dropping frame 1 from stream 0 at ts -31
[h264 @ 0x55ca128b8ca0] nal_unit_type: 1, nal_ref_idc: 2
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
    Last message repeated 1 times
*** dropping frame 1 from stream 0 at ts -30
[h264 @ 0x55ca129509a0] nal_unit_type: 1, nal_ref_idc: 0
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
    Last message repeated 1 times
*** dropping frame 1 from stream 0 at ts -29
[h264 @ 0x55ca128115a0] nal_unit_type: 1, nal_ref_idc: 2
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
    Last message repeated 1 times
*** dropping frame 1 from stream 0 at ts -28
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
    Last message repeated 1 times
[h264 @ 0x55ca1286dde0] nal_unit_type: 1, nal_ref_idc: 2
[h264 @ 0x55ca128743c0] nal_unit_type: 1, nal_ref_idc: 0
*** dropping frame 1 from stream 0 at ts -27
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
    Last message repeated 1 times
[h264 @ 0x55ca128743c0] nal_unit_type: 12, nal_ref_idc: 0
[h264 @ 0x55ca12a9ec20] nal_unit_type: 1, nal_ref_idc: 0
[h264 @ 0x55ca12a9ec20] nal_unit_type: 12, nal_ref_idc: 0
*** dropping frame 1 from stream 0 at ts -26
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
    Last message repeated 1 times
*** dropping frame 1 from stream 0 at ts -25
[h264 @ 0x55ca12abab80] nal_unit_type: 1, nal_ref_idc: 2
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
    Last message repeated 1 times
*** dropping frame 1 from stream 0 at ts -24
[h264 @ 0x55ca12ad6ae0] nal_unit_type: 1, nal_ref_idc: 2
[h264 @ 0x55ca12ad6ae0] nal_unit_type: 12, nal_ref_idc: 0
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
    Last message repeated 1 times
*** dropping frame 1 from stream 0 at ts -23
[h264 @ 0x55ca12af2a40] nal_unit_type: 1, nal_ref_idc: 0
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
    Last message repeated 1 times
[h264 @ 0x55ca12af2a40] nal_unit_type: 12, nal_ref_idc: 0
*** dropping frame 1 from stream 0 at ts -22
[h264 @ 0x55ca12b0e9a0] nal_unit_type: 1, nal_ref_idc: 0
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
    Last message repeated 1 times
[h264 @ 0x55ca12b0e9a0] nal_unit_type: 12, nal_ref_idc: 0
*** dropping frame 1 from stream 0 at ts -21
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
    Last message repeated 1 times
[h264 @ 0x55ca12b2a900] nal_unit_type: 1, nal_ref_idc: 2
*** dropping frame 1 from stream 0 at ts -20
[h264 @ 0x55ca128c6180] nal_unit_type: 1, nal_ref_idc: 2
[h264 @ 0x55ca128c6180] nal_unit_type: 12, nal_ref_idc: 0
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
    Last message repeated 1 times
*** dropping frame 1 from stream 0 at ts -19
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
    Last message repeated 1 times
[h264 @ 0x55ca12890d80] nal_unit_type: 1, nal_ref_idc: 0
[h264 @ 0x55ca12890d80] nal_unit_type: 12, nal_ref_idc: 0
[h264 @ 0x55ca127cd720] nal_unit_type: 1, nal_ref_idc: 0
[h264 @ 0x55ca127cd720] nal_unit_type: 12, nal_ref_idc: 0
*** dropping frame 1 from stream 0 at ts -18
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
    Last message repeated 1 times
*** dropping frame 1 from stream 0 at ts -17
[h264 @ 0x55ca128a35a0] nal_unit_type: 1, nal_ref_idc: 2
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
    Last message repeated 1 times
[Parsed_aformat_0 @ 0x55ca12dfc700] Setting 'channel_layouts' to value 'octagonal'
[Parsed_pan_1 @ 0x55ca132dff20] Setting 'args' to value 'mono|c0=c0'
[graph_0_in_0_1 @ 0x55ca128833a0] Setting 'time_base' to value '1/48000'
[graph_0_in_0_1 @ 0x55ca128833a0] Setting 'sample_rate' to value '48000'
[graph_0_in_0_1 @ 0x55ca128833a0] Setting 'sample_fmt' to value 'fltp'
[graph_0_in_0_1 @ 0x55ca128833a0] Setting 'channel_layout' to value '0x737'
[graph_0_in_0_1 @ 0x55ca128833a0] tb:1/48000 samplefmt:fltp samplerate:48000 chlayout:0x737
[format_out_0_1 @ 0x55ca127a0460] Setting 'sample_fmts' to value 'fltp'
[format_out_0_1 @ 0x55ca127a0460] Setting 'sample_rates' to value '96000|88200|64000|48000|44100|32000|24000|22050|16000|12000|11025|8000|7350'
[AVFilterGraph @ 0x55ca12816540] query_formats: 5 queried, 12 merged, 0 already done, 0 delayed
[Parsed_pan_1 @ 0x55ca132dff20] [SWR @ 0x55ca13a58aa0] Using fltp internally between filters
[Parsed_pan_1 @ 0x55ca132dff20] o0 = 1 i0 + 0 i1 + 0 i2 + 0 i3 + 0 i4 + 0 i5 + 0 i6 + 0 i7
[Parsed_pan_1 @ 0x55ca132dff20] Pure channel mapping detected: 0
Output #0, flv, to 'rtmp://server.net/app/outme.stream':
  Metadata:
    fileSize        : 0
    audiochannels   : 8
    2.1             : false
    3.0             : false
    4.0             : false
    quad            : false
    3.1             : false
    5.0             : false
    4.1             : false
    6.0             : false
    5.1             : false
    6.1             : false
    7.0             : false
    7.1             : true
    octagonal       : true
    9.0             : false
    10.0            : false
    11.0            : false
    12.0            : false
    13.0            : false
    14.0            : false
    15.0            : false
    16.0            : false
    encoder         : Lavf58.0.102
    Stream #0:0, 0, 1/1000: Video: h264 (libx264), 1 reference frame ([7][0][0][0] / 0x0007), yuv420p(progressive, left), 1280x720, 0/1, q=-1--1, 3800 kb/s, 30 fps, 1k tbn, 30 tbc
    Metadata:
      encoder         : Lavc58.1.100 libx264
    Side data:
      cpb: bitrate max/min/avg: 0/0/3800000 buffer size: 0 vbv_delay: -1
    Stream #0:1, 0, 1/1000: Audio: aac (LC) ([10][0][0][0] / 0x000A), 48000 Hz, mono, fltp, delay 1024, 64 kb/s
    Metadata:
      encoder         : Lavc58.1.100 aac
pkviet commented 4 years ago

there's a metadata issue where both 7.1 and 8.0 are signalled, but that's not the explanation. Apart from that you're not using my pce2 branch (unless you rebased ?); i don't recognize the hash number. I'll investigate further.

pkviet commented 4 years ago

ps: in the ffmpeg log, if you're using my pce2 branch of FFmpeg, there should be this entry: [aac @ xxxxxxx] Using PCE table: channel layout decoded as octagonal (0x737) I don't see it.

ohmercy commented 4 years ago

Sorry, you are right. I used a different version by mistake.

With your pce2 branch I am receiving the correct audio on first channel !

pkviet commented 4 years ago

ok great. Just check the other channels. Should be fine. 8.0 is not a default channel layout in aac spec so it's encoded with a channelConfiguration = 0 , meaning it requires additional info provided by what is called a pce (which will give the channel positions for each audio channel). Currently the native aac decoder is unable to decode pce and resorts to guesswork. So you'll have to resort to my code.

ohmercy commented 4 years ago

Thanks for the clarification. We will try tomorrow with 8 and 16 channels.

ohmercy commented 4 years ago

Tested with 16ch mapping in OBS, SDI input with 12 actual tracks. FFmpeg pce2 received all tracks in the right order!

Thank you so much for the great support and awesome tools !!