[Libav-user] sws_scale - "Warning: data is not aligned!" when using opencv::Mat

Carl Eugen Hoyos ceffmpeg at gmail.com
Sun Dec 23 00:29:08 EET 2018


2018-12-22 19:40 GMT+01:00, Wodzu <brucedickinson at wp.pl>:
>> First, I meant you can only remove the conversion if you
>> verified that the range of your input is the same (mpeg
>> range) as the range expected by your h264 encoder.
>
> What do you mean by "range"?

Digital video by definition has a range, for "8bit h264 video"
(and anything coming from dvb and dvd) it is 16..235
while it is 0..255 for jpeg.
gray can be both, you have to know before you can encode
it into h264. If your input is full scale (0-255) but you need
an output video that can be shown anywhere, the conversion
is unavoidable. (I cannot know what your input is.)

>> Second, if you are using libx264, it nowadays accepts gray8 as input
>> (instead of yuv420p), if you use it, there should be no additional
>> steps necessary, you pass the gray8 frames to libx264.
>
> When I set my context->pix_fmt = AV_PIX_FMT_GRAY8 then I get [libx264 @
> 000000000037d9c0] Specified pixel format gray is invalid or not supported.

You could of course consider to update FFmpeg (and x264) to get what
you - possibly! - need, apart from the fact that only current FFmpeg is
supported here.

Carl Eugen


More information about the Libav-user mailing list