Opened 7 years ago
Closed 7 years ago
#6616 closed defect (invalid)
Decoded frames contain information about previous encoded frame
Reported by: | Ruben Sanchez Castellano | Owned by: | |
---|---|---|---|
Priority: | normal | Component: | avcodec |
Version: | git-master | Keywords: | |
Cc: | Blocked By: | ||
Blocking: | Reproduced by developer: | no | |
Analyzed by developer: | no |
Description
I'm developing an application which decodes a video source, overlays an image and encodes the frame again to send it to an external endpoint.
With the new API to decode/encode frames the decoded frames contain information about the previous encoded frame on it pixel data. See the attached image. This does not happen with the old decode/encode functions.
Attachments (1)
Change History (7)
by , 7 years ago
Attachment: | image_131.png added |
---|
comment:1 by , 7 years ago
Priority: | critical → normal |
---|
follow-up: 3 comment:2 by , 7 years ago
It looks like you are modifying the frame data returned by the decoder, are you not?
follow-up: 4 comment:3 by , 7 years ago
Replying to Cigaes:
It looks like you are modifying the frame data returned by the decoder, are you not?
Yes, the application must modify the decoded frames in order to apply an overlay image.
follow-up: 5 comment:4 by , 7 years ago
Replying to rubensanchez:
Replying to Cigaes:
It looks like you are modifying the frame data returned by the decoder, are you not?
Yes, the application must modify the decoded frames in order to apply an overlay image.
Well, there is your problem then. Frames are not guaranteed to be writeable, because they can still be used as reference frames by the decoder - which results in what you are seeing here.
If you need to write to a frame, you can use "av_frame_make_writable", which will copy the data if the frame is read-only, so you don't mess with the reference frame.
comment:5 by , 7 years ago
Replying to heleppkes:
Replying to rubensanchez:
Replying to Cigaes:
It looks like you are modifying the frame data returned by the decoder, are you not?
Yes, the application must modify the decoded frames in order to apply an overlay image.
Well, there is your problem then. Frames are not guaranteed to be writeable, because they can still be used as reference frames by the decoder - which results in what you are seeing here.
If you need to write to a frame, you can use "av_frame_make_writable", which will copy the data if the frame is read-only, so you don't mess with the reference frame.
Great! You were right. I ended up creating a copy of the decoded frame and modifying this copy instead the original one. With this approach, the problem is solved.
Then this ticket must be closed as it is not a bug.
comment:6 by , 7 years ago
Resolution: | → invalid |
---|---|
Status: | new → closed |
In this image shows an overlay ob colour boxes moving around. You can appreciate the previous position of each one.