I need to insert the following packet, which contains KLV metadata to a Program Stream file. Note this packet has a SCR of 00:00:00.000, as I wanted the metadata at the start of the file, and the KLV metadata is the same as the Day Flight example found https://samples.ffmpeg.org/MPEG2/mpegts-klv/. I’ve also padded it (0x00 0x00 0x01 0xBE
) to be 2048 bytes long, as the standard MPEG-PS packet size.
0x00 0x00 0x01 0xBA 0x44 0x00 0x04 0x00 0x04 0x01 0x00 0xDB 0xBB 0xF8 0x00 0x00 0x01 0xBD 0x00
0xA6 0x84 0x00 0x00 0x06 0x0E 0x2B 0x34 0x02 0x0B 0x01 0x01 0x0E 0x01 0x03 0x01 0x01 0x00 0x00
0x00 0x81 0x91 0x02 0x08 0x00 0x04 0x6C 0x8E 0x20 0x03 0x83 0x85 0x41 0x01 0x01 0x05 0x02 0x3D
0x3B 0x06 0x02 0x15 0x80 0x07 0x02 0x01 0x52 0x0B 0x03 0x45 0x4F 0x4E 0x0C 0x0E 0x47 0x65 0x6F
0x64 0x65 0x74 0x69 0x63 0x20 0x57 0x47 0x53 0x38 0x34 0x0D 0x04 0x4D 0xC4 0xDC 0xBB 0x0E 0x04
0xB1 0xA8 0x6C 0xFE 0x0F 0x02 0x1F 0x4A 0x10 0x02 0x00 0x85 0x11 0x02 0x00 0x4B 0x12 0x04 0x20
0xC8 0xD2 0x7D 0x13 0x04 0xFC 0xDD 0x02 0xD8 0x14 0x04 0xFE 0xB8 0xCB 0x61 0x15 0x04 0x00 0x8F
0x3E 0x61 0x16 0x04 0x00 0x00 0x01 0xC9 0x17 0x04 0x4D 0xDD 0x8C 0x2A 0x18 0x04 0xB1 0xBE 0x9E
0xF4 0x19 0x02 0x0B 0x85 0x28 0x04 0x4D 0xDD 0x8C 0x2A 0x29 0x04 0xB1 0xBE 0x9E 0xF4 0x2A 0x02
0x0B 0x85 0x38 0x01 0x2E 0x39 0x04 0x00 0x8D 0xD4 0x29 0x01 0x02 0x1C 0x5F 0x00 0x00 0x01 0xBE
...
I have ran the command ffmpeg -i Day Flight.mpg -vscale 0 -f mpeg2video output-MPEG-PS.mpg
to convert the Day Flight video to be in a MPEG-PS format. How can I insert that above KLV packet to the output MPEG-PS file, and not corrupt the video.