Skip to content

Instantly share code, notes, and snippets.

@smooker
Created June 7, 2022 03:26
Show Gist options
  • Save smooker/99bc4eec5fb815566e7c48d0e34cbba4 to your computer and use it in GitHub Desktop.
Save smooker/99bc4eec5fb815566e7c48d0e34cbba4 to your computer and use it in GitHub Desktop.
#!/usr/bin/perl
#ffmpeg -y -loglevel info -threads 4 -hwaccel nvdec -i $1 -i $2 -i $3 -filter_complex "\
#[0:v]trim=50:,setpts=PTS-STARTPTS[v0]; \
#[1:v]trim=0:,setpts=PTS-STARTPTS[v1]; \
#[2:v]trim=0:,setpts=PTS-STARTPTS[v2]; \
#[v0][v1][v2]concat=n=3:v=1:a=0[out]" \
#-map "[out]" output3.mkv
#ffmpeg -i output3.mkv -ss 00:08:06 -to 11:11:11 output4.mkv
my @files = <./cam1_saved_2022-06-04_[1-2]*>;
print "ASDF: ".scalar @files."\n";
my $num = scalar @files;
print "ffmpeg -y -loglevel info -threads 4 -hwaccel nvdec";
foreach my $file (@files) {
# print $file . "\n";
print " -i $file \\\n";
}
print " -filter_complex \"\\\n";
for (my $num2=0;$num2<$num;$num2++) {
print " [$num2:v]trim=0:,setpts=PTS-STARTPTS[v$num2]; \\\n";
}
for (my $num2=0;$num2<$num;$num2++) {
print "[v$num2]";
}
print "concat=n=$num:v=1:a=0[out]\" -map \"[out]\" -c:v hevc_nvenc -profile:v main -c:a copy output3.mkv";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment