Genymobile / Genymobile/scrcpy
How does scrcpy decode/display YUV420p frame?
- Dominant language
- C
- Stars
- 150k
- Forks
- 13.7k
- Avg merge
- 4d 13h
- Merged PRs (30d)
- 2
Description
My apologies in advanced if this is not an appropriate place to ask.
I'm new to C programming, I know a little bit of C#. I'm very interested in scrcpy and want to play around with it.
I want to save images that scrcpy gets from Android devices as JPEG files in BGRA or some RGB pixel format. In this function in "screen.c":
```
static bool sc_screen_update_frame(struct sc_screen *screen) {
...
AVFrame *frame = screen->frame;
...
}
```
I do this to get pixel format of that AVFrame:
```
const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(frame->format);
```
And I see that the pixel format is: yuv420p. I'm having troubles converting YUV420p to other formats and saving AVFrame to file.
Can I set scrcpy to output frame in other format other than yuv420p and how does scrcpy decode this frame to get it to appear in the window? Can somebody give me some pointers or some documents to read, I would very much appreciate it. Thank you!
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with screen.c and sc_screen_update_frame(), then trace how the AVFrame is passed to the display path. Review the AVFrame format handling and the referenced YUV420p conversion and image-saving questions. Done would be a documented explanation of the decode and display flow, including whether another output format can be configured.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- android, c
- Domain
- desktop-dev, mobile-dev
- Issue type
- Documentation
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 20/100