Code: Alles auswählen
#!/usr/bin/perl
=head1 NAME
fixCinemaDNG - fixes CinemaDNG directories with dropped frames
=head1 SYNOPSIS
fixcinemadng <directory>
=head2 Examples
B<cd some_cinemadng_directory; fixcinemadng .>
Go into one CinemaDNG directory, fix all missing files.
=head1 DESCRIPTION
fixCinemaDNG scans a CinemaDNG directory for missing files/frames (according to the file numbering) and replaces each missing frame with the previous frame.
This will allow to open and process CinemaDNG in applications that only accpet CinemaDNG directories without missing DNG files, such as DaVinci Resolve.
=head1 AUTHOR
fcr <info@pleintekst.nl>
=head VERSION & LICENSE
v0.9, 2014
Public domain
=cut
use File::Copy qw(copy);
if (@ARGV) {$dir = $ARGV[0] ; $dir =~ s/\|//g } else {$dir = '.'}
opendir (DIR, $dir) or die ("Could not access current directory.\n");
while ($file = readdir(DIR)) {
if ($file =~ /dng$/i) {
$frame_number = $file;
$frame_number =~ s/(.*_)([0-9]+)\.dng/\2/;
if ($counter == 0) {
$file_name_prefix = $1;
}
push @frames, $frame_number;
$counter++;
}
}
closedir (DIR);
$counter = 0;
@frames = sort {$a <=> $b} @frames;
foreach $frame_number(@frames) {
if ($counter > 0) {
$frame_diff = $frame_number-$frame_number_old;
if (($frame_diff) > 1) {
print "filling dropped frames between frame $frame_number_old & $frame_number...\n";
$old_file = $file_name_prefix . $frame_number_old . '.dng';
for ($x = ($frame_number_old+1); $x < $frame_number; $x++) {
$new_file = $file_name_prefix . sprintf("%06d", $x) . '.dng';
copy $old_file, $new_file;
}
}
}
$frame_number_old = $frame_number;
$counter++;
}
cantsin hat geschrieben: ↑So 16 Apr, 2017 11:56 Falls sich die Framedrop-Diagnose bestätigen sollte, hätte ich noch ein (in Perl) selbstgeschriebenes Mini-Utility, das alle fehlenden Frames eines CinemaDNG-Clips durch Kopieren des vorhergehenden Frames ersetzt:
Das Script kann auch hier heruntergeladen werden.Code: Alles auswählen
#!/usr/bin/perl =head1 NAME fixCinemaDNG - fixes CinemaDNG directories with dropped frames =head1 SYNOPSIS fixcinemadng <directory> =head2 Examples B<cd some_cinemadng_directory; fixcinemadng .> Go into one CinemaDNG directory, fix all missing files. =head1 DESCRIPTION fixCinemaDNG scans a CinemaDNG directory for missing files/frames (according to the file numbering) and replaces each missing frame with the previous frame. This will allow to open and process CinemaDNG in applications that only accpet CinemaDNG directories without missing DNG files, such as DaVinci Resolve. =head1 AUTHOR fcr <info@pleintekst.nl> =head VERSION & LICENSE v0.9, 2014 Public domain =cut use File::Copy qw(copy); if (@ARGV) {$dir = $ARGV[0] ; $dir =~ s/\|//g } else {$dir = '.'} opendir (DIR, $dir) or die ("Could not access current directory.\n"); while ($file = readdir(DIR)) { if ($file =~ /dng$/i) { $frame_number = $file; $frame_number =~ s/(.*_)([0-9]+)\.dng/\2/; if ($counter == 0) { $file_name_prefix = $1; } push @frames, $frame_number; $counter++; } } closedir (DIR); $counter = 0; @frames = sort {$a <=> $b} @frames; foreach $frame_number(@frames) { if ($counter > 0) { $frame_diff = $frame_number-$frame_number_old; if (($frame_diff) > 1) { print "filling dropped frames between frame $frame_number_old & $frame_number...\n"; $old_file = $file_name_prefix . $frame_number_old . '.dng'; for ($x = ($frame_number_old+1); $x < $frame_number; $x++) { $new_file = $file_name_prefix . sprintf("%06d", $x) . '.dng'; copy $old_file, $new_file; } } } $frame_number_old = $frame_number; $counter++; }
(Auf MacOS und Linux einfach sichern und auf der Kommandozeile mit "perl fixcinemadng <ordner>" ausführen. Kurzanleitung per "perldoc fixcinemadng". Bei Windows braucht man eine Perl- oder Cygwin-Installation, um das Script ausführen zu können.)
Perl-Scripts laufen nur in einer Terminal-Kommandozeilenumgebung wie dem Windows Command Prompt, der Windows Power Shell oder Cygwin. Du musst das Skript per Tastatureingabe im jeweiligen Terminal ausführen (und dabei auch die Grundbedienung der Kommandozeilenumgebung kennen).