On 6/24/13, Taha Ansari <mtaha.ans...@gmail.com> wrote:
> Hi Carl,
>
> On your suggestion, I downloaded latest available build from Zeranoe site:
> ffmpeg-20130623-git-c329713-win32. I had some trouble getting my code to
> run with latest build, but finally was able to do so.
>
> I had to make following additions:
>
> inside open_audio_input():
>
>         // Set up SWR context once you've got codec information
>         swr = swr_alloc();
>         av_opt_set_int(swr, "in_channel_layout",
> codec_ctx_audio->channel_layout, 0);
>         av_opt_set_int(swr, "out_channel_layout",
> codec_ctx_audio->channel_layout,  0);
>         av_opt_set_int(swr, "in_sample_rate",
> codec_ctx_audio->sample_rate, 0);
>         av_opt_set_int(swr, "out_sample_rate",
> codec_ctx_audio->sample_rate, 0);
>         av_opt_set_sample_fmt(swr, "in_sample_fmt",  AV_SAMPLE_FMT_S16P,
> 0);
>         av_opt_set_sample_fmt(swr, "out_sample_fmt", AV_SAMPLE_FMT_S16,
> 0);
>         swr_init(swr);
>
> inside decode_packet():
>
>                     swr_convert( swr, audio_dst_data,
> decoded_frame->nb_samples, (const uint8_t**) decoded_frame->extended_data,
> decoded_frame->nb_samples );
>
> inside add_audio_stream():
>
>     c->sample_fmt  = AV_SAMPLE_FMT_S16;
>     c->bit_rate    = audio_bit_rate;
>     c->sample_rate = audio_sample_rate;
>     c->channels    = audio_channels;
>
> Then, all things started working, but the output was identical to previous
> behavior (plays faster, and ends on same time: on about 65th second).
>
> I tried changing output format from AV_SAMPLE_FMT_S16 to AV_SAMPLE_FMT_FLTP
> (inside above relevant functions), but it fails inside avcodec_open2(),
> giving me -22 return value.

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.

Cleary examples are not documented properly and needs improving ASAP.

>
> Any ideas how to fix this?
>
> Thanks for your time...
>
>
> On Mon, Jun 24, 2013 at 11:26 AM, Taha Ansari
> <mtaha.ans...@gmail.com>wrote:
>
>> Hi Carl,
>>
>> You are right, last working build I downloaded from Zeranoe FFmpeg builds
>> was from a long time ago. If you suggest I can always get the latest
>> working build from there, but! the point is: even for this old version of
>> FFmpeg, command line "ffmpeg.exe -i test.mp3 test.mp4" converts the file
>> just fine, so there is obviously something wrong with my code...
>>
>> Still, if you suggest I get latest build from there, well, I can do it as
>> well!
>>
>> Kindly, could you guide further based on above facts?
>>
>>
>> On Mon, Jun 24, 2013 at 11:04 AM, Carl Eugen Hoyos
>> <ceho...@ag.or.at>wrote:
>>
>>> Taha Ansari <mtaha.ansari@...> writes:
>>>
>>> > ffprobe version N-47062-g26c531c Copyright (c) 2007-2012
>>>
>>> This looks outdated.
>>> The aac decoder of current git head outputs FLTP iirc.
>>>
>>> Carl Eugen
>>>
>>> _______________________________________________
>>> Libav-user mailing list
>>> Libav-user@ffmpeg.org
>>> http://ffmpeg.org/mailman/listinfo/libav-user
>>>
>>
>>
>
_______________________________________________
Libav-user mailing list
Libav-user@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/libav-user

Reply via email to