[Libav-user] Conversion from mp3 to aac/mp4 container problem
mtaha.ansari at gmail.com
Mon Jun 24 12:34:24 CEST 2013
You can't change input sample format like that, input sample format is
> what decoder outputs, nothing else.
> Same apply to sample format that encoder accepts.
> So you first need to make sure that you do not change sample format
> of decoder and that sample format for encoder is actually supported.
That makes sense, so I modified swr initialization function like this:
swr = swr_alloc();
av_opt_set_sample_fmt(swr, "out_sample_fmt", AV_SAMPLE_FMT_S16, 0);
So I'm letting decoder decide whatever format it is comfortable with.
Buf for encoder, I know AV_SAMPLE_FMT_S16 has given me compatible results
so far (otherwise crashing). So I keep it like this and run my program:
same results, unfortunately (btw codec_ctx_audio->sample_fmt shows
AV_SAMPLE_FMT_S16P inside debugger anyway).
The success I'm talking of, from AV_SAMPLE_FMT_S16 have been from some
other test, i.e. if i try to encode an mp4 file as mp4 file (makes no sense
but this exercise makes me visualize my guess for 'AV_SAMPLE_FMT_S16' is
working, i.e. mp4 to mp4 conversion from my code runs just fine).
Obviously, I need to improve encoding functions, somehow. But I can't put
my finger on it. <sad>
Cleary examples are not documented properly and needs improving ASAP.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Libav-user