Re: [Libav-user] Audio encoding: more samples than frame size (avcodec_encode_audio2)

2016-09-20 Thread Yu Ang Tan
>
> > [libvorbis @ 028b1520] more samples than frame size
> > (avcodec_encode_audio2)
>
> Are you sure that you are encoding to flac?
>
>
You were spot on. I was using "test.ogg" instead of "test.flac".

I made the following changes and now it works fine.
-audio_decode_example("test.ogg", "test.sdp");
+audio_decode_example("test.flac", "test.sdp");

-outCodecCtx->sample_fmt = AV_SAMPLE_FMT_FLTP;
+outCodecCtx->sample_fmt = AV_SAMPLE_FMT_S16;   // FLAC uses fixed
point samples

Thanks!
___
Libav-user mailing list
Libav-user@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/libav-user


Re: [Libav-user] Audio encoding: more samples than frame size (avcodec_encode_audio2)

2016-09-20 Thread Carl Eugen Hoyos
2016-09-20 10:02 GMT+02:00 Yu Ang Tan :
> I am trying to read an RTP audio stream, and encode it into a FLAC file.
> However, when I am reading the stream, I get this error:
>
> [libvorbis @ 028b1520] more samples than frame size
> (avcodec_encode_audio2)

Are you sure that you are encoding to flac?

> During debug mode, it seems the frame_size of my input and output codec
> context are mismatched:
>
> inCodecCtx->frame_size = 1152;
> outCodecCtx->frame_size = 64;
>
> I tried to write 1152 to outCodecCtx->frame_size, but it gets overwritten
> with 64 at `avcodec_open2()`. Why can't I set the frame_size to match the
> input frame_size?

My guess is that you are using a different codec for output than for input.

Carl Eugen
___
Libav-user mailing list
Libav-user@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/libav-user