Reputation: 19662
I've been looking around for a simple (or perhaps not-so-simple) walkaround for a problem I am having in my set up for a simple test case: video streaming over red5 media server.
I have built a small-ish library of FLV files scraped from YouTube and managed to play them in succession with the following perl script:
use Cwd;
use strict;
use warnings;
use DBI;
use DBD::mysql;
our $db = DBI->connect();
my $dst = "/home/seb/youtube/";
sub streamFile {
my $r = $db->prepare("SELECT name FROM music_flvs ORDER BY RAND() LIMIT 1");
$r->execute();
my @data = $r->fetchrow_array();
my $filename = $data[0]
my $t = `ffmpeg -re -i '${dst}${filename}' -ab 48k -ac 1 -vcodec libx264 -crf 30 -s "640x480" -acodec libfaac -ar 44100 -threads 4 -f flv 'rtmp://server/oflaDemo/music'`;
return 1;
}
while (&streamFile()) {
}
This script does its purpose extremely well: it plays files one by one through ffmpeg
. However, it does so with a crucial problem: it causes an Unpublish event every time it swaps songs, which causes all the clients to disconnect. I would like to prevent this. The event manifests itself in ActionScript as this:
16:33:54:209 - Playback - NetStream.Play.UnpublishNotify
16:33:54:209 - Playback - NetStream.Play.PublishNotify
I have seen the concat
demuxer and believe that it might somewhat help me. The question is pretty simple: what is the best way to make ffmpeg stream a playlist to a RTMP server without ever causing an Unpublish event?
Upvotes: 2
Views: 2025
Reputation: 3860
I don't think there is a simple FFMPEG way to prevent sending those events.
When you say clients, you really mean the Flash Clients that play the stream right?
Well what you might be able to do is to save those videos on red5 and configure a playlist in Red5 instead of streaming them from FFMPEG to Red5. Red5 has a so called Playlist feature that can play videos in a row.
If your clients are custom made you could also just modify the clients to skip over this. I think the most common way people implement an endless playlist is to have a simple ActionScript client side code that automatically skips through different videos. That is way easier then any kind of server side solution.
Upvotes: 1