<p>So editing the buffer's header is the next step?</p>
<div class="gmail_quote">On Dec 29, 2011 11:24 AM, "Alex Cohn" <<a href="mailto:alexcohn@netvision.net.il">alexcohn@netvision.net.il</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
On Wed, Dec 28, 2011 at 23:55, Neil Menne <<a href="mailto:nhmenne42@students.tntech.edu">nhmenne42@students.tntech.edu</a>> wrote:<br>
> I'll start from the beginning to see if we can find the problem: I do the<br>
> register all; I do a find_decoder (which is currently looking for<br>
> "CODEC_ID_H264"); if that's successful, I allocate the context (using<br>
> alloc_context3); I then do an avcodec_open2 with arguments of my context, my<br>
> codec, and NULL for the dictionary; if this succeeds, I allocate the frame;<br>
> next, I initialize a packet and set the packets data to the buffer I<br>
> received which contains the H264 video; if that all works, i do a<br>
> decode_video2.<br>
><br>
> The return is a -1 as i save it to a unique variable and print the result<br>
> immediately; it also states that whole "no frame!" prior to my printout of<br>
> the result.<br>
<br>
It's natural to receive -1 from decode_video2() for the first few<br>
frames -- the number depends on your stream (how many b-frames are<br>
allowed). The question about -1 pops up from time to time. The problem<br>
is, some H264 streams or files have non-zero b-frame count in the<br>
header, even if they actually carry no b-frames. It is not<br>
unacceptable to edit the header before it is interpreted by the H264<br>
decoder, to reset the flag to zero.<br>
<br>
> I feel like it's tied into either the AVCodecContext or the AVPacket<br>
> (something I'm not populating in the packet besides supplying the buffer);<br>
> but that's just a guess at this point.<br>
><br>
> Thanks for taking time to look at this problem.<br>
><br>
> -Neil<br>
><br>
> P.S. If it matters, I'm using Live555 (because I need direct access to some<br>
> of the RTP related data) to pull down my RTSP stream and passing along the<br>
> buffer it returns.<br>
><br>
> On Wed, Dec 28, 2011 at 4:39 AM, Alex Cohn <<a href="mailto:alexcohn@netvision.net.il">alexcohn@netvision.net.il</a>><br>
> wrote:<br>
>><br>
>> On Wed, Dec 28, 2011 at 01:19, Neil Menne <<a href="mailto:nhmenne42@students.tntech.edu">nhmenne42@students.tntech.edu</a>><br>
>> wrote:<br>
>> > How do I pass a raw buffer into this function?<br>
>> ><br>
>> > I find the appropriate codec and codec context, allocate the AVFrame,<br>
>> > and<br>
>> > initialize the packet. When I try and set the packet's data to the<br>
>> > buffer:<br>
>> > AVPacket packet;<br>
>> > av_init_packet(&packet);<br>
>> > packet.data = buf;<br>
>> ><br>
>> > where buf is the buffer received; I'm getting an error that seems to be<br>
>> > unrelated. It says "no frame!" and returns -1.<br>
>><br>
>> Are you sure you receive -1 from the code above? maybe, some important<br>
>> line of code is missing in your post?<br>
>> -Alex<br>
>><br>
>> > If it helps, my AVFrame is initialized with:<br>
>> > codecFrame = avcodec_alloc_frame();<br>
>> ><br>
>> > -Neil<br>
_______________________________________________<br>
Libav-user mailing list<br>
<a href="mailto:Libav-user@ffmpeg.org">Libav-user@ffmpeg.org</a><br>
<a href="http://ffmpeg.org/mailman/listinfo/libav-user" target="_blank">http://ffmpeg.org/mailman/listinfo/libav-user</a><br>
</blockquote></div>