My application receives a media stream, containing PCMU sound. How can I convert it to AC3?
The container is broken matroska, libav doesn't parse it, so I tempted to use libmatroska. I can however, use AVCodec to transcode data. How should I set up output AVCodecContext, assuming that output data have the same number of channels, sample rate, bit rate, etc? I've successfully set up incoming codec context and have decoded audio data using avcodec_decode_audio4() Then, if I pass these decoded data to avcodec_encode_audio2() I always receive error -22. I also tried the following: I've found that if I set Then, avcodec_encode_audio2 returns 0, and got_packet = 1. Sound, however, is like a garbage. Also, comments in sources say that I should not do this assignment. So, I'm in doubts, if I should accumulate data, or what? If I should accumulate data, then another problem arises. ocodecctx->frame_size = 1536; out_frame.nb_samples = 120; 1536/120 = 12.8, so I either overfill or unerfill. Hovewer, there is a strict equality comparison between ocodecctx->frame_size and frame.nb_samples, and I'll again receive error -22. -- View this message in context: http://libav-api.1054858.n5.nabble.com/libav-api-How-to-convert-PCMU-to-AC3-tp5617333p5617333.html Sent from the libav-api mailing list archive at Nabble.com. _______________________________________________ libav-api mailing list [email protected] https://lists.libav.org/mailman/listinfo/libav-api
