[Libav-user] avcodec_open2 returns -22

Kevin J. Brooks kbrooks at r2c-ss.com
Thu Jun 18 16:04:46 CEST 2015


Can someone point me to a reference where I can learn how to set up the 
codec parameters?  Even if it is only setting up for WMAV2, but I do 
need to record both audio and video.

On 6/17/2015 5:53 PM, Kevin J. Brooks wrote:
> I changed the Audio codec to WMAV2, and left the rest of the 
> AudioCodec settings the same Now the program crashes at this line in 
> the QtMel code:
>
> int outSize = avcodec_encode_audio(m_audioStream->codec, 
> m_audioOutputBuffer, m_audioOutputBufferSize, (short *)samples.data());
>
> In debug the error staates "Stopped in thread 2 by:Exception at 
> 0x66364c62, cod:0xc0000005: write access violation at:0x1, flags=0x0 
> (first chance).
>
> I suspect I don't have the audio settings set write, but I am not sure 
> how to set them for WMAV2.
>
>
>
> On 6/17/2015 4:30 PM, Kevin J. Brooks wrote:
>> I am setting the AudioCodec to MP3,  I am using the pre-built 
>> libraries the code I have the causes the issue is from the code for 
>> the QtMEL library.  What I am posting here is the Audio Codec setup 
>> for the QtMel object.  I hope it helps.
>>
>> BTW I am using H264 for the Video Codec.  If I record video only, it 
>> does work, it is only if I try to add sound that it fails.
>>
>> CR2CAudioFormat format;
>>      format.setChannelCount(2);
>>      format.setSampleRate(44100);
>>      format.setFormat(CR2CAudioFormat::SignedInt16);
>>
>> I really don't have a preference for the codec, I just need to know 
>> how to set it up properly. I am totally new at recording video and audio.
>>
>> On 6/17/2015 1:08 AM, Taha Ansari wrote:
>>> On Wed, Jun 17, 2015 at 2:17 AM, Gonzalo Garramuno 
>>> <ggarra13 at gmail.com <mailto:ggarra13 at gmail.com>> wrote:
>>>
>>>     On 16/06/15 09:06, Kevin J. Brooks wrote:
>>>
>>>         Yes I am.  For more information, I am developing on Windoze 7.
>>>
>>>     avcodec_open2 can fail if you lack the library for the codec you
>>>     want to decode or encode.  For example, libx264.  The libraries
>>>     in ffmpeg.zeranoe.com <http://ffmpeg.zeranoe.com> contain all
>>>     codecs, but they are GPL only.  You should try them first and
>>>     see if the problem goes away.  If it does, you know you have to
>>>     compile ffmpeg with different flags.
>>>
>>>
>>> Since he mentions Windows 7, I assume he is using pre-built packages 
>>> from zeranoe site (as you mention). These builds contain proprietary 
>>> codec(s) like x264 (non GPL).
>>>
>>> @Kevin: maybe you have some bare minimum code with you that can 
>>> produce this error, which people can have a look?
>>>
>>>
>>> _______________________________________________
>>> Libav-user mailing list
>>> Libav-user at ffmpeg.org
>>> http://ffmpeg.org/mailman/listinfo/libav-user
>>
>>
>>
>> _______________________________________________
>> Libav-user mailing list
>> Libav-user at ffmpeg.org
>> http://ffmpeg.org/mailman/listinfo/libav-user
>
>
>
> _______________________________________________
> Libav-user mailing list
> Libav-user at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/libav-user

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://ffmpeg.org/pipermail/libav-user/attachments/20150618/a11169e6/attachment.html>


More information about the Libav-user mailing list