Genymobile / Genymobile/scrcpy

ffplay can not play video of V4L2 virtual camera with YUYV422 format

Open
#3,389 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C
Stars
150k
Forks
13.7k
Avg merge
4d 13h
Merged PRs (30d)
2

Description

I modified a line of code in scrcpy to generate a stream in YUYV422 format and output it to the V4L2 virtual camera. When I play it with ffplay, an error occurs.

1. app/src/v4l2_sink.c
![scrcpy](https://user-images.githubusercontent.com/30849637/180119296-679fd661-12c7-431f-83dd-78e0a360f2a2.png)

2. create a virtual camera
sudo v4l2loopback-ctl add /dev/video0 -b 8

3. set format of virtual camera
sudo v4l2loopback-ctl set-caps /dev/video0 "YUYV:640x480"

4. scrcpy to virtual camera
scrcpy --v4l2-sink /dev/video0

5. test with ffplay
ffplay -pixel_format yuyv422 -i /dev/video0

6. errors
[video4linux2,v4l2 @ 0x7f9654000b80] ioctl(VIDIOC_QUERYBUF): Invalid argument
/dev/video0: Invalid argument

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with app/src/v4l2_sink.c and reproduce the failure using the v4l2loopback setup, YUYV:640x480 caps, scrcpy --v4l2-sink, and ffplay -pixel_format yuyv422. Trace the V4L2 buffer setup around the reported VIDIOC_QUERYBUF error; done means ffplay can open and play the virtual camera stream without the Invalid argument error.

Written by the indexing model from the issue text.

Assessment

Tech stack
c, linux
Domain
operating-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.