[Libav-user] How to extract audio from an rtsp stream
Denis Gottardello
info at denisgottardello.it
Thu Apr 30 16:27:41 EEST 2020
Hi, I need to extract audio packets from an rtsp stream and to listen them with a Qt
program.
The examples are based on *avcodec_decode_audio4* function but it is deprecated.
Now I already have an audio packet. Now I have to trascode it in a format that I can
manage with Qt, something like
*AVAudioResampleContext** resample_context_ = NULL;
av_opt_set_int(resample_context_, "in_channel_layout",
av_get_default_channel_layout(codec_context_->channels), 0);
av_opt_set_int(resample_context_, "out_channel_layout",
av_get_default_channel_layout(outputFormat_.channels), 0);
av_opt_set_int(resample_context_, "in_sample_rate", codec_context_->sample_rate, 0);
av_opt_set_int(resample_context_, "out_sample_rate", outputFormat_.rate, 0);
av_opt_set_int(resample_context_, "in_sample_fmt", codec_context_->sample_fmt, 0);
av_opt_set_int(resample_context_, "out_sample_fmt", AV_SAMPLE_FMT_S16, 0);
if (avresample_open(resample_context_) < 0) {
qDebug() << "Could not open resample context.";
avresample_free(&resample_context_);
return;
}
but *AVAudioResampleContext* but it is deprecated too.
Can someone suggest me a way from
while (av_read_frame(pAVFormatContext, &pAVPacket)>= 0 && DoStart) {
if (pAVPacket.stream_index== StreamAudio) {
...
..
??
Many thanks
+39.347.4070897
http://www.labcsp.com[1]
http://www.denisgottardello.it[2]
GMT+1
Skype: mrdebug
--------
[1] http://www.labcsp.com
[2] http://www.denisgottardello.it
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://ffmpeg.org/pipermail/libav-user/attachments/20200430/7d4214ec/attachment.html>
More information about the Libav-user
mailing list