[Libav-user] is it possible to get a decode error

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

[Libav-user] is it possible to get a decode error

Anton Shekhovtsov
I expected avcodec_receive_frame to return any kind of error code when something goes wrong with a decoding. However it always returns success, I can only guess there is something wrong by side effects (decoded frame not updated, messages in log).
Is this feature supported?


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

Re: is it possible to get a decode error

jing zhang

Hi,

Try set your own log callback (use av_log_set_callback), and check errors in your call back function.


zj

2017-07-12 19:13 GMT+08:00 Anton Shekhovtsov <[hidden email]>:
I expected avcodec_receive_frame to return any kind of error code when something goes wrong with a decoding. However it always returns success, I can only guess there is something wrong by side effects (decoded frame not updated, messages in log).
Is this feature supported?


_______________________________________________
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: is it possible to get a decode error

Anton Shekhovtsov


2017-07-13 4:31 GMT+03:00 jing zhang <[hidden email]>:

Hi,

Try set your own log callback (use av_log_set_callback), and check errors in your call back function.


zj

2017-07-12 19:13 GMT+08:00 Anton Shekhovtsov <[hidden email]>:
I expected avcodec_receive_frame to return any kind of error code when something goes wrong with a decoding. However it always returns success, I can only guess there is something wrong by side effects (decoded frame not updated, messages in log).
Is this feature supported?


_______________________________________________
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


Hi, Thanks for reply, however I don't think log callback can solve this:
1) Decoding is asynchronous, not possible to know which frame is affected from log message. Even If I knew it, the mechanism to deliver the result to a point where it is needed (code calling avcodec_receive_frame) would be ugly and complex.
2) Not sure log message is even associated with specific context. According to docs maybe it has a pointer to pointer to AVClass (how is that useful?) or not. Seems like log callback captures messages of the whole library, so if I do multiple operations on different threads how to tell which one had errors?


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

Re: is it possible to get a decode error

jing zhang
1) The decoder call the log callback synchronous when it encounter a error or other messages. You can change the code to log the frame number? Like h.264, slice header has a frame_num
2) You can use AVClass->class_name to check which context logger using. Use AVCodecContext->opaque to save your information about which decoder you are using.

2017-07-13 16:02 GMT+08:00 Anton Shekhovtsov <[hidden email]>:


2017-07-13 4:31 GMT+03:00 jing zhang <[hidden email]>:

Hi,

Try set your own log callback (use av_log_set_callback), and check errors in your call back function.


zj

2017-07-12 19:13 GMT+08:00 Anton Shekhovtsov <[hidden email]>:
I expected avcodec_receive_frame to return any kind of error code when something goes wrong with a decoding. However it always returns success, I can only guess there is something wrong by side effects (decoded frame not updated, messages in log).
Is this feature supported?


_______________________________________________
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


Hi, Thanks for reply, however I don't think log callback can solve this:
1) Decoding is asynchronous, not possible to know which frame is affected from log message. Even If I knew it, the mechanism to deliver the result to a point where it is needed (code calling avcodec_receive_frame) would be ugly and complex.
2) Not sure log message is even associated with specific context. According to docs maybe it has a pointer to pointer to AVClass (how is that useful?) or not. Seems like log callback captures messages of the whole library, so if I do multiple operations on different threads how to tell which one had errors?


_______________________________________________
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: is it possible to get a decode error

Anton Shekhovtsov


2017-07-13 11:18 GMT+03:00 jing zhang <[hidden email]>:
1) The decoder call the log callback synchronous when it encounter a error or other messages. You can change the code to log the frame number? Like h.264, slice header has a frame_num
2) You can use AVClass->class_name to check which context logger using. Use AVCodecContext->opaque to save your information about which decoder you are using.

2017-07-13 16:02 GMT+08:00 Anton Shekhovtsov <[hidden email]>:


2017-07-13 4:31 GMT+03:00 jing zhang <[hidden email]>:

Hi,

Try set your own log callback (use av_log_set_callback), and check errors in your call back function.


zj

2017-07-12 19:13 GMT+08:00 Anton Shekhovtsov <[hidden email]>:
I expected avcodec_receive_frame to return any kind of error code when something goes wrong with a decoding. However it always returns success, I can only guess there is something wrong by side effects (decoded frame not updated, messages in log).
Is this feature supported?


_______________________________________________
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


Hi, Thanks for reply, however I don't think log callback can solve this:
1) Decoding is asynchronous, not possible to know which frame is affected from log message. Even If I knew it, the mechanism to deliver the result to a point where it is needed (code calling avcodec_receive_frame) would be ugly and complex.
2) Not sure log message is even associated with specific context. According to docs maybe it has a pointer to pointer to AVClass (how is that useful?) or not. Seems like log callback captures messages of the whole library, so if I do multiple operations on different threads how to tell which one had errors?


_______________________________________________
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


1) Do you mean, can I change libavcodec sources? I'm trying to avoid it. From some examples I looked into, seems too much trouble:
ffv1dec.c
av_log(f->avctx, AV_LOG_ERROR, "CRC mismatch %X!", crc);
To know which frame is related to log message, I must extend log callback protocol, and update all relevant av_log calls. If it is like that with every decoder I'd rather leave it alone.

2) This gives me some idea to try, thanks!

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