-
Hello again, I have a UDP video stream, from which I read packets, which are then decoded into frames in YUV422P format. I want to convert these decoded frames to RGB format and send to a python script (adds some AR filters on top of this images) which returns back filtered images in RGB format. Then, I would convert these RGB frames back to YUV422P format, encode them into packets and push into a WebRTC track. Note: I have been using MediaPipe for AR-related processing. Apparently, they do not have support in Go. Here are some code snippets:
Ref: https://github.com/pion/example-webrtc-applications/tree/master/ffmpeg-send Questions:
Any help would be appreciated. Thanks in advance! |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 5 replies
-
There are 2 ways to convert pixel formats using
Since the You can basically create a software scale context to convert from YUV422P into RGB and another one to convert from RGB to YUV422P. For the first one you'd have to make sure source and destination width and height are the same but source pixel format is YUV422P and destination pixel format is RGB here then, as in the example, use Does that answer your question? |
Beta Was this translation helpful? Give feedback.
-
Hi @asticode,
However, can you give some example of how to convert an object of type |
Beta Was this translation helpful? Give feedback.
There are 2 ways to convert pixel formats using
go-astiav
directly:Since the
pion
example you've linked uses software scale context and since it's the simplest one to setup, I think that'd be better for you to try this first.You can basically create a software scale context to convert from YUV422P into RGB and another one to convert from RGB to YUV422P. For the first one you'd have to make sure source and destination width and height are the same but source pixel format is YUV422P and destination pixel format is RGB here then, as in the example, use
ScaleFrame()
to convert pixel format. You can then use the same logic with your second software …