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

classic Classic list List threaded Threaded
13 messages Options
Reply | Threaded
Open this post in threaded view
|

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

YIRAN LI
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
[hidden email]
http://ffmpeg.org/mailman/listinfo/libav-user
Reply | Threaded
Open this post in threaded view
|

Re: What should I do when avcodec_decode_audio4 fails?

坚定前行
解多少桢就插多少桢

---Original---
From: "YIRAN LI"<[hidden email]>
Date: 2017/5/15 14:31:58
To: "This list is about using libavcodec, libavformat, libavutil,libavdevice and libavfilter."<[hidden email]>;
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
[hidden email]
http://ffmpeg.org/mailman/listinfo/libav-user
Reply | Threaded
Open this post in threaded view
|

Re: What should I do when avcodec_decode_audio4 fails?

YIRAN LI


2017-05-15 17:12 GMT+10:00 坚定前行 <[hidden email]>:
解多少桢就插多少桢

​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"<[hidden email]>
Date: 2017/5/15 14:31:58
To: "This list is about using libavcodec, libavformat, libavutil,libavdevice and libavfilter."<[hidden email]>;
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
[hidden email]
http://ffmpeg.org/mailman/listinfo/libav-user



_______________________________________________
Libav-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/libav-user
Reply | Threaded
Open this post in threaded view
|

Re: What should I do when avcodec_decode_audio4 fails?

坚定前行
In reply to this post by 坚定前行
根据视频都桢计算,framesxframe rate/sample rate

---Original---
From: "YIRAN LI"<[hidden email]>
Date: 2017/5/15 15:24:21
To: "This list is about using libavcodec, libavformat, libavutil,libavdevice and libavfilter."<[hidden email]>;
Subject: Re: [Libav-user] What should I do when avcodec_decode_audio4 fails?



2017-05-15 17:12 GMT+10:00 坚定前行 <[hidden email]>:
解多少桢就插多少桢

​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"<[hidden email]>
Date: 2017/5/15 14:31:58
To: "This list is about using libavcodec, libavformat, libavutil,libavdevice and libavfilter."<[hidden email]>;
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
[hidden email]
http://ffmpeg.org/mailman/listinfo/libav-user



_______________________________________________
Libav-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/libav-user
Reply | Threaded
Open this post in threaded view
|

Re: What should I do when avcodec_decode_audio4 fails?

YIRAN LI


2017-05-15 17:29 GMT+10:00 坚定前行 <[hidden email]>:
根据视频都桢计算,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"<[hidden email]>
Date: 2017/5/15 15:24:21
To: "This list is about using libavcodec, libavformat, libavutil,libavdevice and libavfilter."<[hidden email]>;
Subject: Re: [Libav-user] What should I do when avcodec_decode_audio4 fails?



2017-05-15 17:12 GMT+10:00 坚定前行 <[hidden email]>:
解多少桢就插多少桢

​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"<[hidden email]>
Date: 2017/5/15 14:31:58
To: "This list is about using libavcodec, libavformat, libavutil,libavdevice and libavfilter."<[hidden email]>;
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
[hidden email]
http://ffmpeg.org/mailman/listinfo/libav-user



_______________________________________________
Libav-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/libav-user



_______________________________________________
Libav-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/libav-user
Reply | Threaded
Open this post in threaded view
|

Re: What should I do when avcodec_decode_audio4 fails?

坚定前行
In reply to this post by 坚定前行
cbr?need to get the sync key frame and resync



---Original---
From: "YIRAN LI"<[hidden email]>
Date: 2017/5/15 15:47:48
To: "This list is about using libavcodec, libavformat, libavutil,libavdevice and libavfilter."<[hidden email]>;
Subject: Re: [Libav-user] What should I do when avcodec_decode_audio4 fails?



2017-05-15 17:29 GMT+10:00 坚定前行 <[hidden email]>:
根据视频都桢计算,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"<[hidden email]>
Date: 2017/5/15 15:24:21
To: "This list is about using libavcodec, libavformat, libavutil,libavdevice and libavfilter."<[hidden email]>;
Subject: Re: [Libav-user] What should I do when avcodec_decode_audio4 fails?



2017-05-15 17:12 GMT+10:00 坚定前行 <[hidden email]>:
解多少桢就插多少桢

​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"<[hidden email]>
Date: 2017/5/15 14:31:58
To: "This list is about using libavcodec, libavformat, libavutil,libavdevice and libavfilter."<[hidden email]>;
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
[hidden email]
http://ffmpeg.org/mailman/listinfo/libav-user



_______________________________________________
Libav-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/libav-user



_______________________________________________
Libav-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/libav-user
Reply | Threaded
Open this post in threaded view
|

Re: What should I do when avcodec_decode_audio4 fails?

Nicolas George
In reply to this post by YIRAN LI
Le sextidi 26 floréal, an CCXXV, YIRAN LI a écrit :
> It's okay for me to add silence to makeup the decode failure but how can I
> know how many silent samples to insert?

If your frames come from a decent format, then the packets have a
timestamp.

Regards,

--
  Nicolas George
_______________________________________________
Libav-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/libav-user
Reply | Threaded
Open this post in threaded view
|

Re: What should I do when avcodec_decode_audio4 fails?

YIRAN LI


2017-05-15 20:00 GMT+10:00 Nicolas George <[hidden email]>:
Le sextidi 26 floréal, an CCXXV, YIRAN LI a écrit :
> It's okay for me to add silence to makeup the decode failure but how can I
> know how many silent samples to insert?

If your frames come from a decent format, then the packets have a
timestamp.

​Hi Nicolas,

That depends on timestamp, how if timestamp is inaccurate?
 
Regards,

--
  Nicolas George
_______________________________________________
Libav-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/libav-user


_______________________________________________
Libav-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/libav-user
Reply | Threaded
Open this post in threaded view
|

Re: What should I do when avcodec_decode_audio4 fails?

坚定前行


---Original---
From: "YIRAN LI"<[hidden email]>
Date: 2017/5/15 21:26:07
To: "This list is about using libavcodec, libavformat, libavutil,libavdevice and libavfilter."<[hidden email]>;
Subject: Re: [Libav-user] What should I do when avcodec_decode_audio4 fails?



2017-05-15 20:00 GMT+10:00 Nicolas George <[hidden email]>:
Le sextidi 26 floréal, an CCXXV, YIRAN LI a écrit :
> It's okay for me to add silence to makeup the decode failure but how can I
> know how many silent samples to insert?

If your frames come from a decent format, then the packets have a
timestamp.

​Hi Nicolas,

That depends on timestamp, how if timestamp is inaccurate?
 

tooooooo much worries……  if we met this kind of dump file,just dump it.
so you had solutions already…
Regards,

--
  Nicolas George
_______________________________________________
Libav-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/libav-user


_______________________________________________
Libav-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/libav-user
Reply | Threaded
Open this post in threaded view
|

Re: What should I do when avcodec_decode_audio4 fails?

YIRAN LI
In reply to this post by 坚定前行


2017-05-15 17:52 GMT+10:00 坚定前行 <[hidden email]>:
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"<[hidden email]>
Date: 2017/5/15 15:47:48
To: "This list is about using libavcodec, libavformat, libavutil,libavdevice and libavfilter."<[hidden email]>;
Subject: Re: [Libav-user] What should I do when avcodec_decode_audio4 fails?



2017-05-15 17:29 GMT+10:00 坚定前行 <[hidden email]>:
根据视频都桢计算,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"<[hidden email]>
Date: 2017/5/15 15:24:21
To: "This list is about using libavcodec, libavformat, libavutil,libavdevice and libavfilter."<[hidden email]>;
Subject: Re: [Libav-user] What should I do when avcodec_decode_audio4 fails?



2017-05-15 17:12 GMT+10:00 坚定前行 <[hidden email]>:
解多少桢就插多少桢

​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"<[hidden email]>
Date: 2017/5/15 14:31:58
To: "This list is about using libavcodec, libavformat, libavutil,libavdevice and libavfilter."<[hidden email]>;
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
[hidden email]
http://ffmpeg.org/mailman/listinfo/libav-user



_______________________________________________
Libav-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/libav-user



_______________________________________________
Libav-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/libav-user



_______________________________________________
Libav-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/libav-user
Reply | Threaded
Open this post in threaded view
|

Re: What should I do when avcodec_decode_audio4 fails?

YIRAN LI
In reply to this post by 坚定前行


2017-05-15 23:31 GMT+10:00 坚定前行 <[hidden email]>:


---Original---
From: "YIRAN LI"<[hidden email]>
Date: 2017/5/15 21:26:07
To: "This list is about using libavcodec, libavformat, libavutil,libavdevice and libavfilter."<[hidden email]>;
Subject: Re: [Libav-user] What should I do when avcodec_decode_audio4 fails?



2017-05-15 20:00 GMT+10:00 Nicolas George <[hidden email]>:
Le sextidi 26 floréal, an CCXXV, YIRAN LI a écrit :
> It's okay for me to add silence to makeup the decode failure but how can I
> know how many silent samples to insert?

If your frames come from a decent format, then the packets have a
timestamp.

​Hi Nicolas,

That depends on timestamp, how if timestamp is inaccurate?
 

tooooooo much worries……  if we met this kind of dump file,just dump it.

​ffmpeg command line tool and ffplay handle this perfectly, there's no out out sync at all. So there must ​be some way to do it. I just want to find a quick answer instead of checking code myself.

Thanks

so you had solutions already…
Regards,

--
  Nicolas George
_______________________________________________
Libav-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/libav-user


_______________________________________________
Libav-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/libav-user



_______________________________________________
Libav-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/libav-user
Reply | Threaded
Open this post in threaded view
|

Re: What should I do when avcodec_decode_audio4 fails?

坚定前行
In reply to this post by Nicolas George


---Original---
From: "YIRAN LI"<[hidden email]>
Date: 2017/5/15 21:35:04
To: "This list is about using libavcodec, libavformat, libavutil,libavdevice and libavfilter."<[hidden email]>;
Subject: Re: [Libav-user] What should I do when avcodec_decode_audio4 fails?



2017-05-15 23:31 GMT+10:00 坚定前行 <[hidden email]>:


---Original---
From: "YIRAN LI"<[hidden email]>
Date: 2017/5/15 21:26:07
To: "This list is about using libavcodec, libavformat, libavutil,libavdevice and libavfilter."<[hidden email]>;
Subject: Re: [Libav-user] What should I do when avcodec_decode_audio4 fails?



2017-05-15 20:00 GMT+10:00 Nicolas George <[hidden email]>:
Le sextidi 26 floréal, an CCXXV, YIRAN LI a écrit :
> It's okay for me to add silence to makeup the decode failure but how can I
> know how many silent samples to insert?

If your frames come from a decent format, then the packets have a
timestamp.

​Hi Nicolas,

That depends on timestamp, how if timestamp is inaccurate?
 

tooooooo much worries……  if we met this kind of dump file,just dump it.

​ffmpeg command line tool and ffplay handle this perfectly, there's no out out sync at all. So there must ​be some way to do it. I just want to find a quick answer instead of checking code myself.

Thank


then simply wait for the correct time stamp… that is what i said for sync frame. all day out of office had 2 use mobile to reply…
so you had solutions already…
Regards,

--
  Nicolas George
_______________________________________________
Libav-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/libav-user


_______________________________________________
Libav-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/libav-user



_______________________________________________
Libav-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/libav-user
Reply | Threaded
Open this post in threaded view
|

Re: What should I do when avcodec_decode_audio4 fails?

YIRAN LI


2017-05-15 23:38 GMT+10:00 坚定前行 <[hidden email]>:


---Original---
 
then simply wait for the correct time stamp… that is what i said for sync frame. all day out of office had 2 use mobile to reply…

​Thanks Powerpan,

I'll have a double check, but I doubt maybe it doesn't work.

I mean for example each packet contains 100 samples and 10th packet failed to decode.

that means all samples in 10th packet cant de decoded, right​? so this packet is wasted. 
Next time I call avcode_decode_audio4 with 11th packet, I'll also get 100 samples in decoded frame, but that are samples after 10the packet. I need to insert 100 silent samples before them. I mean in case of decoding failure, unless ffmpeg does some make up internally, the user of API must makeup himself.

Maybe I am wrong about ffmpeg command line tool because the corrupt packet contains only few samples (about 0.016 second), maybe they are lost and never made up, just too short to be noticed.


so you had solutions already…
Regards,

--
  Nicolas George
_______________________________________________
Libav-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/libav-user


_______________________________________________
Libav-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/libav-user



_______________________________________________
Libav-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/libav-user



_______________________________________________
Libav-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/libav-user