Also, stop using AVCodecContext for storing the stream parameters.
Attach a file by drag & drop or click to upload