File: concat.t

package info (click to toggle)
libmedia-convert-perl 1.4.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 3,416 kB
  • sloc: perl: 1,886; makefile: 2
file content (29 lines) | stat: -rw-r--r-- 1,078 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/usr/bin/perl -w

use strict;
use warnings;

use Test::More tests => 9;

use_ok('Media::Convert::Asset');
use_ok('Media::Convert::Asset::Concat');
use_ok('Media::Convert::Pipe');

my $input1 = Media::Convert::Asset->new(url => "t/testvids/bbb.mp4");
ok(defined($input1), "Creating an asset works");
my $input2 = Media::Convert::Asset->new(url => "t/testvids/bbb.mp4");
ok(defined($input2), "Creating a second asset with the same URL works");
my $concat = Media::Convert::Asset::Concat->new(url => "./concat.txt", components => [$input1, $input2]);
ok(defined($concat), "Creating a concat asset works");
isa_ok($concat, "Media::Convert::Asset");
isa_ok($concat, "Media::Convert::Asset::Concat");
my $output = Media::Convert::Asset->new(url => "./test.mkv");

Media::Convert::Pipe->new(inputs => [$concat], output => $output, vcopy => 1, acopy => 1)->run;

my $check = Media::Convert::Asset->new(url => $output->url);

ok(int($check->duration) == int($input1->duration * 2), "The output video has approximately the correct length");

unlink($concat->url);
unlink($output->url);