Convert YUV420 to BGR without using videoconvert in GStreamer

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

Convert YUV420 to BGR without using videoconvert in GStreamer

Andrew Max
I am using GSteamer, and I want to convert I420(YUV420p) to BGR(BGR24) format
without videoconvert. Pipeline:

gst-launch-1.0 filesrc location= ./Big_Buck_Bunny_1080_10s_1MB.mp4 ! qtdemux
! h264parse ! avdec_h264 ! fakesink

I don't use videoconvert plugin because it takes many CPU workload. I saw
that avdec_h264 plugins has support BGR format and I tried to chose BGR
format but the output always give I420 format ("avdec_h264 ! video/x-raw,
format=BGR !").

I tried to cast it to BGR format in source code
(gst-libav/ext/libav/gstavvidec.c\gst_ffmpeg_pixfmt_to_videoformat()) but I
got an error in line 1606
(gst-libav/gst-libs/ext/libav/libavcodec/decode.c): Assertion frame->data[i]
failed

for (i = 0; i < num_planes; i++) {
            av_assert0(frame->data[i]);
        }

- Does my way correct? Should I modify num_planes in deocode.c? If it's not
a right way, can I convert format by using OpenCV and combine with GStreamer
pipeline?

- By the way, I intend to apply algorithm to convert image I420 to BGR after
decode. Is it correct?

If you have any good way, please tell me also.




--
Sent from: http://gstreamer-devel.966125.n4.nabble.com/
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Convert YUV420 to BGR without using videoconvert in GStreamer

Andrew Max
Maybe we can convert buffer after decoder: apply algorithm to update buffer
after decode or use OpenCV overload buffer after sink plugin. :)



--
Sent from: http://gstreamer-devel.966125.n4.nabble.com/
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Convert YUV420 to BGR without using videoconvert in GStreamer

Nicolas Dufresne-5


Le jeu. 26 sept. 2019 04 h 10, Andrew Max <[hidden email]> a écrit :
Maybe we can convert buffer after decoder: apply algorithm to update buffer
after decode or use OpenCV overload buffer after sink plugin. :)

As per your first question, avdec does not handle color conversion (data is encoded in yuv).

Your rendered might have an accelerated patch, otherwise your options entirely depends on the HW you run it on. glvideoconvert is likely the most generic option at the moment, though it requires uploading the pixels to GL space, which have some cost.




--
Sent from: http://gstreamer-devel.966125.n4.nabble.com/
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel

_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Convert YUV420 to BGR without using videoconvert in GStreamer

Andrew Max
Thank you for your response. I got it.



--
Sent from: http://gstreamer-devel.966125.n4.nabble.com/
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel