[Libav-user] Dealing with badly formed Headers

Paul Sanderson nannapie at hotmail.co.uk
Thu May 2 14:54:28 EEST 2019


Dear all,

I’m successfully decoding a video stream from a camera that uses h264 and JPEGs. However.. there is a bug in the camera so the JPEG header does not contain the width information. This throws a picture invalid size (which it should). 

When I connect I get the correct AVFormatContext and AVCodecContext. Wire shark and the codec context show that the stream sends the width information in an options describe. 

I’m wondering if there is a way to fill in the missing header information. I have tried hard coding the AVFrame width but this doesn’t fix the problem.(makes sense if the packet is garbled) 

I think there is a disconnect between avcodec_send_packet and avcodec_recieve_frame. Is there a way to overwrite the header with avcodec_send_packet? 

Summary - Badly formed headers mean when stream starts sending JPEGS they do not contain width information but AVCodecContext has the information from initial options describe. VLC media player plays the stream fine.

All my best,

(Thank you for your time!) 

Paul 

Sent from the top a castle using a moderately sized European swallow 


More information about the Libav-user mailing list