[Libav-user] Decoding H264 Frames From RTSP Half the Image is Distorted
Constantin Savtchenko
constantins at neyasystems.com
Mon Jun 25 23:32:24 CEST 2012
Hello all,
I have been attempting to use Live555 to decode an incoming RTSP stream.
Arash has already kindly pointed out that this can be done using url_fopen.
However, I'ld really like to use what I've worked on so far with Live555
which gives me greater control over the RTSP connection. I've gotten pretty
far, I think, but today I took a look at some of the decoded images and they
did not look right. The top half of the image seems okay, while the bottom
half seems distorted, skewed to the right. Other RTSP streams the entire
image is skewed to the right (diagonally, downwards and to right). I would
like to note that av_decode is not spitting out any errors, I managed to
remove all of my errors by setting 'codec_context_->flags2 |=
CODEC_FLAG2_CHUNKS;'
My question is where could the problem lie? I don't know how to approach
debugging this problem, media is not my strong suit. Below, I outline my
approach so far:
- Live555 fills my unsigned char * buffer with a NAL unit and tells
me a frame_size (the size of this NAL unit), it fills it at buffer+4 and the
buffer contains 0x00000001
- I prepend each NAL frame I get from Live555 with 0x00000001 by
giving Live555 the address of the buffer + 4 and pad the end of the same
buffer with 16 bytes of 0
- AVPacket current_frame; is initialized with av_init_packet
- current_frame.size = 4 (h264 header size) + frame_size (live555
NAL size) + 16 (suggested padding size)
- current_frame.data = my unsigned char * buffer containing the
newest NAL unit, and padded as described
- Avcodec_decode_video2 . no problems
- Print PGM (examing it shows its skewed to the right)
A final reiteration, the RTSP streams that are completely skewed, seem be
smaller resolutions (half the resolution of my goal resolution). My goal
resolution only the bottom half is affected, while the smaller resolutions
are entirely affected.
Kind Regards,
Constantin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20120625/79712913/attachment.html>
More information about the Libav-user
mailing list