OK I found my problem. swscale is not guilty. But a solution is far away.
I copied some h.264 coded frames in to a buffer and let av_decode_video()
decode it. The stream in the buffer started with an i-slice. I get some
frames decoded all these pictures have the same size and are not displayable.
Damn. But if I save my buffer into a file named buffer.264 the mplayer shows
me my extracted pictures. So what is my fault?
BTW. My decoding function looks like this (its a terrible test code but for
mpeg2 it worked):
<snip>
do
{
if (packet.stream_index == mStreamID)
{
memcpy(&h264buffer[bufP], packet.data, packet.size);
bufP += packet.size;
if (framesToCopy == 0)
{
decoding = true;
}
else
decoding = false;
framesToCopy--;
}
if (decoding)
{
if (mPCodecCtx->codec_id == CODEC_ID_H264)
{
do
{
bytesDecoded = avcodec_decode_video(mPCodecCtx, frame,
&frameFinished,
h264buffer, bufP);
} while (!frameFinished);
}
if (frameFinished && decoding)
{
cout << frame->pict_type << " dekodiert!" << endl;
break;
}
}
}
} while (mPAVFile->readFrame(filenr, &packet) >= 0);
<snap>
Thank you.
regards,
Sven
Am Wednesday 05 August 2009 14:50:57 schrieb Sven Alisch:
> I want to add something to my last mail Stephan. Did you decode frames from
> your h.264-files? I could decode a frame but my program crashes now, if I
> want to transform it to a rgb-file with the help of swscale.
>
> If you could decode your frames, could you paste the interessting code
> snippets here? Thank you very much.
>
> regards,
> Sven
>
> PS: With MPEG2 and swscale it works.
>
> Am Wednesday 05 August 2009 13:50:26 schrieb Sven Alisch:
> > > What version of the library are you using? I am using the 0.5 release
> > > and there is works well for 1080i in "AVC-HD" clips from my Sony
> > > Camera, i.e. the special mpegts container with h.264 stream.
> >
> > I am using the svn version I've downloaded last week.
> >
> > > IMHO, it doesn't work perfect, since I think it is an error to report a
> > > field rate of 50.0 (correct) from the libavformat, but reporting a
> > > frame height of the full frame (does not match the frame rate), and
> > > also decoding only complete frames (at 25.0 fps) later on in
> > > libavcodec. Of course if you use libavcodec to do the deinterlacing,
> > > and if you ignore the incorrect frame rate, it is actually more
> > > convenient. I would just like a flag from the demuxer, which tells you
> > > *before* decoding if something will be interlaced.
> >
> > I use 1080i streams from Sky Cinema HD (SatTV). I see that my seek to
> > I-Slices work. Now I tried following. I use av_seek_frame to seek to an
> > I-Slice (my streams does not have IDR-Frames). This works. If I use
> > av_read_frame to read frames and save the AVPacket.data into a normal
> > file (e.g. buffer.264), then I get the Frame if I test it with mplayer.
> > GREAT! But I wonder why my Frame will not decoded with the help of
> > av_decode_video with:
> >
> > bytesDecoded = avcodec_decode_video(mPCodecCtx, frame, &frameFinished,
> > packet.data, packet.size);
> >
> > Do you get your frames decoded with libav?
> >
> > Best regards,
> > Sven
> >
> > > Best regards,
> > > -Stephan
> > > _______________________________________________
> > > libav-user mailing list
> > > [email protected]
> > > https://lists.mplayerhq.hu/mailman/listinfo/libav-user
> >
> > _______________________________________________
> > libav-user mailing list
> > [email protected]
> > https://lists.mplayerhq.hu/mailman/listinfo/libav-user
>
> _______________________________________________
> libav-user mailing list
> [email protected]
> https://lists.mplayerhq.hu/mailman/listinfo/libav-user
_______________________________________________
libav-user mailing list
[email protected]
https://lists.mplayerhq.hu/mailman/listinfo/libav-user