Closed moi90 closed 2 years ago
This can be fixed by implementing pix_fmt
with format
, like hinted in the source: https://github.com/PyAV-Org/PyAV/blob/9ac05d9ac902d71ecb2fe80f04dcae454008378c/av/video/codeccontext.pyx#L96
pix_fmt = 'yuv420p' like this ,you should see source code.it will help you
@i3587616 Your comment is not helpful. It is absolutely unacceptable that a user of the library is able to set an illegal value and that the application crashes with a SEGFAULT at a later point.
This is a good catch but I seem to have missed the corresponding PR?
I'm not able to provide a PR in my limited time, but the fix mentioned above should be easy. Everyone is welcome to take credit.
Ah right, but maintainers magically have unlimited time.
Of cause! ;)
(I'd be happy to contribute, but I have zero experience with this library. Regular contributors, on the other hand, don't have the overhead of setting up a building and testing environment and digging into an unknown source. Eventually, someone will find the time. It might even be me, but not now.)
An alternative would be to remove the pix_fmt
setter, AFAICT it doesn't add anything over format
?
I wouldn't remove fix_fmt
because with only format
, a user would need to specify all three properties (pix_fmt, width, height) when setting.
Overview
VideoCodecContext.pix_fmt
can be set to an illegal value. Later, the application segfaults.Expected behavior
If
VideoCodecContext.pix_fmt
is set to an illegal value, aValueError
should be raised.Actual behavior
If
VideoCodecContext.pix_fmt
is set to an illegal value, it is silently unset.Traceback:
Reproduction
Versions
Research
I have done the following: