[FFmpeg-user] FFmpeg strips descriptors from PMT table (MPEG TS)
Denis Mysenko
duster at mail.ru
Sat Apr 18 03:59:11 CEST 2015
I'm generating HLS (MPEG TS) segments using ffmpeg, like this:
ffmpeg -i ./test1.ts -hls_time 10 -hls_list_size 6 -hls_segment_filename 'testing_%03d.ts' -hls_flags delete_segments -acodec copy -vcodec copy -codec:d copy -map 0:0 -map 0:1 -map 0:2 ./testing.m3u8
Console output looks fine:
Stream #0:0: Video: h264 ([27][0][0][0] / 0x001B), yuv420p, 320x320 [SAR 1:1 DAR 1:1], q=2-31, 24 fps, 24 tbr, 90k tbn, 24 tbc
Stream #0:1(und): Audio: aac ([15][0][0][0] / 0x000F), 44100 Hz, stereo, 64 kb/s
Stream #0:2: Data: timed_id3 (ID3 / 0x20334449)
But then if you analyse new PMT tables generated by FFmpeg, you see that some data has been stripped off, namely:
8 bits: Descriptor tag = 37 (Metadata pointer)
8 bits: Descriptor length = 15
N bits: Descriptor content = FFFF49443320FF49443320001F000
(descriptors are included in PMT right after program info length, when program info length is higher than zero)
Same happens to descriptors associated with elementary PIDs from the PMT:
8 bits: Descriptor tag = 38 (Metadata)
8 bits: Descriptor length = 13
N bits: Descriptor content = FFFF49443320FF49443320000F
Moreover, for some reason stream type of the metadata PID changes from:
8 bits: Stream type = 21 (MetaData in PES)
3 bits: Reserved bits = 111
13 bits: Elementary PID = 259 (dec) / 0x103 (hex)
To:
8 bits: Stream type = 6 (N/A)
3 bits: Reserved bits = 111
13 bits: Elementary PID = 258 (dec) / 0x102 (hex)
So, in short, FFmpeg strips all descriptors (including from program info and the table itself) and changes metadata stream type from (dec) 21 to 6.
Because of this, metadata is no longer accessible in HLS players (tested in iOS). Originally, metadata was injected using Apple HTTP Live Streaming tools.
Any ideas? Any way to prevent FFmpeg from modifying PMT tables and just "copy/paste" the original one instead? I tried the documentation, but no results.
Sincerely,
--
Denis Mysenko, CCNA, MCP, MCSA
Skype: denismysenko, ICQ: 555955
Forskarbacken 9 / 209
10405 Stockholm, Sweden
Mobile: +46 (0) 70 405 49 04
More information about the ffmpeg-user
mailing list