[Libav-user] remuxing MKV/H.264 to MPEG2 Elemntary Stream
Alex Cohn
alexcohn at netvision.net.il
Sun Feb 19 12:35:41 CET 2012
On Sun, Feb 19, 2012 at 11:22, Pavel Sokolov <pavel at sokolov.me> wrote:
>
> 17.02.2012 23:14, Alex Cohn пишет:
>>
>>
>> Elementary stream does not work for h264. With h264, we speak about a raw
>> video in Appex B byte stream format, see
>> http://wiki.multimedia.cx/index.php?title=H.264.
>>
>> Ffmpeg suppliers conversion to appex B without transcoding.
>>
> My hardware decoder on the embeded device can play MPEG2 PES (packetized
> elementary stream).
> Finally I need to remux H.264 to MPEG2 PES
>
> I manually adding PES header to data returned by "av_read_frame".
> I'm using function "mpegts_write_pes" from libavformat/mpegtsenc.c
> This works fine for MPEG2 video.
>
> Is there some way to remux H264 to PES?
Please have a look at mpegts_write_packet() public function in the
same c file. You notice that it accepts h264 packets in annex B format
only:
libavformat/mpegtsenc.c(977):
if (st->codec->codec_id == CODEC_ID_H264) {
const uint8_t *p = buf, *buf_end = p+size;
uint32_t state = -1;
if (pkt->size < 5 || AV_RB32(pkt->data) != 0x0000001) {
av_log(s, AV_LOG_ERROR, "h264 bitstream malformated, "
"no startcode found, use -vbsf h264_mp4toannexb\n");
return -1;
}
...
Удачи,
Alex Cohn
More information about the Libav-user
mailing list