Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Orange pi 5 plus HDMI IN native V4L2 support really needed (OBS crashes) #830

Open
MaximKurakin opened this issue May 26, 2024 · 85 comments

Comments

@MaximKurakin
Copy link

MaximKurakin commented May 26, 2024

Thank you for your tremendous efforts!!!
I'm trying to build a re-streaming platform out of orange pi 5 plus with 24.04 Ubuntu from you. But there is a bummber issue like OBS and other apps cannot open HDMI in via v4l2 propertly due to driver IOCTL missing.

So i found another fork where it seems to me all fixed and hdmirx driver patched for rockchip and v4l2 compliance runs with no errors.
https://gitlab.collabora.com/hardware-enablement/rockchip-3588/linux/-/issues/4#note_152133
The core issue which crashes OBS is lack of VIDIOC_G_PARM ioctl.

Could you please merge those chages with you build?

Grabbing HDMI IN with gstreamer or ffmpeg is working but i'm getting 30 fps max at 4K resolution and cannot change it no matter what setting i'm trying to apply. I need to get 2K in 60 FPS. I think this orange pi is capable of doing it with no effors (spec says 4K 60fps but nobody can get it from HDMI IN so far). It would be great to just plug and play HDMI IN via V4L2 directly to OBS and check what fps will i get then.

Thank you!

@MaximKurakin MaximKurakin changed the title orange pi 4 plus HDMI IN native support realy needed orange pi 4 plus HDMI IN native V4L2 support realy needed (OBS crashes) May 26, 2024
@MaximKurakin MaximKurakin changed the title orange pi 4 plus HDMI IN native V4L2 support realy needed (OBS crashes) Orange pi 5 plus HDMI IN native V4L2 support realy needed (OBS crashes) May 26, 2024
@Joshua-Riek
Copy link
Owner

Good find, have you confirmed the kernel patch works?

@MaximKurakin
Copy link
Author

I'm trying to build the media module right now and test in on my Orange PI 5 PLUS. But it might take a while as soon as i'm really new in kernel drivers building. Struggling with finding proper way to override kernel media module with my module at working ubuntu 24.04.

What did i do:

  1. built a m2m-deinterlace.ko (i'm pretty sure this is not what needed). Added VIDIOC_G_PARM handler to drivers/media/platform/rockchip/hdmirx/rk_hdmirx.c.
  2. installed it to /lib/modules/6.1.0-1013-rockchip/extra
  3. reboot
  4. nothing changed.

I really need a good push in right direction =)

@Joshua-Riek
Copy link
Owner

If you have the kernel build dependencies installed correctly cd into your kernel tree and enter the below to re-build the kernel. You can then install the deb package.

# Setup env
export $(dpkg-architecture -aarm64)
export CROSS_COMPILE=aarch64-linux-gnu-
export CC=aarch64-linux-gnu-gcc
export LANG=C

# Compile the kernel into a deb package
fakeroot debian/rules clean binary-headers binary-rockchip do_mainline_build=true

@Joshua-Riek
Copy link
Owner

I can try to test on my end in a few hours, i'm currently working on some U-Boot code for some new Radxa boards.

@neofeo
Copy link

neofeo commented May 26, 2024

I am quite sure that in order to get hdmi in to work in obs studio we would need panthor. This is what amazingfate claim. So, should be pinned here.

@MaximKurakin
Copy link
Author

Guys. Sorry for delay. I had to do a slight detour to GPIO and FAN settings, because during kernel compilation my orange pi was trying to melt ... So, the progress exist. I'v managed to reduce amount of v4l2-compliance errors from 9 to 7 as of today... OBS still crashes though...

@MaximKurakin MaximKurakin changed the title Orange pi 5 plus HDMI IN native V4L2 support realy needed (OBS crashes) Orange pi 5 plus HDMI IN native V4L2 support really needed (OBS crashes) May 31, 2024
@MaximKurakin
Copy link
Author

I am quite sure that in order to get hdmi in to work in obs studio we would need panthor. This is what amazingfate claim. So, should be pinned here.

Well according to the article new GPU driver will be merged with kernel 6.10 (we expect this driver to land in Linux v6.10). But we are sitting on 6.1. I think it will take years to get there... Do you think enabling HDMI IN v4l2 full support completerly impossible with current panfrost driver? Even if i'll fix hdmirx driver for rk3855?

just let it here for future reference https://www.collabora.com/news-and-blog/news-and-events/release-the-panthor.html

@neofeo
Copy link

neofeo commented May 31, 2024

I mean, currently, hdmi in performs really bad in obs wheb used with v4l2 (at least when it worked). The only real way to use it is with a gst pipeline, and that's inside a windowd, not in obs itself. Panthor is meant for mainline, but was backpoorted by boogie to bsp 6.1

@MaximKurakin
Copy link
Author

Ok this is my bes effort after 2 weeks of sufferring without sleep, food and life itself ... v4l2-compliance shows 0 errors and 0 warnings!
But driver still throttling and dropping frames -((( so i'm getting same 4k30 or 1080p30 no more... OBS still crashes also ... I really need someboody to look at my attemt here https://github.com/MaximKurakin/linux-rockchip.git

I was making test like this:
gst-launch-1.0 v4l2src device=/dev/video0 ! videoconvert ! fpsdisplaysink
showing only unstable 30 fps at 4K and even at 1080p60 this test also shows 30 FPS! why? external source gives solid 60 fps.

ffmpeg -f v4l2 -video_size 3920x2160 -i /dev/video0 -pix_fmt yuv420p -vf "format=yuv420p" -framerate 60 -c:v rawvideo -vsync 1 -f sdl "SDL output"
shows broken picture repeting screen 3 time in a row with broken colors (Trying to reach 0 errors in v4l2-compliance I messed up with yuv420p colospace i think)

I have tried to merge synopsis driver with rockchip because the source code is almost the same in general... But i'm week in DMA flags, bits and fencing... I need somebody more talanted and experienced to look at it. Any help is very much appreciated! I think if we can solve DMA sync issues we will finally fix rockchip driver for good and will get 4k60 as entitled in orange pi 5 plus specification... Nobody touched this driver since 2021... Let's fix it up all together!

@neofeo
Copy link

neofeo commented Jun 10, 2024

I would love to help, but I am not capable. Did you try to contact amazingfate? The only way I got decent hdmi in was with ximagesynk streaming pipelines and obs recording my desktop, at even then, I never got 1080p60 out of it. He claimed tha tin order to really use it inside obs, so, as a v4l2 source, we had to use panthor and even then it would need more work. You should at least co tact him and boogie at radxa discord, or armbian one.

@dfloer
Copy link

dfloer commented Jun 11, 2024

@MaximKurakin Did you happen to test HDMI audio input with the Collabora code? It was my understanding that they didn't support it yet.

Also, you might want to look at the obs-gstreamer plugin. If performance is bad, you might be doing colour format conversion on the CPU rather than RGA. I've never tried it directly in OBS, just in gstreamer directly.

@MaximKurakin
Copy link
Author

Collabora driver doesn't support audio and HDCP. Thats why I went into madness of merging current rockchip driver with it.
I wanted to take only good working parts from both of them and create new complianced driver with full support of video, audio, CEC and HDCP support.
I've tried everything I could google =) gstreamer fpsdisplaysink is my main testing tool. The problem is not in the external tools like ffplay, vlc, gstreamer ... the driver itself messes up with DMA timings and my 60 fps turns into 30 because drivers is shouting about massive frame drops internally.

In debug mode drivers gives something like:

[ 1632.249161] fdee0000.hdmirx-controller: dma_irq st1:0x80, st13:2160
[ 1632.249164] fdee0000.hdmirx-controller: dma_idle_int_handler: next_buf NULL, skip vb_done!
[ 1632.257834] fdee0000.hdmirx-controller: dma_irq st1:0x100, st13:1081
[ 1632.257844] fdee0000.hdmirx-controller: line_flag_int_handler: curr_fd:0
[ 1632.257847] fdee0000.hdmirx-controller: line_flag_int_handler: next_fd:24887296
[ 1632.265836] fdee0000.hdmirx-controller: dma_irq st1:0x80, st13:2160
[ 1632.265847] fdee0000.hdmirx-controller: vb_done fd:0
[ 1632.273395] fdee0000.hdmirx-controller: qbuf fd:37330944
[ 1632.274504] fdee0000.hdmirx-controller: dma_irq st1:0x100, st13:1081
[ 1632.274510] fdee0000.hdmirx-controller: line_flag_int_handler: curr_fd:24887296
[ 1632.274512] fdee0000.hdmirx-controller: line_flag_int_handler: next_fd:37330944
[ 1632.282495] fdee0000.hdmirx-controller: dma_irq st1:0x80, st13:2160
[ 1632.282504] fdee0000.hdmirx-controller: vb_done fd:24887296
[ 1632.291167] fdee0000.hdmirx-controller: dma_irq st1:0x100, st13:1081
[ 1632.291174] fdee0000.hdmirx-controller: line_flag_int_handler: next_buf NULL, drop the frame!
[ 1632.291176] fdee0000.hdmirx-controller: line_flag_int_handler: curr_fd:37330944
[ 1632.299162] fdee0000.hdmirx-controller: dma_irq st1:0x80, st13:2160
[ 1632.299165] fdee0000.hdmirx-controller: dma_idle_int_handler: next_buf NULL, skip vb_done!
[ 1632.303915] fdee0000.hdmirx-controller: qbuf fd:12443648
[ 1632.307829] fdee0000.hdmirx-controller: dma_irq st1:0x100, st13:1080
[ 1632.307832] fdee0000.hdmirx-controller: line_flag_int_handler: curr_fd:37330944
[ 1632.307834] fdee0000.hdmirx-controller: line_flag_int_handler: next_fd:12443648
[ 1632.315828] fdee0000.hdmirx-controller: dma_irq st1:0x80, st13:2160
[ 1632.315833] fdee0000.hdmirx-controller: vb_done fd:37330944

@MaximKurakin
Copy link
Author

MaximKurakin commented Jun 11, 2024

@MaximKurakin Did you happen to test HDMI audio input with the Collabora code? It was my understanding that they didn't support it yet.

Also, you might want to look at the obs-gstreamer plugin. If performance is bad, you might be doing colour format conversion on the CPU rather than RGA. I've never tried it directly in OBS, just in gstreamer directly.

I tried this plugin today (had a hard time with unclear dependencies during buld). yes i can capture gstreamer directly to obs now. but fps is still 30 and tonns of dropped frames -( Thank you for you advice anyway!

Also I tried obs beam plugin. (had very sophisticated intercource with build process for arm64). Yes it works but device cannot keep up with 2k 60fps at any jpeg compression quality even in quality 1!!!! black screen always flashing from time to time. All equipment has 2.5 Gbps caps but this orange pi 5 plus really cant keep up with the massive frames comming from network... I don't know if anybody even tried to launch obs-beam on orange pi ... but I did and it doesn't work as expected -((( platform simply doen't have enough performance

@MaximKurakin
Copy link
Author

You should at least co tact him and boogie at radxa discord, or armbian one.

Contacted. He only introduced : media: rockchip: hdmirx: add VIDIOC_G_PARM hack fix for Armbian. BUt this fix doesn' work for Jushua Riek build. I tested it already.
armbian/linux-rockchip@3900724

But he gave me hope with armbian embedded panthor driver support out of the box. SO, i'm going to give it a spin later today. Maybe with panthor driver overal graphical performance will be better?
armbian/linux-rockchip#171

@Joshua-Riek
Copy link
Owner

Panthor does not have better performance and has quite a few bugs and problems when playing games.

@neofeo
Copy link

neofeo commented Jun 11, 2024

To me, it has better performance,.overall. but even so, it has better features, and will have much better ones down the road. This is not about performance, but feautres

@MaximKurakin
Copy link
Author

MaximKurakin commented Jun 11, 2024

Ok. No more ARMBIAN for me!!!! It freezed 3 times in 30 minuts. HDMIRX driver exactly the sam as in Josua build ... 30 fps max. 9 compliance errors an 6 warnings. Morover! OBS doesn't recognize new panthor graphics and doesn't start . THis is a dead end to me.
I want to say great thank you to Joshua for this stable and glitch free build. I'll stick with it for a while and will try to contact rk chip developers directly. Because fore the fu8ck sake how the f888ck do you pass unit test for hdmirx driver if it throttles and v4l2-compliance shows 9 errors ? Damn...

@neofeo
Copy link

neofeo commented Jun 11, 2024

Obs doesnt start bc it needs PAN_MESA_DEBUG=gl3, it's probably forced on panfork by default

@neofeo
Copy link

neofeo commented Jun 11, 2024

I understand your suffering! Hahah yeah, hdmi in is only really usable from android as today.

@MaximKurakin
Copy link
Author

I don't give up with it. I'm just taking a pause to collect more information about HDMI protocol and rk388 chip memory access features. But after 2.5 weeks reading tons of web-sites and manuals ... I need vacation

@neofeo
Copy link

neofeo commented Jun 11, 2024

I don't give up with it. I'm just taking a pause to collect more information about HDMI protocol and rk388 chip memory access features. But after 2.5 weeks reading tons of web-sites and manuals ... I need vacation

Please contact me at armbian discord. Microlinux(salva)

@dfloer
Copy link

dfloer commented Jun 11, 2024

I'm definitely interested in collaborating on this, as I've been working with Rockchip SoCs for about a year and a half now for mobile livestreaming.

I've generally found the HDMI input to work well enough, except when it doesn't. And it can be frustrating when it doesn't.

Couple thoughts:

Early on, I was seeing pretty choppy performance, dropped frames, etc, but it seemed like at least some of that wasn't the HDMI input itself's fault, but a downstream element not being fast enough. In my case, the HDMI input was using a pixel format the encoder I was using didn't support, so I need to use a videoconvert element in between the capture and encoder.
By default, this seems to be running on the CPU, rather than the RGA hardware (which does support some pixel format conversions). When running on the CPU, it wasn't fast enough to always keep up, especially with 2160p sources, so it'd drop frames as buffers filled up. I was able to get good performance by setting the GST_VIDEO_CONVERT_USE_RGA environment variable to 1, which uses the RGA for hardware acceleration.

The drivers seem very fragile in their current state. Slight disturbances to the kernel, etc, seem to break things. I've had audio just stop working multiple times, and at least at one point, the colours went all weird.

When a briefly looked at OBS support, I was seeing issues due to multi-planar formats. I haven't looked closely, but this patchset may help solve some of those (or other) issues with the RGA and multi-planar formats: https://patchwork.kernel.org/project/linux-media/cover/20230914-rockchip-rga-multiplanar-v1-0-abfd77260ae3@pengutronix.de/

@neofeo
Copy link

neofeo commented Jun 11, 2024

Nice, I used that env var on my pipelines too and yes, obs seems to not support multiplannar formats. https://github.com/neofeo/BOX86-BOX64-WINEx86-TUTORIAL/blob/main/gst/hdmi_in.sh

@MaximKurakin
Copy link
Author

Hmm . This GST_VIDEO_CONVERT_USE_RGA didn't help me. Same frame drops and 30 fps max -((((

More insteresting is OBS crach logs:

sendmsg(11, {msg_name=NULL, msg_namelen=0, msg_iov=[{iov_base="\4\0\0\0\0\0\f\08\0\0\0\4\0\0\0\0\0\f\0;\0\0\0\4\0\0\0\1\0\f\0"..., iov_len=708}], msg_iovlen=1, msg_controllen=0, msg_flags=0}, MSG_DONTWAIT|MSG_NOSIGNAL) = 708
futex(0xaaaae62622fc, FUTEX_WAKE_PRIVATE, 1) = 1
futex(0xaaaae62622a0, FUTEX_WAKE_PRIVATE, 1) = 1
futex(0xaaaae6526c58, FUTEX_WAKE_PRIVATE, 1) = 1
ppoll([{fd=12, events=POLLIN}, {fd=14, events=POLLIN}, {fd=21, events=POLLIN}, {fd=29, events=POLLIN}, {fd=33, events=POLLIN}], 5, {tv_sec=0, tv_nsec=0}, NULL, 0) = 1 ([{fd=14, revents=POLLIN}], left {tv_sec=0, tv_nsec=0})
read(14, "1\0\0\0\0\0\0\0", 8)          = 8
write(14, "\1\0\0\0\0\0\0\0", 8)        = 8
**openat(AT_FDCWD, "/dev/v4l/by-id/", O_RDONLY|O_NONBLOCK|O_CLOEXEC|O_DIRECTORY) = -1 ENOENT (No such file or directory)**
writev(2, [{iov_base="free(): invalid pointer", iov_len=23}, {iov_base="\n", iov_len=1}], 2free(): invalid pointer
) = 24
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xffffb60b1000
rt_sigprocmask(SIG_UNBLOCK, [ABRT], NULL, 8) = 0
gettid()                                = 5117
getpid()                                = 5117
tgkill(5117, 5117, SIGABRT)             = 0
--- SIGABRT {si_signo=SIGABRT, si_code=SI_TKILL, si_pid=5117, si_uid=1000} ---
+++ killed by SIGABRT (core dumped) +++
Aborted (core dumped)

and same time hdmirx shows only this one line:

[  826.694132] fdee0000.hdmirx-controller: hb
[  827.704136] fdee0000.hdmirx-controller: hb
**[  827.897675] fdee0000.hdmirx-controller: tx_5v_power_present: 1**
[  828.720816] fdee0000.hdmirx-controller: hb
[  829.734162] fdee0000.hdmirx-controller: hb

I hope it will give somebody a hint where is the issue

@MaximKurakin
Copy link
Author

MaximKurakin commented Jun 12, 2024

I haven't looked closely, but this patchset may help solve some of those (or other) issues with the RGA and multi-planar formats: https://patchwork.kernel.org/project/linux-media/cover/20230914-rockchip-rga-multiplanar-v1-0-abfd77260ae3@pengutronix.de/

I'm on it. Will test it in a couple hours...

@MaximKurakin
Copy link
Author

MaximKurakin commented Jun 12, 2024

I haven't looked closely, but this patchset may help solve some of those (or other) issues with the RGA and multi-planar formats: https://patchwork.kernel.org/project/linux-media/cover/20230914-rockchip-rga-multiplanar-v1-0-abfd77260ae3@pengutronix.de/

I'm on it. Will test it in a couple hours...

Nope... nothing changed. The most surprizing part is that i'm grabbing 1080p60 and getting 30 fps. Then I set 30 hz to the HDMI 2 display out (i'm using orange pi 5 plus as a source and as an input just made a cable loop hdmi2 to hdmi in) and grab it - i'm getting 20 fps... oddd

@MaximKurakin
Copy link
Author

More research comming up:

I stopped totruring hdmi in and decided to make a clean perf test of my SBC caps. Here is the result:

  1. test with 4K30 gave me more or less stable 30 fps with low drops.
    GST_VIDEO_CONVERT_USE_RGA=1 gst-launch-1.0 videotestsrc ! video/x-raw,width=3840,height=2160,framerate=30/1 ! fpsdisplaysink
  2. test with 4K60 killed my board and gave me 0 fps ! all frames were dropped! I wonder why?
    GST_VIDEO_CONVERT_USE_RGA=1 gst-launch-1.0 videotestsrc ! video/x-raw,width=3840,height=2160,framerate=60/1 ! fpsdisplaysink
  3. test with 1080p120 was surprisingly floppy. FPS were jumping betwen 110 and 60 fps. with massive drops. WTF?
    GST_VIDEO_CONVERT_USE_RGA=1 gst-launch-1.0 videotestsrc ! video/x-raw,width=1920,height=1080,framerate=120/1 ! fpsdisplaysink

I did the test wrong way? Or it's my orange pi 5 plus actual limits ?

@ramiropolla
Copy link

I'm working on upstreaming support for HDMI input for the Orange Pi 5 Plus to FFmpeg.
I didn't try the driver from Collabora, since it looks like it's still a work-in-progress. But we definitely need the VIDIOC_G_PARM ioctl. I opened a PR here: Joshua-Riek/linux-rockchip#18
I didn't manage to change the pixel format for HDMI input, so I ended up having to rebuild the kernel whenever I wanted to test different pixel formats. There is still a long way to go before the driver is fully operational.

This is excellent to see, thanks.
I'm also interested in figuring out how to make the driver show the proper pixel format. If I feed it a NV12, NV16 or NV24 signal, it still claims that the signal is RGB, resulting in glitchy colours if I take it at face value. Doing a format conversion to the expected pixel format allows me to fix this, but it'd be nice if the metadata was correct.

I'll have a look when I have the time again.

That's odd. When I plug an NV24 input I get this:

$ v4l2-ctl -all
Driver Info:
	Driver name      : rk_hdmirx
	Card type        : rk_hdmirx
	Bus info         : fdee0000.hdmirx-controller
	Driver version   : 6.1.43
	Capabilities     : 0x84201000
		Video Capture Multiplanar
		Streaming
		Extended Pix Format
		Device Capabilities
	Device Caps      : 0x04201000
		Video Capture Multiplanar
		Streaming
		Extended Pix Format
Priority: 2
Video input : 0 (hdmirx: ok)
DV timings:
	Active width: 1920
	Active height: 1080
	Total width: 2200
	Total height: 1125
	Frame format: progressive
	Polarities: -vsync -hsync
	Pixelclock: 148492000 Hz (60.00 frames per second)
	Horizontal frontporch: 88
	Horizontal sync: 44
	Horizontal backporch: 148
	Vertical frontporch: 4
	Vertical sync: 5
	Vertical backporch: 36
	Standards: 
	Flags: 
DV timings capabilities:
	Minimum Width: 640
	Maximum Width: 4096
	Minimum Height: 480
	Maximum Height: 2160
	Minimum PClock: 20000000
	Maximum PClock: 600000000
	Standards: CTA-861
	Capabilities: Interlaced, Progressive
Format Video Capture Multiplanar:
	Width/Height      : 1920/1080
	Pixel Format      : 'NV24' (Y/UV 4:4:4)
	Field             : None
	Number of planes  : 1
	Flags             : set-csc, 0x0000002c
	Colorspace        : Default
	Transfer Function : Unknown (0x00000020)
	YCbCr/HSV Encoding: xvYCC 601
	Quantization      : Default
	Plane 0           :
	   Bytes per Line : 1920
	   Size Image     : 6220800

User Controls

            audio_sampling_rate 0x00981a80 (int)    : min=0 max=768000 step=1 default=0 value=48000 flags=read-only, volatile
                  audio_present 0x00981a81 (bool)   : default=0 value=1 flags=read-only, volatile

Digital Video Controls

                  power_present 0x00a00964 (bitmask): max=0x00000001 default=0x00000000 value=1 flags=read-only

And FFmpeg is happy treating it as NV24.

@dfloer
Copy link

dfloer commented Jun 28, 2024

I'll need to test again with the new kernel. Maybe your recent patch fixed this issue...

@MaximKurakin
Copy link
Author

MaximKurakin commented Jul 1, 2024

@michelehokuto friend. Shortly - with current gstreamer condition any videoscale and videoconvert gives you a lot of CPU usage and you cannot get 60 fps in any resolution at orange pi 5 plus. For some reason gstreamer likes only NV12 format. Both NV24 and RGB will give you "not negotiated error" and you will have to use videoconvert. As of today I didn't manage to capture 1080p60 NV24 or RBG in OBS due to low performance issues.

The best way is to leave it in NV12 color space and 4K and scale it in OBS by changing the canvas size.
Try to launch this code and grab this window by OBS "windows capture" function. You will see good stable 4K 60 and bearable CPU load. FYI: DO NOT USE "fps-overlay" as is (on the screen) it kills the performance significantly! Use always: signal-fps-measurements=true text-overlay=false and check FPS in the console. Also keep in mind that glimagesink renders openGL window directly to you monitor in the current display resolution. It means if you have 4K in you HDMI IN but your monitor is 1080p and you are using glimagesink - you final resolution is 1080. You may use xvimagesink instead but it goes with windows header and borders:

GST_DEBUG=2,fpsdisplaysink:4 gst-launch-1.0 v4l2src device=/dev/video0 ! video/x-raw,format=NV12,height=2160,width=3840,framerate=60/1,pixel-aspect-ratio=1/1,interlace-mode=progressive ! fpsdisplaysink video-sink=glimagesink signal-fps-measurements=true text-overlay=false sync=false -v

image

If you need only to record in 1080 then try ffmeg. It will also generates tons of CPU load but still can provide 60 FPS the trick is scaling with rkrga hardware support which you cannot set in gstreamer (i don't know how):
ffmpeg -init_hw_device rkmpp -f v4l2 -i /dev/video0 -vf "format=nv12|nv16|bgr24,hwupload,scale_rkrga=w=1920:h=1080:format=nv12:afbc=1" -c:v hevc_rkmpp -qp_init 18 -g:v 120 -v verbose -f nut - | mpv -

If you still need NV24 then use GST_DEBUG=4 param to see what is actually breaking negotiation in gstreamer. Usually it's a wrong colorspace which forces you to use videoconvert.

I know this is ridiculous but rk3588 chip software support currenly in the very raw state. RK3588 spec says "hardware encoding and decoding support" but actually all needed software (ffmpeg, ffplay, vlc, gst, obs ... ) are not fully support our chip. THere are separeted efforts to enable our chip support from the hard working guys like Joshua(stitching all togather) and nyanmisaka (ffmpeg for rockchip HW encoding\decoding), collabora (https://gitlab.collabora.com/hardware-enablement/rockchip-3588/notes-for-rockchip-3588/-/blob/main/mainline-status.md - attempt to enable ALL hardware in upstream kernel for rockchip) but all this attempts are still "work in progress". If you are good at codding - then hack into the source code and DYI -) but if you are just a normal user - just wait for panthor upstream support (6.10 kernel myabe?) and suffer.

I'm still working on HDMIRX driver by myself and managed to add VIDIOC_G_PARM to it and also fix 4 errors out of 9 but my work is still far from completion.

@dfloer
Copy link

dfloer commented Jul 1, 2024

For some reason gstreamer likes only NV12 format. Both NV24 and RGB will give you "not negotiated error" and you will have to use videoconvert.

This sounds like the issues I was describing, where the capture device doesn't signal to gstreamer what format it's using. If your input is NV12, you need to use NV12. The capture device doesn't do any pixel format conversion, so choosing the wrong format will have it fail to negotiate.

Shortly - with current gstreamer condition any videoscale and videoconvert gives you a lot of CPU usage and you cannot get 60 fps in any resolution at orange pi 5 plus.

Setting the environment variable GST_VIDEO_CONVERT_USE_RGA=1 should use the RGA for video conversion and scaling. It has worked previously with 4k video for me.

@MaximKurakin
Copy link
Author

MaximKurakin commented Jul 1, 2024

Setting the environment variable GST_VIDEO_CONVERT_USE_RGA=1 should use the RGA for video conversion and scaling. It has worked previously with 4k video for me.

Could prove it with this cmd (downscale 4k to FHD 60) ( to check RGA is actually involved I used this cmd sudo cat /sys/kernel/debug/rkrga/load):
GST_VIDEO_CONVERT_USE_RGA=1 GST_DEBUG=4 gst-launch-1.0 v4l2src device=/dev/video0 io-mode=4 ! videoconvert ! video/x-raw,format=NV12,height=2160,width=3840,framerate=60/1 ! videoscale ! video/x-raw,format=NV12,height=1080,width=1920,framerate=60/1 ! fpsdisplaysink video-sink=xvimagesink signal-fps-measurements=true text-overlay=false sync=false -v

But my Laptop Nvidia with Optimus looks like try to play "smart" and if nothing is moving on the screen it drops fps down to 30 from time to time. Anyway, that should be irrelevant for your task.

image

But trying to do the same with glimagesink doesn't work... I think opengl accepts only RGB signal? Could anybody make it work? I cound't find how to convert NV12 to RGB or to NV24...
GST_VIDEO_CONVERT_USE_RGA=1 GST_DEBUG=4 gst-launch-1.0 v4l2src device=/dev/video0 io-mode=4 ! videoconvert ! video/x-raw,format=NV12,height=2160,width=3840,framerate=60/1 ! videoscale ! video/x-raw,format=NV12,height=1080,width=1920,framerate=60/1 ! fpsdisplaysink video-sink=glimagesink signal-fps-measurements=true text-overlay=false sync=false -v

@MaximKurakin
Copy link
Author

MaximKurakin commented Jul 2, 2024

Could anybody make it work? I cound't find how to convert NV12 to RGB or to NV24...

Hmmm maybe something is really wrong with 1080 NV24 format? I connected Orange Pi 5 Plus HDMI 2 to HDMI IN and set 1080p60 NV24.

Format Video Capture Multiplanar:
	Width/Height      : 1920/1080
	Pixel Format      : 'NV24' (Y/UV 4:4:4)
	Field             : None
	Number of planes  : 1
	Flags             : 
	Colorspace        : Rec. 709
	Transfer Function : Unknown (0x00000098)
	YCbCr/HSV Encoding: xvYCC 709
	Quantization      : Default
	Plane 0           :
	   Bytes per Line : 1920
	   Size Image     : 6220800

Then tried to capture it with gstreamer:
GST_VIDEO_CONVERT_USE_RGA=1 GST_DEBUG=4 gst-launch-1.0 v4l2src device=/dev/video0 ! video/x-raw,format=NV24,height=1080,width=1920,framerate=60/1 ! videoconvert ! video/x-raw,format=NV12,height=1080,width=1920,framerate=60/1 ! fpsdisplaysink video-sink=xvimagesink signal-fps-measurements=true text-overlay=false sync=false -v

And I'm getting only 30 stable FPS and zero RGA usage even with GST_VIDEO_CONVERT_USE_RGA=1 . WTF? Also I had to convert NV24 to NV12 because xvimagesink doesn't work with NV24 -(

Screenshot from 2024-07-02 08-41-13

Possible reason one CPU core is 60% loaded.
Screenshot from 2024-07-02 09-44-32

@MaximKurakin
Copy link
Author

MaximKurakin commented Jul 2, 2024

RGB capturing in 1080p60 is broken completely. 4 FPS only

Format Video Capture Multiplanar:
	Width/Height      : 1920/1080
	Pixel Format      : 'BGR3' (24-bit BGR 8-8-8)
	Field             : None
	Number of planes  : 1
	Flags             : 
	Colorspace        : sRGB
	Transfer Function : Unknown (0x00000098)
	YCbCr/HSV Encoding: Unknown (0x000000ff)
	Quantization      : Limited Range
	Plane 0           :
	   Bytes per Line : 5760
	   Size Image     : 6220800

GST_VIDEO_CONVERT_USE_RGA=1 GST_DEBUG=4 gst-launch-1.0 v4l2src device=/dev/video0 ! video/x-raw,format=BGR,height=1080,width=1920,framerate=60/1 ! fpsdisplaysink video-sink=glimagesink signal-fps-measurements=true text-overlay=false sync=false -v

image

Possible reason: One CPU core is always 100% loaded. Gstreamer issue? single core RGB encoding? hmmm I don't know...
image

@MaximKurakin
Copy link
Author

MaximKurakin commented Jul 2, 2024

Then only color format which gives stable 60 FPS for 1080p is NV16!

Format Video Capture Multiplanar:
	Width/Height      : 1920/1080
	Pixel Format      : 'NV16' (Y/UV 4:2:2)
	Field             : None
	Number of planes  : 1
	Flags             : 
	Colorspace        : Default
	Transfer Function : Unknown (0x00000098)
	YCbCr/HSV Encoding: xvYCC 601
	Quantization      : Default
	Plane 0           :
	   Bytes per Line : 1920
	   Size Image     : 4147200

GST_VIDEO_CONVERT_USE_RGA=1 GST_DEBUG=4 gst-launch-1.0 v4l2src device=/dev/video0 ! video/x-raw,format=NV16,height=1080,width=1920,framerate=60/1 ! fpsdisplaysink video-sink=glimagesink signal-fps-measurements=true text-overlay=false sync=false -v

image

CPU graph is fine and flat
Screenshot from 2024-07-02 09-40-00

@MaximKurakin
Copy link
Author

MaximKurakin commented Jul 2, 2024

Finally I could achieve my goal to stream in 60 fps!!!! but only in 1080p =((( OPI 5 PLUS can handle 2k streaming but fps will be jumping between 44 to 56. Not eyes pleasing I must say...
*Also NV16 color space is limited and can cause broken color gradients if your source is already compressed.

Short instructions for those who wants to get the same 1080p60 with camera and gstreamer hw h264 encoding to youtube:

  1. Build and install to OBS obs-gstreamer plugin and you will get hardware encoder h264 via gstreamer IN OBS

image

  1. Build and install to OBS droid-cam-obs plugin and you will get 1080p60 smooth camera with minimum workload via Wifi

image

  1. Setup your gaming PC HDMI to output 1080p60 in NV16 (YCbCr422) and start gstreamer on Orange PI 5 Plus:

GST_VIDEO_CONVERT_USE_RGA=1 GST_DEBUG=4 gst-launch-1.0 v4l2src device=/dev/video0 ! video/x-raw,format=NV16,height=1080,width=1920,framerate=60/1 ! fpsdisplaysink video-sink=glimagesink signal-fps-measurements=true text-overlay=false sync=false -v

  1. Setup OBS canvas and video settings to 1080

image

  1. Capture openGL window in OBS via "Window Capture"

image

  1. Start streaming and enjoy stable 60 fps streaming!!! Orange Pi will need cooling to handle this workload (I have noctua 80mm cooler + huge cooper radiator + custom bash script daemon handling PWM Fan control. But GPIO and PWM is a big topic for other time. will not post it here)

image
@michelehokuto just tag you because you were asking for something like this in another thread.

@RkhanTUM
Copy link

Hello all , just want to know what I have to directly do to run HDMI input as I want to grab images using opencv. I am knew to orange pi 5 plus.
if there any straight forward steps as I not that much good.
Thanks in advance

@jaffenaegel
Copy link

Hello all, sorry to be a complete noob at this but just like benhoff I kind of bought an OPi5+ and expected it to just work lol. I'm not 100% sure that I'm correct to post this here so if I'm wrong let me know and if you can redirect me to a place where I can handle my issue that would be great, anyway here I go.

My goal is to have a headless OPi5+ that can read HDMI input (video only, 30fps @ 1920x1080, not really the most demanding) in C++ using opencv. I read somewhere online it would just show up as a video device but that's not how it went down.

This is my code:

#include <opencv2/core.hpp>
#include <opencv2/videoio.hpp>
#include <iostream>

using namespace cv;

int main()
{
    VideoCapture cap("/dev/video0");
    if (!cap.isOpened())
    {
        std::cout << "Doesn't work :(" << std::endl;
    }
}

I get something like:

[ WARN:0] global ./modules/videoio/src/cap_gstreamer.cpp (2075) handleMessage OpenCV | GStreamer warning: Embedded video playback halted; module source reported: could not read from resource.
[WARN:0] global ./modules/videoio/src/cap_gstreamer.cpp (1053) open OpenCV | GStreamer warning: unable to start pipeline
[WARN:0] global ./modules/videoio/src/cap_gstreamer.cpp (616) isPipelinePlaying OpenCV | GStreamer warning: GStreamer: pipeline have not been created
Doesn't work :(

GStreamer says that /dev/video0 is not a device though...

using:

v4l2-ctl -d /dev/video0 --get-fmt-video

I can get the configuration of the hdmi input (laptop connected as a test)

Then I do this command:

ffmpeg -f v4l2 -input_format BGR3 -video_size 1920x1080 -i /dev/video0 -vcodec libx264 output.mp4

However the output of this command ends with:

[video4linux2 @ 0x5596cd4bc0] Not a video capture device.
/dev/video0: No such device

So I'm at a total loss on how to do this tbh. I have enabled hdmirx and I can see /dev/video0...

Again, I'm not the best developer out there, still I hope to simply get all the pixel data in c++. I hope I'm not wasting your time, I was just wondering if this is the reason why it isn't working.

just like @RkhanTUM, I also wanna know on how to get the input on opencv. In the comment I'm answering to I basically tell you what I tried so far.

If anyone could give clear steps for beginners like me on how to get the data without obs that would be fantastic, thanks in advance

@neofeo
Copy link

neofeo commented Sep 16, 2024

@MaximKurakin can you point out in which ubuntu rockchip release you are? I can't reproduce your success. At 1080p, it won't do N16 on my side

@MaximKurakin
Copy link
Author

@MaximKurakin can you point out in which ubuntu rockchip release you are? I can't reproduce your success. At 1080p, it won't do N16 on my side

Hello friend. I'm sitting tight on Joshua's Ubuntu 24.04 LTS (GNU/Linux 6.1.0-1017-rockchip aarch64) release . Just because I started my infinite stream to youtube I cannot touch this devise anymore. From time to time i'm checking both armbian and Jushua releases and waiting for this HDMI-IN sortware maihem to complete. New panthor driver upstream support is what should make our life easier. Without proper kernell support currently there is no way to grab HDMI-IN port signal in the "normal" way.

@neofeo
Copy link

neofeo commented Sep 16, 2024

Yes, I would also agree thst the hdmi input and the rk3588 delivers insane quality and very low latency. With proper software, this kind of devices would outshine any capture card. Hopefully we can use it as any other v4l2 source in obs on mainline woth panthor,etc...

@neofeo
Copy link

neofeo commented Sep 16, 2024

I am downloading latest release, wish me luck!

@neofeo
Copy link

neofeo commented Sep 16, 2024

@MaximKurakin the problem remains the same, I cant use NV12 with hdmi input .. that being said, obs recording seems to have been fixed in noble!! that's great @Joshua-Riek
image

my main script remains the same since I cant force it to use NV12 or NV16

#!/bin/bash

# Kill all existing GStreamer instances
killall gst-launch-1.0

# Define the window title of your GStreamer window
WINDOW_TITLE="gst-launch-1.0"

# Check if wmctrl is installed
if ! command -v wmctrl &>/dev/null; then
    echo "Error: wmctrl is not installed. Please install it using your package manager."
    exit 1
fi

# Function to toggle fullscreen state
toggle_fullscreen() {
    # Sleep for a moment to ensure the window is created
    sleep 2

    # Find the window ID of the GStreamer window by title
    WINDOW_ID=$(wmctrl -l | grep "$WINDOW_TITLE" | awk '{print $1}')

    if [ -z "$WINDOW_ID" ]; then
        echo "Error: GStreamer window not found."
        exit 1
    fi

    # Toggle fullscreen state
    wmctrl -i -r "$WINDOW_ID" -b toggle,fullscreen
}

# Variables
export GST_MPP_VIDEODEC_DEFAULT_ARM_AFBC=1
export GST_VIDEO_CONVERT_USE_RGA=1
export GST_V4L2_PREFERRED_FOURCC=NV12
export GST_VIDEO_CONVERT_PREFERRED_FORMAT=NV12
export GST_MPP_DEC_DEFAULT_FAST_MODE=1

# Launch the GStreamer video pipeline
echo "Launching GStreamer video pipeline..."
gst-launch-1.0 -e v4l2src device=/dev/video0 ! video/x-raw ! videoconvert ! ximagesink sync=false &

# Toggle fullscreen
toggle_fullscreen

note: most of those variables aren't really used

@benhoff
Copy link

benhoff commented Sep 17, 2024

Here's a 90% solution with v4l2, just have to clean out the qt specific code. Also switch from bgr24.

https://pastebin.com/S1DKTcsy

Code is free as in puppy.

I guess I should mention this works against mainline kernel. Haven't tried it on the bsp.

@neofeo
Copy link

neofeo commented Sep 17, 2024

@benhoff we need a more detailed explanation.

@neofeo
Copy link

neofeo commented Sep 17, 2024

@MaximKurakin so, Amazingfate is working on a PR to add proper support for v4l2 for the hdmi input on the bsp kernel.

@MaximKurakin
Copy link
Author

@MaximKurakin so, Amazingfate is working on a PR to add proper support for v4l2 for the hdmi input on the bsp kernel.

Good to konw that! I spent months trying to fix the HDMI-RX driver. And yes I had a good proggress but had to switch to another activities. At one of my buillds it was possible to natively use HDMI-IN via v4l2 but there were so many other issues with the signal which I didn't have time to solve. I'll be happy to share my work with someone who have mote rime than me.

@MaximKurakin
Copy link
Author

Here's a 90% solution with v4l2, just have to clean out the qt specific code. Also switch from bgr24.

https://pastebin.com/S1DKTcsy

Code is free as in puppy.

I guess I should mention this works against mainline kernel. Haven't tried it on the bsp.

Agreed. BGR24 transcoding causes a lot of CPU load. I've made all the test in the messages abothe

NV16 - #830 (comment)
RBG (the worst FPS) - #830 (comment)
NV24 - #830 (comment)
NV12 (worst quality but easiest for CPU) - #830 (comment)

So you should find a way to output NV12 or NV16 to OPI 5 PLUS. It it's windows PC you can use CRU tools to create custom resolution with custom colorspace.
image

@logand99
Copy link

logand99 commented Sep 21, 2024

Anyone figure out using ffmpeg with hdmirx? I just installed the most recent version 2.3.2 24.0.4.

It looks like something isnt working right, not sure if I need to be on an older version?

v4l2-compliance -d /dev/video0
v4l2-compliance 1.26.1, 64 bits, 64-bit time_t

Compliance test for rk_hdmirx device /dev/video0:

Driver Info:
	Driver name      : rk_hdmirx
	Card type        : rk_hdmirx
	Bus info         : fdee0000.hdmirx-controller
	Driver version   : 6.1.75
	Capabilities     : 0x84201000
		Video Capture Multiplanar
		Streaming
		Extended Pix Format
		Device Capabilities
	Device Caps      : 0x04201000
		Video Capture Multiplanar
		Streaming
		Extended Pix Format

Required ioctls:
		fail: v4l2-compliance.cpp(667): missing bus_info prefix ('fdee0000.hdmirx-controller')
	test VIDIOC_QUERYCAP: FAIL
		fail: v4l2-compliance.cpp(810): doioctl(node, ioc, nullptr) != ENOTTY
	test invalid ioctls: FAIL

Allow for multiple opens:
	test second /dev/video0 open: OK
		fail: v4l2-compliance.cpp(667): missing bus_info prefix ('fdee0000.hdmirx-controller')
	test VIDIOC_QUERYCAP: FAIL
	test VIDIOC_G/S_PRIORITY: OK
	test for unlimited opens: OK

Debug ioctls:
	test VIDIOC_DBG_G/S_REGISTER: OK (Not Supported)
	test VIDIOC_LOG_STATUS: OK

Input ioctls:
	test VIDIOC_G/S_TUNER/ENUM_FREQ_BANDS: OK (Not Supported)
	test VIDIOC_G/S_FREQUENCY: OK (Not Supported)
	test VIDIOC_S_HW_FREQ_SEEK: OK (Not Supported)
	test VIDIOC_ENUMAUDIO: OK (Not Supported)
	test VIDIOC_G/S/ENUMINPUT: OK
	test VIDIOC_G/S_AUDIO: OK (Not Supported)
	Inputs: 1 Audio Inputs: 0 Tuners: 0

Output ioctls:
	test VIDIOC_G/S_MODULATOR: OK (Not Supported)
	test VIDIOC_G/S_FREQUENCY: OK (Not Supported)
	test VIDIOC_ENUMAUDOUT: OK (Not Supported)
	test VIDIOC_G/S/ENUMOUTPUT: OK (Not Supported)
	test VIDIOC_G/S_AUDOUT: OK (Not Supported)
	Outputs: 0 Audio Outputs: 0 Modulators: 0

Input/Output configuration ioctls:
	test VIDIOC_ENUM/G/S/QUERY_STD: OK (Not Supported)
		fail: v4l2-test-io-config.cpp(166): TIMINGS cap set, but could not get current timings
		fail: v4l2-test-io-config.cpp(386): Timings check failed for input 0.
	test VIDIOC_ENUM/G/S/QUERY_DV_TIMINGS: FAIL
	test VIDIOC_DV_TIMINGS_CAP: OK
		fail: v4l2-test-io-config.cpp(571): ret != EINVAL
		fail: v4l2-test-io-config.cpp(625): EDID check failed for input 0.
	test VIDIOC_G/S_EDID: FAIL

Control ioctls (Input 0):
	test VIDIOC_QUERY_EXT_CTRL/QUERYMENU: OK
	test VIDIOC_QUERYCTRL: OK
	test VIDIOC_G/S_CTRL: OK
	test VIDIOC_G/S/TRY_EXT_CTRLS: OK
	test VIDIOC_(UN)SUBSCRIBE_EVENT/DQEVENT: OK
	test VIDIOC_G/S_JPEGCOMP: OK (Not Supported)
	Standard Controls: 3 Private Controls: 2

Format ioctls (Input 0):
	test VIDIOC_ENUM_FMT/FRAMESIZES/FRAMEINTERVALS: OK
	test VIDIOC_G/S_PARM: OK
	test VIDIOC_G_FBUF: OK (Not Supported)
		fail: v4l2-test-formats.cpp(374): ycbcr_enc >= 0xff
		fail: v4l2-test-formats.cpp(491): testColorspace(!node->is_io_mc, pix_mp.pixelformat, pix_mp.colorspace, pix_mp.ycbcr_enc, pix_mp.quantization)
	test VIDIOC_G_FMT: FAIL
		fail: v4l2-test-formats.cpp(744): Video Capture Multiplanar: TRY_FMT(G_FMT) != G_FMT
		warn: v4l2-test-formats.cpp(794): TRY_FMT cannot handle an invalid pixelformat.
		warn: v4l2-test-formats.cpp(795): This may or may not be a problem. For more information see:
		warn: v4l2-test-formats.cpp(796): http://www.mail-archive.com/linux-media@vger.kernel.org/msg56550.html
	test VIDIOC_TRY_FMT: FAIL
		warn: v4l2-test-formats.cpp(1157): S_FMT cannot handle an invalid pixelformat.
		warn: v4l2-test-formats.cpp(1158): This may or may not be a problem. For more information see:
		warn: v4l2-test-formats.cpp(1159): http://www.mail-archive.com/linux-media@vger.kernel.org/msg56550.html
		fail: v4l2-test-formats.cpp(1185): Video Capture Multiplanar: S_FMT(G_FMT) != G_FMT
	test VIDIOC_S_FMT: FAIL
	test VIDIOC_G_SLICED_VBI_CAP: OK (Not Supported)
	test Cropping: OK (Not Supported)
	test Composing: OK (Not Supported)
	test Scaling: OK (Not Supported)

Codec ioctls (Input 0):
	test VIDIOC_(TRY_)ENCODER_CMD: OK (Not Supported)
	test VIDIOC_G_ENC_INDEX: OK (Not Supported)
	test VIDIOC_(TRY_)DECODER_CMD: OK (Not Supported)

Buffer ioctls (Input 0):
		fail: v4l2-test-buffers.cpp(517): node->g_dv_timings(timings)
		fail: v4l2-test-buffers.cpp(642): testCanSetSameTimings(node)
	test VIDIOC_REQBUFS/CREATE_BUFS/QUERYBUF: FAIL
	test CREATE_BUFS maximum buffers: OK
	test VIDIOC_EXPBUF: OK
	test Requests: OK (Not Supported)

Total for rk_hdmirx device /dev/video0: 46, Succeeded: 37, Failed: 9, Warnings: 6

I just need ffpmeg to output a 1080p 60fps stream and thats it.

@ramiropolla
Copy link

Anyone figure out using ffmpeg with hdmirx?

Yes. Hdmi input in ffmpeg works out of the box now, but you need to get the latest revision of ffmpeg from git and build it yourself.

You also need to use a relatively recent ubuntu build (from June or July IIRC).

@logand99
Copy link

I am on the most recent ubuntu release and the most recent ffmpeg release. Now it doesnt even recognize /dev/video0 as a cap device:

ffmpeg -version
ffmpeg version 7.0.2 Copyright (c) 2000-2024 the FFmpeg developers
built with gcc 13 (Ubuntu 13.2.0-23ubuntu4)
configuration: 
libavutil      59.  8.100 / 59.  8.100
libavcodec     61.  3.100 / 61.  3.100
libavformat    61.  1.100 / 61.  1.100
libavdevice    61.  1.100 / 61.  1.100
libavfilter    10.  1.100 / 10.  1.100
libswscale      8.  1.100 /  8.  1.100
libswresample   5.  1.100 /  5.  1.100

If I try to start a capture I get:

ffmpeg -f v4l2 -i /dev/video0 -c:v h264_rkmpp_encoder -b:v 600k -g 30 -f rtsp rtsp://localhost:8554/cam
[sudo] password for logan: 
ffmpeg version 7.0.2 Copyright (c) 2000-2024 the FFmpeg developers
  built with gcc 13 (Ubuntu 13.2.0-23ubuntu4)
  configuration: 
  libavutil      59.  8.100 / 59.  8.100
  libavcodec     61.  3.100 / 61.  3.100
  libavformat    61.  1.100 / 61.  1.100
  libavdevice    61.  1.100 / 61.  1.100
  libavfilter    10.  1.100 / 10.  1.100
  libswscale      8.  1.100 /  8.  1.100
  libswresample   5.  1.100 /  5.  1.100
[video4linux2,v4l2 @ 0xaaab2269a9b0] Not a video capture device.
[in#0 @ 0xaaab2269a730] Error opening input: No such device
Error opening input file /dev/video0.
Error opening input files: No such device

@ramiropolla
Copy link

I am on the most recent ubuntu release and the most recent ffmpeg release. Now it doesnt even recognize /dev/video0 as a cap device:

Did you enable hdmirx in the device tree overlay?

#758 (comment)

@ramiropolla
Copy link

ffmpeg -f v4l2 -i /dev/video0 -c:v h264_rkmpp_encoder -b:v 600k -g 30 -f rtsp rtsp://localhost:8554/cam

Oh, and the h264 rkmpp encoder still doesn't work :P. I was talking only about hdmi input through v4l2, which now works.

[sudo] password for logan:
ffmpeg version 7.0.2 Copyright (c) 2000-2024 the FFmpeg developers

7.0.2 isn't enough. You have to get the latest from git. But still, it doesn't solve the issue that the rkmpp encoders don't work.

@logand99
Copy link

I am on the most recent ubuntu release and the most recent ffmpeg release. Now it doesnt even recognize /dev/video0 as a cap device:

Did you enable hdmirx in the device tree overlay?

#758 (comment)

Yeah I did enable it

ffmpeg -f v4l2 -i /dev/video0 -c:v h264_rkmpp_encoder -b:v 600k -g 30 -f rtsp rtsp://localhost:8554/cam

Oh, and the h264 rkmpp encoder still doesn't work :P. I was talking only about hdmi input through v4l2, which now works.

[sudo] password for logan:
ffmpeg version 7.0.2 Copyright (c) 2000-2024 the FFmpeg developers

7.0.2 isn't enough. You have to get the latest from git. But still, it doesn't solve the issue that the rkmpp encoders don't work.

Updated to most recent and it seems to not be detecting input. Not sure I need to continue to troubleshoot on this thread though.

@RkhanTUM
Copy link

Hello all, just an update or not.
I installed ubuntu_jammy_gnome from orange pi website updated it and upgraded the os install v4ls(i think already installed ) and installed gstreamer.
Ran test_hdmi in was running with lag as usual.
Also installed V4L2 Test Bench and ran sometimes it shows my Laptop screen and sometimes not.
When it shows my laptop screen it lags but after 15-20 seconds it stops..Then disabled OpenGl Rendering the lag decreases but same thing happens as it stucks after 15 - 20 seconds.

So is it the usual thing or this is something new. (I am a noob here).

@neofeo
Copy link

neofeo commented Sep 29, 2024

1080p60 with full color, nto even YUV used. The patch is being pushed to rk linuxvideo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests