[FFmpeg-user] Extract HLS from TS

EnoSat enosat at yahoo.com
Wed Aug 14 22:28:05 EEST 2024


 Is it possible to extract streams from a TS file if a stream is stored on a certain pide?
e.g:pid 900
TS sub-decoding (3 packet(s) from 00000064 stored for PID 0x0385):
    =====================================================
    TS contains Section (length=552)...
    SI packet (length=413): 
        PID:  901 (0x0385)

        Guess table from table id...
        DSM-CC DATAGRAM-decoding....
        Table_ID: 62 (0x3e)  [= DSM-CC - private data section  // DVB datagram]
        section_syntax_indicator: 1 (0x01)
        private_indicator: 0 (0x00)
        reserved_1: 3 (0x03)
        Section_length: 410 (0x019a)
        MACaddrbyte/DevicdID 6: 1 (0x01)
        MACaddrbyte/DeviceID 5: 101 (0x65)
        reserved_2: 3 (0x03)
        payload_scrambling_control: 0 (0x00)  [= unscrambled]
        address_scrambling_control: 0 (0x00)  [= unscrambled]
        LLC_SNAP_flag: 0 (0x00)
        current_next_indicator: 1 (0x01)  [= valid now]
        Section_number: 0 (0x00)
        Last_Section_number: 0 (0x00)
        MACaddrbyte/DeviceID 4: 1 (0x01)
        MACaddrbyte/DeviceID 3: 94 (0x5e)
        MACaddrbyte/DeviceID 2: 0 (0x00)
        MACaddrbyte/DeviceID 1: 1 (0x01) => MAC-Address/DeviceID: 01:00:5e:01:65:01

        IP_datagram_bytes:
            Version: 4 (0x04)
            IP header length: 5 (0x05)
            Type of service: 0 (0x00)
            Total length: 397 (0x018d)
            Identification: 0 (0x0000)
            Reserved: 0 (0x00)
            DF: 0 (0x00)
            MF: 0 (0x00)
            Fragment offset: 0 (0x0000)
            Time to live: 128 (0x80)
            Protocol: 17 (0x11)  [= UDP]
            Header checksum: 8236 (0x202c)
            Source address: c0a80489 [= 192.168.4.137]
            Destination address: ef016501 [= 239.1.101.1]

            UDP_datagram: 
               Source port: 7001 (0x1b59)
               Destination port: 7001 (0x1b59)
               Length: 377 (0x0179)
               Checksum: 0 (0x0000)
               Data
                    0000:  12 a0 05 01 00 00 00 00  00 00 00 0a ff ff ff fd   ................
                    0010:  c2 00 01 59 00 00 00 00  23 45 58 54 4d 33 55 0a   ...Y....#EXTM3U.
                    0020:  23 45 58 54 2d 58 2d 56  45 52 53 49 4f 4e 3a 33   #EXT-X-VERSION:3
                    0030:  0a 23 45 58 54 2d 58 2d  4d 45 44 49 41 2d 53 45   .#EXT-X-MEDIA-SE
                    0040:  51 55 45 4e 43 45 3a 32  31 35 34 30 35 37 0a 23   QUENCE:2154057.#
                    0050:  45 58 54 2d 58 2d 54 41  52 47 45 54 44 55 52 41   EXT-X-TARGETDURA
                    0060:  54 49 4f 4e 3a 31 0a 23  45 58 54 49 4e 46 3a 31   TION:1.#EXTINF:1
                    0070:  2e 30 30 30 2c 20 6e 6f  20 64 65 73 63 0a 63 68   .000, no desc.ch
                    0080:  31 2d 32 31 35 34 30 35  37 2e 74 73 0a 23 45 58   1-2154057.ts.#EX
                    0090:  54 49 4e 46 3a 31 2e 30  30 30 2c 20 6e 6f 20 64   TINF:1.000, no d
                    00a0:  65 73 63 0a 63 68 31 2d  32 31 35 34 30 35 38 2e   esc.ch1-2154058.
                    00b0:  74 73 0a 23 45 58 54 49  4e 46 3a 31 2e 30 30 30   ts.#EXTINF:1.000
                    00c0:  2c 20 6e 6f 20 64 65 73  63 0a 63 68 31 2d 32 31   , no desc.ch1-21
                    00d0:  35 34 30 35 39 2e 74 73  0a 23 45 58 54 49 4e 46   54059.ts.#EXTINF
                    00e0:  3a 31 2e 30 30 30 2c 20  6e 6f 20 64 65 73 63 0a   :1.000, no desc.
                    00f0:  63 68 31 2d 32 31 35 34  30 36 30 2e 74 73 0a 23   ch1-2154060.ts.#
                    0100:  45 58 54 49 4e 46 3a 31  2e 30 30 30 2c 20 6e 6f   EXTINF:1.000, no
                    0110:  20 64 65 73 63 0a 63 68  31 2d 32 31 35 34 30 36    desc.ch1-215406
                    0120:  31 2e 74 73 0a 23 45 58  54 49 4e 46 3a 31 2e 30   1.ts.#EXTINF:1.0
                    0130:  30 30 2c 20 6e 6f 20 64  65 73 63 0a 63 68 31 2d   00, no desc.ch1-
                    0140:  32 31 35 34 30 36 32 2e  74 73 0a 23 45 58 54 49   2154062.ts.#EXTI
                    0150:  4e 46 3a 31 2e 30 30 30  2c 20 6e 6f 20 64 65 73   NF:1.000, no des
                    0160:  63 0a 63 68 31 2d 32 31  35 34 30 36 33 2e 74 73   c.ch1-2154063.ts
                    0170:  0a                                                 .

        CRC: 213259279 (0x0cb6140f)
 e.g. so the file header in the TS file is:
#EXTM3U
#EXT-X-VERSION:3
#EXT-X-MEDIA-SEQUENCE:2154079
#EXT-X-TARGETDURATION:1
#EXTINF:1.000, no desc
ch1-2154079.ts
#EXTINF:1.000, no desc
ch1-2154080.ts
#EXTINF:1.000, no desc
ch1-2154081.ts
#EXTINF:1.000, no desc
ch1-2154082.ts
#EXTINF:1.000, no desc
ch1-2154083.ts
#EXTINF:1.000, no desc
ch1-2154084.ts
#EXTINF:1.000, no desc
ch1-2154085.ts


More information about the ffmpeg-user mailing list