I used the steps below to install MythTV v35 and configure MythTV and the system to use a Magewell Pro Capture HDMI (model 11040) card. An ASUS Prime B760M-A AX microATX motherboard was used with an Intel Core i3-12100 processor. The steps below can be used to record and watch live TV using MythTV. The MythTV wiki has guidance for installing the additional software needed for guide data and to automatically change the channel depending on the EPG source and cable box or other source device being used.
Search for Magewell Pro Capture Cards on Amazon
ASUS Prime B760M-A AX microATX Motherboard on Amazon
Install Ubuntu
- After inserting the Magewell card in the PCI slot, Install Ubuntu using the default apps (essentials) option. Installing the latest LTS desktop version is recommended. The latest Ubuntu LTS version as of the date of this blog post is 24.04. The installation iso file for installing Ubuntu Desktop LTS can be found at https://ubuntu.com. If you are unfamiliar with installing Ubuntu, an official tutorial is available at https://ubuntu.com/tutorials/install-ubuntu-desktop.
- Boot into Ubuntu, activating Ubuntu Pro as part of the installation finalization options presented is recommended, and start Software Updater.
- Install all available updates.
- Reboot, check for and apply updates again, and repeat checking for updates until Software Updater indicates there are no more updates.
Install Magewell Card Driver
- At this point, the light on the back of the Magewell card should be blinking blue. Download the latest Magewell driver from https://www.magewell.com/downloads/pro-capture#/driver/linux-x86.
- Extract the tar.gz file.
- Create a folder named src in your home folder, and create a folder named Magewell in the src folder.
- Copy the extracted ProCaptureForLinux folder into the Magewell folder. The driver may need to be reinstalled in the future after updating Ubuntu depending on the type of update, so do not delete the driver files.
- Open the Terminal app to install build-essential and install the driver:
sudo apt install build-essential
cd src/Magewell/ProCaptureForLinux*sudo ./install.sh
- A message should appear indicating the driver was successfully installed. Connect the cable box or other source device to the Magewell card, and power the source device on.
- The light on the back of the Magewell card should now be solid blue and not blinking. From this point onwards, regularly check that the blue light is solid blue and not blinking. Reinstall the driver if needed.
- Open the Terminal app to install FFmpeg and set two variables:
sudo apt install ffmpeg
export VIDEO=/dev/video0
export AUDIO=sysdefault:CARD=HDMI
- The variables set using the export command do not survive a reboot, so these need to be set again if the system is rebooted. These variables are just for testing. These variables do not need to be set after testing. Open the Terminal app, and use FFmpeg to make a test recording:
ffmpeg -ac 2 -f alsa -i $AUDIO -c:a copy -f wav - | ffmpeg -f wav -i pipe:0 -f v4l2 -i $VIDEO -c:v libx264 -map 0:a -map 1:v cap.ts
- The above should all be on one line. The command above should create a cap.ts file in the home folder assuming the home folder is the current working directory. Open the Terminal app to install VLC:
sudo apt install vlc
- Open the cap.ts file with VLC. The video file should play in VLC with audio assuming the source device is not using HDCP and provided video with audio.
- Rebooting is recommended.
Install Magewell2TS
- Download the Magewell SDK from https://www.magewell.com/sdk.
- Extract the tar.gz file.
- Copy the extracted Magewell_Capture_SDK_Linux folder into the Magewell folder created earlier.
- Open the Terminal app to install Git and download Magewell2TS into the Magewell_Capture_SDK_Linux folder (reference: https://github.com/jpoet/Magewell2TS by jpoet):
sudo apt install git
cd src/Magewell/Magewell_Capture_SDK_Linux*
git clone https://github.com/jpoet/Magewell2TS.git
- Open the Terminal app to install some additional packages and to compile and install Magewell2TS:
sudo apt install libv4l-dev cmake libudev-dev libvpl-dev
sudo apt install intel-media-va-driver-non-free
sudo apt install libavfilter-dev libavdevice-dev
sudo apt install libasound2-dev
sudo apt install pkg-config
cd src/Magewell/Magewell_Capture_SDK_Linux*/Magewell2TS
mkdir build
cd build
cmake ..
make
sudo make install
sudo apt install libmfx1
sudo apt install intel-opencl-icd
- Open the Terminal app and modify permissions as indicated at https://www.intel.com/content/www/us/en/developer/articles/guide/onevpl-installation-guide.html and install libmfx-gen1.2:
sudo gpasswd -a ${USER} render
newgrp render
sudo apt install libmfx-gen1.2
- Rebooting is recommended.
- Check for a solid blue light.
- Open the Terminal app to test Magewell2TS:
magewell2ts -i 1 -m -c hevc_qsv | ffmpeg -i pipe:0 cap.ts
- The above command should generate a video file with audio that is playable using a default installation of VLC. The CPU usage will be higher than the implementation with MythTV as described below.
Install MythTV
- Install Mythbuntu Control Panel (MCP) by following the instructions at https://www.mythtv.org/wiki/Mythbuntu_Control_Panel.
- Start MCP, click Repositories, select the option to activate the MythTV updates repository, select MythTV version 35, and click Apply.
- Close MCP, start Software Updater, and install any updates found.
- Start MCP, click the System Roles tab, select Primary Backend and Desktop Frontend, and click Apply. Select the XMLTV option if Schedules Direct will be used for the guide data.
- Select the Setup tab, select and apply the option to add the current user to the mythtv group.
- Rebooting is required here.
Configure MythTV and the System
- Open the Terminal app, and add the mythtv user to the render group:
sudo usermod -a mythtv -G render
- Open the Text Editor app to add and save the following as magewell.conf in your home folder:
[VARIABLES]
INPUT=1
DEVICE=box1
CODEC=hevc_qsv
[RECORDER]
command="/usr/local/bin/magewell2ts -i %INPUT% -m -c %CODEC%"
desc="%DEVICE%-%INPUT%"
[TUNER]
channels=/home/mythtv/ext-channels.conf
timeout=30000
- This step is required, but channels are irrelevant at this point because there is not yet a channel changing script. Without this script, the channel/content currently being shown by the source device is what will be recorded. This step is required because it will not be possible to set a manual recording in MythTV with no channel. Save a text file named ext-channels.conf in your home folder with at least two channels:
[12]
NAME=CBS
CALLSIGN=CBS
XMLTVID=tmp12
[25]
NAME=ABC
CALLSIGN=ABC
XMLTVID=tmp25
- Open the Terminal app to copy the conf files to the /home/mythtv folder:
cp ./magewell.conf /tmp/magewell.conf
cp ./ext-channels.conf /tmp/ext-channels.conf
sudo su mythtv
cp /tmp/magewell.conf /home/mythtv/magewell.conf
cp /tmp/ext-channels.conf /home/mythtv/ext-channels.conf
exit
- Start MCP, click the Setup tab, and apply the option to link config.xml.
- Click the backend setup button to open the web app in a browser.
- In the following steps, click save after editing each section.
- General Tab:
- Verify the security pin is set to 0000.
- Set the IPv4 primary IP address to the static address used by the backend computer being configured.
- Capture Cards Tab:
- Click the button for a new capture card, and then select External Recorder.
- Click External, and enter the command for the command path as:
/usr/bin/mythexternrecorder --conf /home/mythtv/magewell.conf
- Video Sources Tab:
- Click the button for a new video source.
- Click New, enter NG for the name, set the listing grabber to no grabber, verify the CF table is set to default, and verify the the network ID is set to -1. This step will be different for Schedules Direct users.
- Input Connections Tab:
- Set the input name to MPEG2TS, display name to Magewell, and the video source to NG. This step will be different for Schedules Direct users.
- Click the option to scan for channels.
- Select the option to import from External Recorder and click Start Scan. A message should appear indicating the two channels were found.
- Select a starting channel.
- Storage Groups Tab:
- Set the default to /var/lib/mythtv/recordings.
- Set live TV to /var/lib/mythtv/livetv.
- Click Restart Backend Full Operation.
- If networking is needed with other MythTV frontends accessing the backend, use MCP to enable networking.
- Rebooting is recommended.
- Configure the frontend:
- In Setup, select Setup Wizard.
- In the wizard, choose an audio device, and select Test Speakers. Change the audio device and test again until the test sound can be heard.
- Also in the wizard, choose VAAPI Normal for the video playback profile.
It should now be possible to watch live TV, make recordings, and watch recordings using MythTV. If you see a way to improve the steps above, please post a comment.