1

I have a Linux server running and I would like to stream the first four consoles (TTY1,TTY2,TTY3,TTY4) where I have different tails with with my log-files to the network so I can receive the stream in the way I receive a webcam in my network.

The reason is that my NVR (Network Video Recorder) Device can split the screen in 4 and display 4 log-files or even 16 log files in the same time.

The NVR supports the following protocols : N1 and ONVIF

I found different solutions to stream a media file, bit none for streaming the console.

Max Muster
  • 337
  • 2
  • 6
  • 27

2 Answers2

1

Honestly, I think you're working too hard. Try looking at something like tmux which can do the console multiplexing, as well as allowing multiple connections to the console it creates. You can also split the "screens" into multiple consoles, and switch between them.

tmux example

This is something that can easily be re-connected to from as many consoles as you have access to, as well as detaching from the tmux session, without killing any processes.

TheCompWiz
  • 7,409
  • 17
  • 23
1

This will create a video of TTY1 and pipe it to ffplay (you could do something else with it)

#!/bin/bash

(while sleep 1
do
    screendump 1 | anytopnm | pnmtojpeg
done) | ffmpeg -f image2pipe -r 1 -c:v mjpeg -i - -c:v copy -f matroska - | ffplay -

You can also check when LOGFILE changes. Each time that happens it will get the last 25 files, convert them to an image and feed it to ffmpeg, that creates a matroska video file and writes it to stdout, where ffplay picks it up and plays it.

I left all the pipes so that you can decide where to insert the solutions you already had for media files.

#!/bin/bash

LOGFILE=/tmp/filename    

(while inotifywait -q -e modify $LOGFILE >/dev/null; do
    tail -25 $LOGFILE | anytopnm | pnmtojpeg
done) | ffmpeg -f image2pipe -r 1/8 -c:v mjpeg -i - -c:v copy -f matroska - | ffplay -
Eduardo Trápani
  • 1,210
  • 8
  • 12