diff options
author | Jarle Bjørgeengen <jarle@bjorgeengen.net> | 2010-03-05 15:53:37 +0000 |
---|---|---|
committer | Jarle Bjørgeengen <jarle@bjorgeengen.net> | 2010-03-05 15:53:37 +0000 |
commit | 6a9ae3e86ddd3d4e4f0a5f6724d2df914badb43e (patch) | |
tree | 49c46f23d761bc6a298d60dd2a4e4fb04abc9ede | |
parent | de4190a1b6d4cd283c9b6e6749d5f36dacdab36e (diff) |
* The problem with looping fk-program.ogv was that icecast rejects new stream with identical metadata for the same client. To avoid we let ezstream encode directly from jpg into ezstream, hence keeping a continous stream until
next program. Reencoding of theorafiles was too resource consuming and jerky. Since re-encode must be used for generating pause screen, and ezstream either re-encode all using external program or dont rencoed anthing, we use
cat $ogvfile -o - to serve the file to ezstream without consuming too much resources.
-rwxr-xr-x | frikanalen/bin/scheduler | 50 |
1 files changed, 26 insertions, 24 deletions
diff --git a/frikanalen/bin/scheduler b/frikanalen/bin/scheduler index 2df090a..9bb6064 100755 --- a/frikanalen/bin/scheduler +++ b/frikanalen/bin/scheduler @@ -103,7 +103,7 @@ sub plwrite { } sleep 5; open PL, ">$ezplaylist" or die "Cannot open $ezplaylist for write :$!"; - print PL "fk-program.ogv\n"; + print PL "fk-program.jpg\n"; close PL; if ( $ezpid ) { kill SIGHUP => $ezpid; # Rearead playlist with pause screen, so that next loop @@ -120,17 +120,22 @@ sub ezstream_start { <url>$url</url> <sourcepassword>secret</sourcepassword> <format>THEORA</format> - <stream_once>0</stream_once> - <filename>$ezplaylist</filename> - <svrinfoname>Frikanalen</svrinfoname> - <svrinfourl>http://www.frikanalen.no</svrinfourl> - <svrinfogenre></svrinfogenre> - <svrinfodescription></svrinfodescription> - <svrinfobitrate>200</svrinfobitrate> - <svrinfochannels>2</svrinfochannels> - <svrinfosamplerate>44100</svrinfosamplerate> - <svrinfopublic>0</svrinfopublic> - </ezstream> + <filename>frikanalen.m3u</filename> + <svrinfoname></svrinfoname> + <reencode> + <enable>1</enable> + <encdec> + <format>THEORA</format> + <match>.jpg</match> + <decode>ffmpeg -loop_input -i \"\@T\@\" -b 1800 -f ogg -s 720x432 -</decode> + </encdec> + <encdec> + <format>THEORA</format> + <match>.ogv</match> + <decode>cat \"\@T\@\"</decode> + </encdec> + </reencode> +</ezstream> EOF close $ezcfg; defined($ezpid = fork()) or die "unable to fork: $!\n"; @@ -550,24 +555,21 @@ sub generate_program { print $jpg $im->jpeg; my $tmpjpg = $jpg->filename(); close($jpg); - my $tpausevid; + my @ffmpegcmd; my $pausevid; if ( $opts{'s'} ) { - $tpausevid = "program.ogv"; - $pausevid = "fk-program.ogv"; + $pausevid = "./fk-program.jpg"; + `mv $tmpjpg $pausevid`; } else { - $tpausevid = "ptest.mpeg"; - $pausevid = "test.mpeg" + $pausevid = "test.mpeg"; + @ffmpegcmd = ("ffmpeg", "-loop_input", "-t", "5", "-i", $tmpjpg, "-b", "1800", + "-r", "25", "-s", "${palwidth}x${palheight}", "-f", "ogg", + $pausevid); + system(@ffmpegcmd); + unlink ($tmpjpg); } # Png input is broken in ffmpeg . Jpg works. - unlink($tpausevid); - my @ffmpegcmd = ("ffmpeg", "-loop_input", "-t", "5", "-i", $tmpjpg, "-b", "1800", - "-r", "25", "-s", "${palwidth}x${palheight}", "-f", "ogg", - $tpausevid); print join(" ", @ffmpegcmd, "\n"); - system(@ffmpegcmd); - unlink ($jpg); - system("mv $tpausevid $pausevid"); return $pausevid; } else { print "Unable to save temporary image file\n"; |