App-EventStreamr

 view release on metacpan or  search on metacpan

lib/App/EventStreamr/DVswitch/Youtube.pm  view on Meta::CPAN

method _build_avlib() {
  # TODO: This makes assumptions
  if ( -e '/usr/bin/avconv' ) {
    return 'avconv';
  } else {
    return 'ffmpeg';
  }
}

method _build_cmd() {
  my $command = 'dvsink-command -h $host -p $port -- '.$self->avlib.' -i - -deinterlace -vcodec libx264 -pix_fmt yuv420p -vf scale=-1:480 -preset $preset -r $fps -g $gop -b:v $bitrate -acodec libmp3lame -ar 44100 -threads 6 -qscale 3 -b:a 256000 -buf...

  my $gop = ($self->{config}{youtube}{fps} * 2);

  my %cmd_vars = (
                  host      => $self->{config}{mixer}{host},
                  port      => $self->{config}{mixer}{port},
                  preset    => $self->{config}{youtube}{preset},
                  fps       => $self->{config}{youtube}{fps},
                  gop       => $gop,
                  bitrate   => $self->{config}{youtube}{bitrate},

t/App/EventStreamr/DVswitch/Youtube.t  view on Meta::CPAN

    config_path => $dir,
  );
  
  my $proc = App::EventStreamr::DVswitch::Youtube->new(
    config => $config,
    status => $status,
  );
  
  is(
    $proc->cmd, 
    'dvsink-command -h 127.0.0.1 -p 1234 -- '.$proc->avlib.' -i - -deinterlace -vcodec libx264 -pix_fmt yuv420p -vf scale=-1:480 -preset medium -r 25 -g 50 -b:v 2500k -acodec libmp3lame -ar 44100 -threads 6 -qscale 3 -b:a 256000 -bufsize 512k -f flv ...
    "Stream Command built"
  );
  
  like($proc->cmd, $proc->cmd_regex, "Command Regex Correct" );
}

done_testing();



( run in 1.439 second using v1.01-cache-2.11-cpan-3cd7ad12f66 )