Here's a "fun" technical problem I'd like to solve.

I have a server that runs headless. I'd like to be able to queue up a video playlist on that server and have it stream to a peertube livestream.

The only live streaming video tool I am familiar with is OBS, but I don't think OBS can do what I want this to do.

Is there a commandline application in to which I can feed a list of video files, and out of which it will produce a live stream?

Many of these terms are overloaded enough that I'm having a hard time searching for this.

Alright, it looks like I can use LibAV/FFMpeg to output the live stream, and use liquidsoap to manage the playlist dynamically.

Here are some instructions on managing a livestream from the command line:

Really, building the playlist would benefit from another support application, but I'll deal with that when I get there.

For now, I'll make a manual playlist and do a proof of concept.

Once I've done that, the next boulder to get over is managing the playlist.

I'd like to be able to manage it somewhat intelligently, having a program make decisions about what to play and when to play it based on metadata, tags, length, and ideally a clock.

(That is to say, starting a film one minute after the hour, running it until it's over, and then filling the intervening time with shorter works until we are at the top of the hour or the half hour for the next film to start. )

I can figure this out by hand at first, and even pad out the video files themselves to meet these constraints, but doing it programmatically would be better.

(I'm enjoying running this radio station, I'm going to start a TV channel.)

Doing a TV station is easier than doing a radio station in that video and films have always been subject to the same copyright laws as everything else, and not the weird bullshit patchwork that audio recordings have had to contend with.

As a result, there are a bunch of easily identifiable, unambiguously public domain films and TV shows (many of which have never been given a home video release! Some of which I have physical copies of, and am actively digitizing.)

A lot of these films aren't very good, but some of them are excellent.

A lot of the TV shows are patchwork, with only a few episodes in the public domain.

That's fine. We'll work around it.

Other folks do it already (See The Film Detective on Sling TV for example.) and I can do a better job than that.

@aschmitz @ajroach42

I vaguely remember that liquidsoap (combined with ffmpeg?) might be able to do this but I've only ever used it myself for audio several years ago...

@djsundog @ajroach42 Yeah. (I mostly say "ffmpeg" in place of avcodec or whatever it's called these days, but I know it's no longer "just" ffmpeg.)

Looks like Peertube is RTMP, and has several RTMP guides. Hardest part if you care about it is likely to be remote control rather than setting up a queue of everything you want in advance.

@aschmitz @djsundog Remote control is unfortunately not an option for what I need.

That sounds like something that ffmpeg could be convinced to do, with the Right Options and possibly a simple wrapper script.

I'm not sure what the protocol is for livestreaming over peertube though, so that might be something that needs something more complex.

If there's just an rtsp endpoint I'm pretty sure ffmpeg should do the trick

@ajroach42 ffmpeg, probably.
I use ffmpeg to take input spewed over the network from OBS, re-encode it, and stream it to another thing, so a delay and a queue probably wouldn't be that involved.

@djsundog That's not super surprising, and my best bet could very well be just using the common tooling.

@ajroach42 if i were in the same position, i would check if videolan could do it. I think it was first created to do this kikd of stuff (video or audio on LAN)
But i never do this before

You can probably do it with webtorrent-cli:

Otherwise, if you have an icecast or similar mountpoint, ezstream can do it:

@ajroach42 Yes. It may be tricky to get codecs/formats other than webm or ogg/theora to work but in theory matroska is supported too. I have no idea how well that interfaces with peertube.

@ajroach42 @thegibson I know this would be a “transcoding” task: converting from your on disk video file format to the broadcast video format used by your live stream server.

I also know that the most common command line application for advanced transcoding tasks is ffmpeg.

A quick search turned up this primer on ffmpeg live stream encoding/transcoding:

@max @thegibson Yep! thanks to some folks in this thread, I found these instructions:

which do this with LibAV/ffmpeg and Liquid soap.

@ajroach42 @thegibson Great! That does look like what you were asking for.

Entire threads don’t always federate on Mastodon, so apologies for the duplicate answer, but I’m glad you found your answer!

@max @thegibson No worries, that's why I mentioned the solution.

FFMPEG only gets me half way there, because it doesn't support dynamic playlists, but paired with liquid soap we're all set.

Sign in to participate in the conversation
R E T R O  S O C I A L

A social network for the 19A0s.