jwittkoski / prime_encoder

A SageTV network encoder
0 stars 2 forks source link

prime_encoder

prime_encoder is network encoder for SageTV

prime_encoder has been my primary method of recording shows for about five years and it has been very reliable.

Background

When the Silicon Dust HDHomerun Prime was released using a Cable Card with SageTV suddenly seemed like a possibility since some cable providers have channels marked as "copy freely". However, there was no direct suport in SageTV for the Prime and no Linux drivers for it (as it is a network attached device).

The Silicon Dust hdhomerun_config setup script allowed you to stream content from the Prime directly (other tools like ffmpeg can do this as well) so I just needed a way to get SageTV to tune the Prime and start steaming. Luckily, SageTV supports the concept of "network encoders" - other devices on the local network that act as tuner/recorders that SageTV can direct.

I created prime_encoder to do this middle-man task.

Originally I was using prime_encoder for recording from an HDHomerun Prime device, but it has been refactored to be more generic so that any command that generates video can be used.

The full set of network encoding commands is not supported. Primarily this means you can't "preview" channels from the Setup Video Sources screen.

Install

Notes

prime_encoder script doesn't have to run on the same host as the master SageTV server. You only need to have it running somewhere on your network and have the recording directories set up correctly using SMB or another sharing protocol.

I run the script on the same host as the SageTV server because the overhead of running it is fairly small and doesn't seem to impact SageTV performance. This has the added advantage of not having to deal with network shares or mapping the recording paths across hosts.

When it starts, the SageTV server will automatically discover network encoders. It sends commands to the network encoders to record video and tells the encoders where to store the video file. The only config option that needs to be changed on the SageTV server is to enable network encoder discovery.

Running at startup

prime_encoder needs to start before the main SageTV process starts.

The easiest way to do this is to use the basic example Ubuntu script (prime_encoder.init).

Alternatively, you can add this to the bottom of /opt/sagetv/server/sagesettings, and the encoder will start when the SageTV process starts:

    if [[ ! $(ps aux |grep "[p]rime_encoder: Master") ]]; then /opt/sagetv/hdhomerun/prime_encoder; fi

Assumptions

These directions assume a few things:

Installation