also, properly set AVCodecContext.bits_per_coded_sample, AVStreasm.start_time, and AVPacket.duration.
Attach a file by drag & drop or click to upload