On Tuesday 15 January 2008, Stefan Lucke wrote:
On Tuesday 15 January 2008, Reinhard Nissl wrote:
Hi,
Stefan Lucke schrieb:
is it correct that h264 is written as PES via PlayVideo() ?
For decoding with ffmpeg it would be useful to have a PROGRAM_STREAM_MAP in front of a new video stream.
Basically not a bad idea, but where do you put it in live streaming?
I think it should be transmitted first, after a stream reset. A basic PSM that maps from PES 0x01e0 to h264 could look like: unsigned char psm_map_0xe0_to_h264 [] = { 0x00, 0x00, 0x01, 0xbc, 0x00, 0x10, // psm length 0x00, 0x00, // unknown 0x00, 0x00, // info length // info data here 0x00, 0x04 // map length // map data here 0x1b, 0xe0, 0x00, 0x00 // h264 map entry / NO map info 0x00, 0x00, 0x00, 0x00 // crc32 };
That is inspired by ffmpegs: libavformat/mpeg.c mpegps_psm_parse() line ~220 .
And now I know that softdevice can switch between h264 and mpeg2 when using the following addition (file remux.c line ~2552):
#define TEST_cVideoRepacker #ifdef TEST_cVideoRepacker ts2pes[numTracks++] = new cTS2PES(VPid, resultBuffer, IPACKS, 0xE0, 0x00, new cVideoRepacker(h264)); #else ts2pes[numTracks++] = new cTS2PES(VPid, resultBuffer, IPACKS, 0xE0); #endif -- cut -- if (h264) { resultBuffer->Put (psm_map_0xe0_to_h264, sizeof (psm_map_0xe0_to_h264)); fprintf(stderr, "---- is h264\n"); } else { fprintf(stderr, "---- is NO h264\n"); } -- cut --
The bad thing is, PSM info should be repeated more often, as the decoder may reset itself due to bad reception (ahead of each video packet ??).
Or is there a simpler way to recognize h264 (or other codecs) as Klaus demands?
Stefan Lucke