[Libav-user] Regarding AAC to PCM conversion

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

[Libav-user] Regarding AAC to PCM conversion

Gitanshu Mehndiratta
Hi,

I am facing similar problem as explained in https://trac.ffmpeg.org/ticket/3525.

My target is to convert AAC, fltp format to PCM, S16 format.

when i convert AAC to PCM it plays well but a lot of noise is added. I tried solution given in link but it did not worked for me.

Does any body know the proper fix of this problem?.

Below is my output AVCodecContext used in swr_alloc_set_opts() and conversion.


AVCodec *out_codec = avcodec_find_encoder(AV_CODEC_ID_PCM_S16LE); 

if (!out_codec) {

return -1;

}


out_codec_ctx = avcodec_alloc_context3(out_codec);


out_codec_ctx->profile        = FF_PROFILE_UNKNOWN;

out_codec_ctx->channels       = in_codec_ctx->channels;

out_codec_ctx->sample_rate    = in_codec_ctx->sample_rate ;

out_codec_ctx->channel_layout = av_get_default_channel_layout(out_codec_ctx->channels);

out_codec_ctx->sample_fmt     = out_codec->sample_fmts[0];  //AV_SAMPLE_FMT_S16

out_codec_ctx->bit_rate       = in_codec_ctx->bit_rate;

out_codec_ctx->frame_size  = codecpar->frame_size;


Any suggestion/pointers are appreciated.


Thanks,


_______________________________________________
Libav-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/libav-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: Regarding AAC to PCM conversion

Carl Eugen Hoyos-2
Am Fr., 9. Aug. 2019 um 17:19 Uhr schrieb Gitanshu Mehndiratta
<[hidden email]>:

> My target is to convert AAC, fltp format to PCM, S16 format.

If you are using the native "aac" decoder, the output is AV_SAMPLE_FMT_FLTP,
you have to use either the aresample filter or the libswresample
library directly
to convert to AV_SAMPLE_FMT_S16.
There is also an "aac_fixed" decoder but is provides AV_SAMPLE_FMT_S32P
which you also have to convert.

Note that the format provided by a decoder is not part of the api, it has
changed in the past and may change in the future so it is a good idea
to use aresample even if the decoder and encoder (currently) use the
same sample format.

Carl Eugen
_______________________________________________
Libav-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/libav-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: Regarding AAC to PCM conversion

Gitanshu Mehndiratta
Hello,

Yes...I am using swr_convert after decoding. decoder produces AV_SAMPLE_FMT_FLTP format.

while creating swr context i am setting above settings to output codec context. (finding decoder for AV_CODEC_ID_PCM_S16LE and setting AV_SAMPLE_FMT_S16 )
and i have same sample rate and channels as input. conversion API is success. only thing issue is that in output i have a lot of noise along with original sound.

which is exactly similar to problem  https://trac.ffmpeg.org/ticket/3525.  I tried given solution but noise is not removed. Could anybody tell is there any working solution to above problem ?

For reference These are the steps i am following.

my code is taken similar to transcode_aac.c example, only thing changed is i am converting from aac to pcm.

Any pointers are welcome.

On Fri, Aug 9, 2019 at 10:16 PM Carl Eugen Hoyos <[hidden email]> wrote:
Am Fr., 9. Aug. 2019 um 17:19 Uhr schrieb Gitanshu Mehndiratta
<[hidden email]>:

> My target is to convert AAC, fltp format to PCM, S16 format.

If you are using the native "aac" decoder, the output is AV_SAMPLE_FMT_FLTP,
you have to use either the aresample filter or the libswresample
library directly
to convert to AV_SAMPLE_FMT_S16.
There is also an "aac_fixed" decoder but is provides AV_SAMPLE_FMT_S32P
which you also have to convert.

Note that the format provided by a decoder is not part of the api, it has
changed in the past and may change in the future so it is a good idea
to use aresample even if the decoder and encoder (currently) use the
same sample format.

Carl Eugen
_______________________________________________
Libav-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/libav-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".

_______________________________________________
Libav-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/libav-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".