chocolateboy wrote:I'll post an updated version of those WEB.conf entries (which should work out of the box) after the next release.
As long as you're refactoring everything, a few observations based on my adventures with feeding commandlines (no doubt you've considered all these in some form already, I mention them in the spirit of aspiring to make pmsencoder akin to greasemonkey):
- All-purpose downloader and transcoder protocols for arbitrary commandlines, which shouldn't really require custom scripts, would be nice. The logic of it would be that any commandline that runs ok in the user's terminal can be dropped as-is into WEB.conf with keywords DOWNLOADER_OUT and TRANSCODER_OUT to be filled-in by the script, e.g. ideally
downloader.groovy- Code: Select all
// videostream.Web,foo=foo,downloader://"c:\some where\foo.exe" -o DOWNLOADER_OUT
script {
profile ('downloader') {
pattern {
protocol 'downloader'
}
action {
// all parsing/splitting/quote-matching/escaping handled internally by pmsencoder
$DOWNLOADER = $URI.split('://')[1].replace('DOWNLOADER_OUT', $DOWNLOADER_OUT)
}
}
}
and similarly for transcoder.groovy. In this scenario the "live news" rtmpdump commands would look like- Code: Select all
videostream.Web,Live News=Aljazeera English,downloader:///usr/bin/rtmpdump -o DOWNLOADER_OUT -v -r etc...
and x11grab would simply be- Code: Select all
videostream.Web,Screen=Screen,transcoder:///usr/bin/ffmpeg -f x11grab -r 30 -s 1920x1080 -i :0.0 TRANSCODER_OUT etc...
allowing -s, -r, etc to be set right in WEB.conf without too much fuss. Also anyone could then write a script in their preferred language as long as the output filename is passed on the commandline, e.g 'downloader://mydownloader.bat DOWNLOADER_OUT'. - On the subject of running commandlines as-is I ran across org.apache.tools.ant.types.Commandline, which is small and provides reasonably robust parsing, quote-matching etc. It allows spaces in quoted blocks, strips outer quotes when splitting into lists, basically covers all the usual commandline tricks as one would expect. It would have to be extended for url processing, though (or maybe there's a better maven corollary?).
- Automatic support for arbitrary protocols would be nice, too. If a script declares "pattern { protocol 'foo' }" then it can be taken for granted that the action block attempts to handle it.
- I don't know if it's possible in groovypp, but @Grab() syntax for importing faraway external libs would really allow anything to be done inside a script without having to go upstream and patch pmsencoder itself. I tried all flavors of grape.Grab which work fine in groovy but not in pmsencoder. I defer to your expertise, maybe this can't be done due to groovypp's static nature, documentation seems to be non-existent.
Many thanks for this great plugin not to mention the highly instructive source code which is a pleasure to browse!
