[Libav-user] Ffmpeg unable to initialize swsContext for H264 frame data received through RTP Payload
preddi at tridium.com
Thu Mar 26 16:59:23 CET 2015
I am trying to decode H264 video frames received through RTSP streaming.
I followed this post: How to process raw UDP packets so that they can be decoded by a decoder filter in a directshow source filter<http://stackoverflow.com/questions/7665217/how-to-process-raw-udp-packets-so-that-they-can-be-decoded-by-a-decoder-filter-i>
I was able to identify start of the frame & end of the frame in RTP packets and reconstructed my Video Frame.
But I didnt receive any SPS,PPS data from my RTSP session. I looked for string "sprop-parameter-sets" in my SDP(Session Description Protocol) and there was none.
Reconstructing Video Frame from RTP Packets:
Payload in the first RTP Packet goes like this : "1c 80 00 00 01 61 9a 03 03 6a 59 ff 97 e0 a9 f6"
This says that it's a fragmented data("1C") and start of the frame("80"). I copied the rest of thepayload data(except the first 2 bytes "1C 80").
Following RTP Packets have the "Payload" start with "1C 00" which is continuation of the frame data. I kept adding payload data(except the first 2 bytes "1C 00") into the byte buffer for all the following RTP Packets.
When I get the RTP packet with payload starts with "1C 40", which is end of the frame, I copied the rest of the payload data(except the first 2 bytes "1C 40") of that RTP Packet into the byte buffer.
Thus I reconstructed the Video Frame into the byte buffer.
Then I prepended 4 bytes [0x00, 0x00 , 0x00, 0x01] to the byte buffer before sending to the decoder, because I didnt receive any SPS, PPS NAL bytes.
When I send this byte buffer to the decoder, decoder fails when it tries to initialize sws Context.
Am I sending the NAL bytes and video frame data correctly?
Appreciate any help on this.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Libav-user