MPEGTS & HLS: Only second segment onwards is valid When i use hexadecagonal audio channel layout in an mpegts container, I can receive and play back the stream fine only if I configure the hls server to allow serving the very first segment, and then concatenating subsequent segments.  

I.e. If I probe segment 1414:

[mpegts @ 0x7faf58001200] Could not find codec parameters for stream 1 (Audio: aac (LC) ([15][0][0][0] / 0x000F), 0 channels, fltp, 1464 kb/s): unspecified sample rate
Consider increasing the value for the 'analyzeduration' and 'probesize' options

Input #0, mpegts, from '1414.ts':
  Duration: 00:00:02.07, start: 2834.393367, bitrate: 9079 kb/s
  Program 1 
    Stream #0:0[0x100]: Audio: aac (LC) ([15][0][0][0] / 0x000F), 0 channels, fltp, 1430 kb/s
    Stream #0:1[0x101]: Audio: aac (LC) ([15][0][0][0] / 0x000F), 0 channels, fltp, 1464 kb/s
    Stream #0:2[0x102]: Video: h264 (High) ([27][0][0][0] / 0x001B), yuv420p(progressive), 1920x1080 [SAR 1:1 DAR 16:9], 59.94 fps, 59.94 tbr, 90k tbn, 119.88 tbc
    Stream #0:3[0x103]: Video: h264 (High) ([27][0][0][0] / 0x001B), yuv420p(progressive), 1920x1080 [SAR 1:1 DAR 16:9], 60 fps, 60 tbr, 90k tbn, 120 tbc

However if I probe the first segment:

Input #0, mpegts, from '0.ts':
  Duration: 00:00:02.02, start: 1.412033, bitrate: 11598 kb/s
  Program 1 
    Stream #0:0[0x100]: Audio: aac (LC) ([15][0][0][0] / 0x000F), 48000 Hz, 16 channels, fltp, 1353 kb/s
    Stream #0:1[0x101]: Audio: aac (LC) ([15][0][0][0] / 0x000F), 48000 Hz, 16 channels, fltp, 744 kb/s
    Stream #0:2[0x102]: Video: h264 (High) ([27][0][0][0] / 0x001B), yuv420p(progressive), 1920x1080 [SAR 1:1 DAR 16:9], 59.94 fps, 59.94 tbr, 90k tbn, 119.88 tbc
    Stream #0:3[0x103]: Video: h264 (High) ([27][0][0][0] / 0x001B), yuv420p(progressive), 1920x1080 [SAR 1:1 DAR 16:9], 60 fps, 60 tbr, 90k tbn, 120 tbc

The playlist file is very simple and looks like this:

#EXTM3U
#EXT-X-VERSION:3
#EXT-X-MEDIA-SEQUENCE:0
#EXT-X-TARGETDURATION:4

#EXTINF:2.000,
0.ts
#EXTINF:2.000,
1.ts
#EXTINF:2.000,
2.ts
#EXTINF:2.000,
3.ts
#EXTINF:2.000,

etc ...


With say an 8 channel layout, this does not happen.. every segment contains the correct headers.  But my preference is to keep 16 channels because my application at the receiving end uses 16 channel files, and this avoids the need to transcode when downloading.

I am using FFmpeg to upload the mpegts stream.

Any insight to the mechanics behind what's going on here, and what I can do to achieve the desired independence of segments ?
For non-conventional layouts, the native AAC encoder writes a PCE section in the bitstream header as part of the AudioSpecificConfig. However, it does so only at the beginning, therefore subsequent files have AAC streams with this missing.

Workaround is to change to a different packetization scheme for AAC in MPEG-TS.  

Add -hls_ts_options mpegts_flags=latm when generating the HLS package.