mirror of
https://gitlab.com/mbunkus/mkvtoolnix.git
synced 2025-02-04 00:09:31 +00:00
add developer tool for converting MPEG TS timestamps
This commit is contained in:
parent
836ce42b73
commit
c51c1861c9
29
tools/development/mpeg_ts_timestamp_conversion.pl
Executable file
29
tools/development/mpeg_ts_timestamp_conversion.pl
Executable file
@ -0,0 +1,29 @@
|
||||
#!/usr/bin/perl
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
sub fmt {
|
||||
my ($orig, $direction, $ts) = @_;
|
||||
|
||||
my $seconds = int($ts / 1_000_000_000);
|
||||
|
||||
printf "%d %s MPEG is %02d:%02d:%02d.%09d\n", $orig, $direction, int($seconds / 3_600), int($seconds / 60) % 60, $seconds % 60, $ts % 1_000_000_000;
|
||||
}
|
||||
|
||||
my $direction = 'from';
|
||||
|
||||
foreach my $arg (@ARGV) {
|
||||
if ($arg =~ m{^(f|from)$}) {
|
||||
$direction = 'from';
|
||||
|
||||
} if ($arg =~ m{^(t|to)$}) {
|
||||
$direction = 'to';
|
||||
|
||||
} elsif ($direction eq 'from') {
|
||||
fmt($arg, $direction, int($arg * 100_000 / 9));
|
||||
|
||||
} else {
|
||||
fmt($arg, $direction, int($arg * 9 / 100_000));
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user