Skip to content

Notes for Puffer staff

Francis Y. Yan edited this page Sep 18, 2024 · 8 revisions

Start Puffer for the first time

  1. Log into the machine tv-nuc, and run

    cd ~/puffer/src/scripts
    
    screen -S puffer2
    ./run_udp_to_tcp.py kron nbc fox
    <detach from session>
    
    screen -S puffer3
    ./run_udp_to_tcp.py kpyx abc
    <detach from session>
    
    screen -S puffer4
    ./run_udp_to_tcp.py cbs pbs
    <detach from session>
    

    Channels can be distributed across encoding machines differently as needed.

  2. Log into the machine puffer, run

    rm -rf /dev/shm/media  # must remove old files first if there are any
    cd ~/puffer/src/forwarder
    
    screen -S file-receiver2
    ./file_receiver 61002 /dev/shm/media/tmp/
    <detach from session>
    
    screen -S file-receiver3
    ./file_receiver 61003 /dev/shm/media/tmp/
    <detach from session>
    
    screen -S file-receiver4
    ./file_receiver 61004 /dev/shm/media/tmp/
    <detach from session>
    
  3. Log into each of the machines puffer2, puffer3, and puffer4, and run

    cd ~/puffer/src/wrappers
    screen -S pipeline
    rm -rf /dev/shm/media  # must clean up old media files if there are
    ./run_pipeline ../settings.yml
    <detach from session>
    

    Each machine must have the correct settings.yml. E.g., to encode abc, nbc, and fox on puffer2:

    channels:
      - abc
      - nbc
      - fox
    media_dir: /dev/shm/media
    remote_media_server:
      host: 171.64.65.88
      port: 61002
      media_dir: /dev/shm/media
    enable_logging: true
    influxdb_connection:
      host: 171.64.65.88
      port: 8086
      dbname: puffer
      user: puffer
      password: INFLUXDB_PASSWORD
    channel_configs:
      nbc:
        live: true
        video:
          1920x1080: [22, 24]
          1280x720: [20, 22, 24, 26]
          854x480: [24, 26]
          640x360: [24]
          426x240: [26]
        audio:
          - 128k
          - 64k
          - 32k
        present_delay_chunk: 300
        decoder_args: 0x31 0x34 1080i30 60 900 10248 --tcp 171.64.90.125:60002
      fox:
        live: true
        video:
          1280x720: [20, 22, 24, 26]
          854x480: [22, 24, 26]
          640x360: [24, 26]
          426x240: [26]
        audio:
          - 128k
          - 64k
          - 32k
        present_delay_chunk: 300
        decoder_args: 0x31 0x34 720p60 120 900 10248 --tcp 171.64.90.125:60003
      ion:
        live: true
        video:
          1280x720: [20, 22, 24, 26]
          854x480: [22, 24, 26]
          640x360: [24, 26]
          426x240: [26]
        audio:
          - 128k
          - 64k
          - 32k
        present_delay_chunk: 300
        decoder_args: 0x31 0x34 720p60 120 900 10248 --tcp 171.64.90.125:60004
      abc:
        live: true
        video:
          1280x720: [20, 22, 24, 26]
          854x480: [22, 24, 26]
          640x360: [24, 26]
          426x240: [26]
        audio:
          - 128k
          - 64k
          - 32k
        present_delay_chunk: 300
        decoder_args: 0x31 0x34 720p60 120 900 10248 --tcp 171.64.90.125:60008
      cbs:
        live: true
        video:
          1920x1080: [22, 24]
          1280x720: [20, 22, 24, 26]
          854x480: [24, 26]
          640x360: [24]
          426x240: [26]
        audio:
          - 128k
          - 64k
          - 32k
        present_delay_chunk: 300
        decoder_args: 0x31 0x34 1080i30 60 900 10248 --tcp 171.64.90.125:60006
      pbs:
        live: true
        video:
          1920x1080: [22, 24]
          1280x720: [20, 22, 24, 26]
          854x480: [24, 26]
          640x360: [24]
          426x240: [26]
        audio:
          - 128k
          - 64k
          - 32k
        present_delay_chunk: 300
        decoder_args: 0x31 0x34 1080i30 60 900 10248 --tcp 171.64.90.125:60007
      cw:
        live: true
        video:
          1920x1080: [22, 24]
          1280x720: [20, 22, 24, 26]
          854x480: [24, 26]
          640x360: [24]
          426x240: [26]
        audio:
          - 128k
          - 64k
          - 32k
        present_delay_chunk: 300
        decoder_args: 0x31 0x34 1080i30 60 900 10248 --tcp 171.64.90.125:60005
    

    Only the channels section needs to be adapted for puffer3 and puffer4. Note that the remote_media_server must match the file_receiver to be run on puffer.

  4. Log into the machine puffer, and run

    screen -S media-server
    cd ~/puffer/src/media-server
    ./run_servers.py ../settings.yml
    <detach from session>
    

Restart Puffer

  1. Log into machine tv-nuc, stop and restart all run_udp_to_tcp.py.
  2. Log into machine puffer
    1. Remove the folder /dev/shm/media
    2. Restart file_receiver2, file_receiver3, and file_receiver4
  3. Log into each of the machines puffer2, puffer3, and puffer4, and run
    1. Remove the folder /dev/shm/media
    2. Restart run_pipeline
  4. Log into machine puffer again
    1. Verify that all channels have their own folders in /dev/shm/media
    2. Restart run_servers_and_cl.py
    3. Wait and check if channels are resumed on the website

Collect additional video files

  1. Log into machine tv-nuc and run each of the command below for sufficiently long

    nc -u -l 10.0.0.1 50001 > kgo-abc.ts
    nc -u -l 10.0.0.1 50002 > kntv-nbc.ts
    nc -u -l 10.0.0.1 50003 > ktvu-fox.ts
    nc -u -l 10.0.0.1 50004 > kron-cw.ts
    nc -u -l 10.0.0.1 50005 > kpyx-cw.ts
    nc -u -l 10.0.0.1 50006 > kpix-cbs.ts
    nc -u -l 10.0.0.1 50007 > kqed-pbs.ts
    nc -u -l 10.0.0.1 50008 > kdtv-univision.ts
    
  2. Use FFmpeg to trim the video to a desired length, e.g.,

    ffmpeg -i nbc.ts -ss 00:00:10 -t 600 -c copy -streamid 0:0x31 -streamid 1:0x34 nbc-10m.ts
    
  3. Run nc -l -p 60002 < ~/Videos/ts-clips/nbc-10m.ts in one terminal, and replace --tcp 171.64.90.125:60002 in the settings.yml with --tcp 127.0.0.1:60002.

  4. In another terminal,

    cd ~/puffer/src/wrappers
    ./run_pipeline ../settings.yml
    

    which encodes the .ts file into Puffer-compatible files in media_dir (as specified in the settings.yml).

Troubleshooting

  • If system performance metrics such as CPU load are missing on Grafana for a server, then log into that machine and run sudo systemctl restart collectd.
Clone this wiki locally