<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
</head>
<body text="#000000" bgcolor="#FFFFFF">
Hi, I have problems decoding h264 video chunks included in a <big>Mp4
</big>video. <br>
As far as I know nal units start with 0x000001 identifier. So I
manage to parse mp4 video, spot the video chunks, re-parse the
chunks to find nal unit identifier, then I reassemble the chunks
and, finally, send the nal units to av_decode_video. In the code
below, the nal unit buffer is tm_buf->buffer, its length is
tm_buf->buf_len<br>
<br>
...<br>
<br>
AVPacket *avpack = &packet ; <br>
<br>
avpack->side_data = NULL;<br>
avpack->side_data_elems = 0; <br>
avpack->data = tm_buf->buffer;<br>
avpack->size = tm_buf->buf_len;<br>
<br>
AVFrame *decoded_frame = NULL;<br>
<br>
if (!decoded_frame) <br>
{<br>
if (!(decoded_frame = avcodec_alloc_frame())) <br>
{<br>
fprintf(stderr, "Could not allocate audio frame\n");<br>
exit(1);<br>
}<br>
} <br>
else<br>
avcodec_get_frame_defaults(decoded_frame); <br>
<br>
len = avcodec_decode_video2( context, decoded_frame,
&got_picture, avpack ) ;<br>
<br>
Unfortunately the output window remains black.<br>
<br>
I do not use av_read_frame to read from the file, because I want to
rewrite the demuxer (as a matter of fact I already have). My
knowledge of h264 is very poor, but why doesn't libav manage to
decode the chunks. In addition, I don't seem to get any error
message. Is there a way to solve all this without having to study
all the stuff about h264?<br>
Luigi<br>
</body>
</html>