HDMI2USB is a firmware project that can run for Numato Opsis FPGA based open video platform. This firmware enables Opsis to capture or generate HDMI, DVI or DisplayPort (future) video. The captured video can be transferred to host PC through the USB interface available. With HDMI2USB firmware programmed, Opsis shows up on the host PC as a standard webcam, so no additional drivers required on Linux to use the basic functionality. This article will discuss how to program and use HDMI2USB firmware on Numato Opsis FPGA based video platform. HDMI2USB is capable of capturing HDMI streams from 2 sources and routing them to 3 possible locations, USB or the 2 HDMI output ports present on Opsis. Currently though, HDMI2USB doesn’t support DisplayPort capture. It is a work that is still in progress.
To follow this article, you will need:
- Numato Opsis FPGA based video platform
- USB 2.0 B-type cable
- DC power Supply(12V)
- 2x HDMI Cables (exact number depends on your application)
- A separate monitor with HDMI input
- An HDMI Source (Laptop/PC/Raspberry Pi etc)
- Linux (Author used Ubuntu 14.04 running on a virtual machine)
- Good internet connectivity
For this article, we will use a configuration as shown below. HDMI2USB on Opsis can handle more complex configurations but we will use a simple configuration now.
- Connect an HDMI source to HDMI IN 1 of Opsis
- Connect an HDMI cable from HDMI OUT 1 of Opsis to monitor
Here HDMI source refers to devices capable of HDMI output like laptop, desktop, Raspberry Pi, another Opsis etc. And sink refers to devices capable of receiving HDMI signals like monitors, yet another Opsis etc.
In the author’s case, the host PC was connected to a monitor using VGA interface. So, that left a spare HDMI output on the same PC which was connected to HDMI IN 1 on Opsis.
HDMI OUT 1 of Opsis was connected to another monitor. A USB cable was connected from host PC to Opsis. And finally Opsis was powered up using a 12V external power supply.
As soon as Opsis is powered up, the monitor connected to HDMI OUT 1 will start showing a color bar pattern (unless the factory-programmed with HDMI2USB firmware is not altered).
Step 1: Ubuntu 14.04 already ships with appropriate drivers for HDMI2USB on Opsis. But, we do need to set up proper permissions for accessing it without requiring root privileges. Execute the following commands on the prompt:
wget https://github.com/timvideos/HDMI2USB-misoc-firmware/raw/master/scripts/52-hdmi2usb.rules sudo cp 52-hdmi2usb.rules /etc/udev/rules.d/
Step 2: As soon as Opsis is plugged in to the USB port, Linux will detect it and assign assign drivers for it, as shown in dmesg output below. Note that HDMI2USB’s the serial port is assigned to “/dev/ttyACM0” and HDMI2USB UVC device shows up as “/dev/video0” under “/dev” directory.
The exact device names can vary depending on if there are other similar devices already connected on your system.
Step 3: Install any serial terminal program of your choice. We will install PuTTY in our case, but any serial terminal program should work just fine.
sudo apt-get install putty
We can now open the port by clicking the “Open” button.
As we can see in the picture above, input0 is being correctly detected (This input is connected to HDMI source). Since we didn’t connect anything to input1, no input signal is detected as expected. Also, output0 and output1 are enabled and showing “pattern” (This means signal for these outputs are generated from a built in pattern generator ). Encoder is also enabled but no host program is currently streaming video through USB hence 0Mbps data rate shown.
Step 8: Now we can connect input(source) to output(sink) by using the following command:
video_matrix connect <source> <sink>
source can be: input0, input1 or pattern
sink can be: output0, output1 or encoder
The illustration below will make this much clearer:
So, lets connect output0 to input0.
video_matrix connect input0 output0
This command will casue output0 (ie HDMI OUT 1) to display whatever the Opsis board is receiving at input0 (HDMI IN 1). And in our case, signal at input0 (HDMI IN 1) is coming from host PC’s HDMI output. Windows on host PC will detect Opsis as another display and it will automatically set the resolution, by default, to 1280×720. We can clone the existing display or extend the display. In our case, Windows has been set up to extend the display. (Linux VM is running on Windows host)
So, we will now get the extended Windows Desktop on the monitor which was connected to HDMI OUT 1
Step 9: To view the stream through USB interface, we will need to install software such mplayer, vlc etc. Here let us install mplayer by executing the command below.
sudo apt-get install mplayer
Step 10: View the USB video stream using mplayer using following command (make sure to change the device name if needed).
mplayer tv:// -tv driver=v4l2:width=1280:height=720:device="/dev/video0" -vf screenshot -vo xv
We will see the default pattern as below. This is because the encoder is still connected to pattern generator. We will need to connect input0 to the encoder so we can stream the video from input0 through USB.
So, lets try connecting encoder to input0 so that we can view our extended desktop back into our PC.
video_matrix connect input0 encoder
Now we will get a nice live capture of our extended desktop through mplayer (as shown in screenshot below) :
This was just basic introduction on how to use HDMI2USB firmware with Numato Opsis. HDMI2USB is capable of doing much more and the continuous development is expected to bring even more features to the table. This article demonstrates how easy it is to setup and use HDMI2USB firmware with Numato Opsis FPGA based video platform.