Capture a game (Switch) on Ubuntu

I thought it’s not enough to bother to make an article, but I posted because it was too cumbersome when I search it.
I think If you’re a gamer who want to capture gaming display, you must have Windows PC and use it to capturing.
In my case,I use Windows10 reluctantly for only PC games, so I want to do something as much as possible on Linux,
but it would be a rare case.

Hardware: Capture Board

This is the capture board I used.

image of capture board

TreasLin hdmi キャプチャーボード Switch、Xbox、Wii U、PS4、PS3 ゲーム 実況ゲーム録画機器、OBS/Potpalyerライブ配信用 1080P Windows7/8/10、Macbook Youtube/Twitch/NICONICO/jstarkan/Twitcasting/Facebook Live 1080PフルHD対応 HSV322

Because the deciding factor was relatively cheap and mentioned Linux support.
If possible I wanted to PCIE card type to simplify wiring, but this time I refused because there was no free space in the PCIE slot and I was not sure that It can be used in Linux.

This product is a standard called UVC what is originally a general-purpose standard for web cameras. And Linux supports this.

Software: FFmpeg

It was hard to find it when i searched for captureing game, but when I looked it up from arecording webcam, I found it easily.

Install

$ sudo apt install ffmpeg

Capturing

ffmpeg -f alsa -i default -f video4linux2 -s 1280x720 -i /dev/video0 -vcodec libx264 Videos/test3.mp4

Stop with Ctrl+C.

For now, I was able to record with sound at a resolution of 1280 x 720 with this command. I thought I needed hardware encoding on the GPU, but it seems to be no probrem to use software encoding of the CPU for this image quality.

Screenshot of splatoon

Future

I’ll try encoding on the GPU in the future.

Reference

Use UVC (USB Video Class) type USB camera on LinuxFfmpegFfmpeg can’t record uvc camera images

Other translations