http://id3.org/id3v2.3.0
@turbidwater flashls supports parsing of ID3 tags embedded in MPEG2-TS.
ID3 PID is detected by parsing the PMT (ID3 PID stream type = 0x15)
this seems consistent with the pointer on apple spec found on your link (https://developer.apple.com/library/ios/documentation/AudioVideo/Conceptual/HTTP_Live_Streaming_Metadata_Spec/Introduction/Introduction.html)
please first check that you get this log:
https://github.com/mangui/flashls/blob/dev/src/org/mangui/hls/demux/TSDemuxer.as#L814
if any ID3 tag is found, then you should be able to retrieve them by listening to ID3_UPDATED event, which is triggered from here (flashls is internally listening to onID3Data() NetStream event)
https://github.com/mangui/flashls/blob/1695c63ca9a02fa2d056129b21353f759f620189/src/org/mangui/hls/stream/HLSNetStream.as#L86-L95
//
https://developer.apple.com/library/content/documentation/AudioVideo/Conceptual/HTTP_Live_Streaming_Metadata_Spec/2/2.html
Metadata is carried in MPEG-2 transport streams as described in section 2.12 of reference [1]. HTTP Live Streaming metadata is carried in an elementary stream (PES) instead of, for example, in a carousel. The metadata stream must be in the same program as the main program material (i.e. the audio/video content).
ID3 metadata is self-describing and needs no configuration information, so the provisions for metadata decoder configuration data are not used.
The remainder of section 2 of this specification describes the details of the syntax and field values from section 2 of reference [1] for ID3 format metadata used with HTTP Live Streaming.
In the syntax tables in section 2.3.2 of this specification, the syntax structure (left column) is shown with only the names of fields and the part of the outline that is in effect for ID3 metadata as described in this specification. Conditional blocks for which a condition is false are omitted. The right column in the syntax tables indicates the value needed for each field in this context, or contains an explanation of that field.
The MPEG-2 specification [1] should be consulted for the complete syntax, field sizes, and acceptable values.
ID3 defines both a format and a semantic, and so the same registered format_identifier
is used for both metadata_format_identifier
and metadata_application_format_identifier
.
The registered value for these, at the registration authority (reference [4]), is the four-character string ‘ID3 ’
(the characters I D 3 space,
or 0x49 0x44 0x33 0x20
).
To indicate that a registered value is used, the metadata_format
and metadata_application_format
fields take the values 0xff
and 0xffff
respectively.
The ID3 metadata is carried in a private stream, not a stream formatted as metadata Access Units (MAUs) as defined in 12.4 of [1]. The stream_id
value used for the stream is therefore private_stream_id_1
, 0xbd
, as specified in 2.12.3 of [1]. The stream_type
is set to 0x15
, indicating carriage of metadata in a PES stream, as specified in 2.12.9.1 of [1].
Since only one metadata stream is normally carried, the metadata_service_id
is normally set to 0
; however, any suitable value can be used to distinguish this metadata stream from other metadata streams, if present.
The format and content of the metadata descriptors is documented in sections 2.6.58 to 2.6.61 of [1].
To declare the presence of the metadata stream, a metadata_pointer_descriptor
(2.6.58 of [1]) is placed in the PMT, in the program_info
loop for the program. The metadata must be in the same program as the main program (audio/video) content; the use of this descriptor to refer to another program is not supported.
Syntax | Value |
---|---|
| |
|
|
|
|
|
|
| |
|
|
| |
|
|
| |
|
|
| |
|
|
|
|
|
|
|
|
| |
|
|
| |
| |
The elementary stream carrying the metadata needs to be declared in the loop of elementary streams, in the program map (section 2.4.4.8 of [1]):
Field | Value |
---|---|
|
|
|
|
|
|
|
|
|
|
To declare the format of the metadata stream, a metadata_descriptor
(2.6.60 of [1]) is placed in the PMT, in the es_info
loop for the elementary stream.
Syntax | Value |
---|---|
| |
|
|
|
|
|
|
| |
|
|
| |
|
|
| |
|
|
| |
|
|
|
|
|
|
|
|
ID3 metadata is stored as a complete ID3v4 frame in a PES packet, including a complete ID3 header.
The ID3 tag must start immediately after the PES header; this PES header must contain a PTS (PTS_DTS_flags
set to '10'
). The PTS must be on the same timeline as the audio and video frames. The data_alignment
bit must be set to 1
. The PES header must contain a PES_packet_length
that is non-zero.
If an ID3 tag is longer than 65535 bytes, it must have more than one PES header. The second and following PES headers must have data_alignment
set to 0
, and should have the PTS_DTS_flags
set to ‘00’
(and hence no PTS).
The PES header is formatted as documented in 2.4.3.7 of [1].
PES Syntax | Value |
---|---|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
| |
The metadata stream is incorporated into a transport stream in the same way as audio or video is. For example, in a transport_packet()
(see 2.4.3.2 of [1]) the payload_unit_start_indicator
is set to 1
only when a PES header follows. (The PES header, in turn, indicates whether the start of the ID3 data follows, or whether that has been divided into multiple PES packets).