Connecting to the server

There main program that can be used to connect to repository server is CCExtractor. You'll need to use the following options to specify input stream, server address and and some stream information:

  1. Input options:
    • - or -stdin to read video stream from standard input
    • -s or --stream to read a file that continuously growing
    • -udp port to read video stream from UDP port
  2. Server connection:
    • -sendto host:port server address and port
    • -tcpdesc description description of what you are sending (e.g. tv station name or file name). If it isn't set, then repository will show your IP as description
    • -tcppassword password the password to use when connecting to repository server

For example,

 tail -f stream.ts | ccextractor -stdin -sendto -tcpdesc "ABC"

will tell CCExtractor to read from standard input and to send captions to at 3030 port with “ABC” description. Instead tail -f stream.ts, of course, can be any program that output video stream to standard output (stdout).

This chapter will describe how to use hdhomerun_config tool to send captions to the repository. Make sure that you have it installed and working.

  1. First, you'll need to pick a device ID by calling
    $ hdhomerun_config discover
    hdhomerun device 131F1846 found at

    So, the device we are going to use has 131F1846 id.

  2. Use the following command to scan for channels
    $ hdhomerun_config 131F1846 scan /tuner0 scan.log
  3. The output will be send to scan.log file, so you can grep it to find IDs of desired channel and program. Suppose, we you to send captions from “CNN” channel and you found the following lines in scan.log:
    SCANNING: 141000000 (us-irc:17, us-cable:17)
    LOCK: qam256 (ss=100 snq=100 seq=100)
    TSID: 0x0000
    PROGRAM 2101: 24 CSPAN (encrypted)
    PROGRAM 2102: 109 CSPN2 (encrypted)
    PROGRAM 2103: 51 APLw (encrypted)
    PROGRAM 2104: 72 TRVL WEST (encrypted)
    PROGRAM 2105: 483 TV One (encrypted)
    PROGRAM 2106: 216 NICK2 (encrypted)
    PROGRAM 2107: 56 CNN (encrypted)
    PROGRAM 2108: 80 GOLF (encrypted)
    PROGRAM 2109: 11 HSN (encrypted)
    PROGRAM 2110: 23 QVC (encrypted)
    PROGRAM 2111: 36 FX-W (encrypted)
    PROGRAM 2112: 57 HN (encrypted)
    PROGRAM 2113: 122 DISXD (encrypted)
    PROGRAM 2114: 46 LIF-W (encrypted)

    The number 17 (after us-cable:) is the channel ID and the program id of “CNN” is 2107

  4. Now you should tune tuner to this channel and filter CNN program:
    $ hdhomerun_config 131F1846 set /tuner0/channel 17
    $ hdhomerun_config 131F1846 set /tuner0/program 2107
  5. Finally, call the following command to send caption to the repository server:
    $ hdhomerun_config 131F1846 save /tuner0 - | ccextractor -stdin -quiet -sendto -tcpdesc CNN

    The first clause of this command shall send video stream to standard output and the second shall read it and send captions to server with CNN description. -quiet option suppress CCExtractor output as it's sometimes messy, so all you'll see is dots printed every second by hdhomerun_config tool

This chapter describes how to send captions from ATSC transmission. Make sure that you have azap, dvbstream installed and working. More on these tools you can find at Linux TV

Suppose the tuner is /dev/dvb/adapter3/dvr0, so its adapter number is 3 and scan file is located at ~/.azap/cahnnels.conf.

  1. Suppose you want to send captions from KOCE channel, and you found the following line in scan file:

    It means that this channel is on 129000000 frequency and its program number in the stream is 2 (the last number in the line)

  2. First, you should tune the tuner to this frequency by calling
    azap -a 3 -r KOCE

    There 3 is adapter number and KOCE is one of the channels on this freq.

  3. The you should get a video stream from this channel and send to CCExtractor
    dvbstream -f 129000000 -c 3 -o 8192 | ccextractor -stdin -pn 2 -quiet -sendto -tcpdesc KOCE

    The first clause will send video stream from 129000000 freq. from adapter #3 to the standart output without filtering (-o 8192 option). Then CCExtractor will filter program #2 (-pn 2 option) and send to server.

Note that in the guide above we didn't filter program using dvbstream, although it is possible. The reason for this is to show basic idea of scripts in test/streaming directory. These scripts allow you get multiple video streams from a single tuner and send them to the server. To do so, you have to:

  1. Call script. It doesn't accept any arguments, so make sure that you set correct adapter, path to scan file variables inside it. This script will:
    1. prompt frequency value to tune to and save this value in freq file
    2. call azap to tune this frequency
    3. output whole stream to stream.ts file in your working directory
    4. stream.ts file will be truncated every 3 hours, so it won't grow too big
  2. Then, from another shell you can call script to send captions to the server. Also make sure that you edited variables in the beginning of file and set server address and scan file. This script will
    1. prompt channel name to send to repository server
    2. and output new content from stream.ts file to ccextractor
  3. To test if channel has some closed captions before connecting it to the server, you can call It works the same way, but output captions to standard output.
  • public/gsoc/repository_clients.txt
  • Last modified: 2016/08/02 20:08
  • (external edit)