[FFmpeg-user] avfoundation on osx 10.7.5: issues with audio input

Thilo Borgmann thilo.borgmann at mail.de
Thu Mar 5 20:16:18 CET 2015


Am 05.03.15 um 19:47 schrieb John Robinson:
> On Mar 4, 2015, at 4:44 PM, Carl Eugen Hoyos <cehoyos at ag.or.at> wrote:
>>
>> Please add lines like the following:
>> printf("float: %d, integer: %d, bps: %d, packed: %d \n",
>> ctx->audio_float, ctx->audio_signed_integer,
>> ctx->audio_bits_per_sample, ctx->audio_packed);
>>
>> Run again and post the output.
>>
>> Thank you!
>>
>> Carl Eugen
>>
> 
> Carl - 
> 
> Here's the output after adding the logging - 
> 
> float: 0, integer: 4, bps: 24, packed: 8
> 
> I ended up modifying the code to make things work with both the mini's line-in, and soundflower. Sadly my machine is having a hard time keeping up. Here's the code though (in avfoundation.m):
> 
> //print some info, trying to figure out what soundflower/10.7.5 is giving us, and why it's exiting with unsupported audio
>     printf("float: %d, integer: %d, bps: %d, packed: %d , formatId: %d\n", ctx->audio_float, ctx->audio_signed_integer,ctx->audio_bits_per_sample, ctx->audio_packed, basic_desc->mFormatID);

>     if (basic_desc->mFormatID == kAudioFormatLinearPCM &&
>         ctx->audio_float &&
>         ctx->audio_bits_per_sample == 32 &&
>         ctx->audio_packed) {
>         stream->codec->codec_id = ctx->audio_be ? AV_CODEC_ID_PCM_F32BE : AV_CODEC_ID_PCM_F32LE;
>     } else if (basic_desc->mFormatID == kAudioFormatLinearPCM &&
>         ctx->audio_signed_integer &&
>         ctx->audio_bits_per_sample == 16 &&
>         ctx->audio_packed) {
>         stream->codec->codec_id = ctx->audio_be ? AV_CODEC_ID_PCM_S16BE : AV_CODEC_ID_PCM_S16LE;
>     } else if (basic_desc->mFormatID == kAudioFormatLinearPCM &&
>         ctx->audio_signed_integer &&
>         ctx->audio_bits_per_sample == 24 &&
>         ctx->audio_packed) {
>         //mac mini, osx 10.7.5 built-in line input
>         stream->codec->codec_id = ctx->audio_be ? AV_CODEC_ID_PCM_S24BE : AV_CODEC_ID_PCM_S24LE;
>     } else if (basic_desc->mFormatID == kAudioFormatLinearPCM &&
>         ctx->audio_signed_integer &&
>         ctx->audio_bits_per_sample == 32 &&
>         ctx->audio_packed) {
>         //mac mini, osx 10.7.5 soundflower input
>         stream->codec->codec_id = ctx->audio_be ? AV_CODEC_ID_PCM_S32BE : AV_CODEC_ID_PCM_S32LE;
>     } else {
>         av_log(s, AV_LOG_ERROR, "audio format is not supported\n");
>         return 1;
>     }

Looks good. Will patch it in once the pending patches hit HEAD.

Thanks!
-Thilo



More information about the ffmpeg-user mailing list