[Libav-user] What should I do when avcodec_decode_audio4 fails?

YIRAN LI mrfun.china at gmail.com
Mon May 15 16:32:21 EEST 2017


2017-05-15 17:52 GMT+10:00 坚定前行 <powerpan at qq.com>:

> cbr?need to get the sync key frame and resync
>
> ​Hi Powerpan,

I have no idea what resync is.

What I'm doing is simply read packet/decode/encode/writepacket.

​There's one audio packet broken so decode fails on that packet, but all
following packets can be decoded. I need to make up with silent samples
otherwise video audio would go out of sync.

How can keyframe and resync solve this problem?



​


>
> ---Original---
> *From:* "YIRAN LI"<mrfun.china at gmail.com>
> *Date:* 2017/5/15 15:47:48
> *To:* "This list is about using libavcodec, libavformat,
> libavutil,libavdevice and libavfilter."<libav-user at ffmpeg.org>;
> *Subject:* Re: [Libav-user] What should I do when avcodec_decode_audio4
> fails?
>
>
>
> 2017-05-15 17:29 GMT+10:00 坚定前行 <powerpan at qq.com>:
>
>> 根据视频都桢计算,framesxframe rate/sample rate
>>
>> ​Hi Powerpan,
>
> That only works for some codecs: those having fixed frame size. Codecs
> with no fixed frame size ​can't be handled in this way, right?
>
> ---Original---
>> *From:* "YIRAN LI"<mrfun.china at gmail.com>
>> *Date:* 2017/5/15 15:24:21
>> *To:* "This list is about using libavcodec, libavformat,
>> libavutil,libavdevice and libavfilter."<libav-user at ffmpeg.org>;
>> *Subject:* Re: [Libav-user] What should I do when avcodec_decode_audio4
>> fails?
>>
>>
>>
>> 2017-05-15 17:12 GMT+10:00 坚定前行 <powerpan at qq.com>:
>>
>>> 解多少桢就插多少桢
>>>
>>> ​Thanks powerpan,
>>
>> I think I need to know how many samples this packet contains to insert
>> same number of silent samples, but number of samples is in decoded_frame,
>> when decode fails, the fields in decoded_frame have no meaning.
>>>>
>>
>>
>> ---Original---
>>> *From:* "YIRAN LI"<mrfun.china at gmail.com>
>>> *Date:* 2017/5/15 14:31:58
>>> *To:* "This list is about using libavcodec, libavformat,
>>> libavutil,libavdevice and libavfilter."<libav-user at ffmpeg.org>;
>>> *Subject:* [Libav-user] What should I do when avcodec_decode_audio4
>>> fails?
>>>
>>> Hi there,
>>>
>>>
>>> When running my program with an audio-broken file, at some
>>> point avcodec_decode_audio4 returns < 0 which mean decode failure.
>>>
>>> It's okay for me to add silence to makeup the decode failure but how can
>>> I know how many silent samples to insert?
>>>
>>> Thanks
>>>
>>> _______________________________________________
>>> 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: <http://ffmpeg.org/pipermail/libav-user/attachments/20170515/7d67dde2/attachment.html>


More information about the Libav-user mailing list