Skip to content

av.bytesource.Bytesource object has no attribute 'size' Error while adding extradata manually. #340

Description

@choinw

HI.

I'm trying to decode h.264 raw stream without PPS SPS.

For encoding parameters, some extradata is being delivered from another session.

But while trying to add extradata bytes manually, the script returns the error below.

line 392, in initialize_ffmpeg_video
av_codec_ctx.extradata = extradata
File "av/codec/context.pyx", line 103, in av.codec.context.CodecContext.extradata.set
AttributeError: 'av.bytesource.ByteSource' object has no attribute 'size'

this code block in av/codec/context.pyx causes the issue.

image

I have changed the line that is allocating extradata_size to

self.ptr.extradata_size = len(data)

then, it works.

in bytesource.pyx, there is no attribute 'size' for bytesource object.

The original commit from issue #287 by @adavoudi includes the working code.
(commit 51a7385 on 25 Feb)

   def __set__(self, data):
       buffer_size = len(data)
       cdef ByteSource source = bytesource(data)
       self.ptr.extradata =  <uint8_t *>malloc(buffer_size * sizeof(uint8_t))
       self.ptr.extradata_size = buffer_size
       memcpy(self.ptr.extradata, source.ptr, buffer_size)

but it has been changed in merged commit 4b01b63 on 23 Mar.

please check it out.

Thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions