From: Alan J. Pippin Date: Wed, 12 Oct 2022 02:49:34 +0000 (-0600) Subject: Added code to better detect video codecs X-Git-Url: http://git.pippins.net/embedvideo/static/%27%20%20%20%20.%20%24GLOBALS%5B%27phpgw%27%5D-%3Elink%28%27inc/jquery/%7Bupdate_month%7D?a=commitdiff_plain;h=2675e038e4a9ef7bf5cee7ff32a77a6f31799965;p=videoscripts%2F.git Added code to better detect video codecs Fixed bug in how the dstfile name was being set in merged video Re-enabled merge by modification time, as that is more accurate than filename --- diff --git a/make_mkv b/make_mkv index c769004..bf98325 100755 --- a/make_mkv +++ b/make_mkv @@ -218,6 +218,12 @@ foreach my $video (sort{$videos{$a} <=> $videos{$b}} keys %videos) { if($video_stream_info =~ / (\d+x\d+)[,| ]/) { $dimensions = "$1"; } else { print "-W- ffprobe was unable to find dimensions for video: $video\n"; } + # Video Codec + my $video_stream_info = `$ffprobe "$video" 2>&1 | grep -e "Stream.*Video"`; chomp($video_stream_info); + my $video_codec = "unknown"; + if($video_stream_info =~ / Video: (\S+) /) { $video_codec = "$1"; } + else { print "-W- ffprobe was unable to find video codec for video: $video\n"; } + # Color space my $color_space = "unknown"; if($video_stream_info =~ /, (\S+)\(.*?\)/) { $color_space = "$1"; } @@ -235,7 +241,7 @@ foreach my $video (sort{$videos{$a} <=> $videos{$b}} keys %videos) { else { print "-W- ffprobe was unable to find audio codec for video: $video\n"; } # Now create our parameters string - my $parameters = "$dimensions.$color_space.$audio_handler.$audio_codec"; + my $parameters = "$dimensions.$video_codec.$color_space.$audio_handler.$audio_codec"; print " Adding video $video to be merged into output video file: $opt_o.$parameters.mkv\n" if($opt_v); push @{$merge_videos{"$parameters"}}, $video; diff --git a/merge_videos_by_day b/merge_videos_by_day index 91070d8..146ac84 100755 --- a/merge_videos_by_day +++ b/merge_videos_by_day @@ -156,7 +156,7 @@ foreach $dstfile (sort keys %videos) { my $videos = join(',', @{$videos{$dstfile}}); - if($dstfile =~ /(\d+)-(\d+)-(\d+)/) { + if($dstfile =~ /(\d+)-(\d+)-(\d+)$/) { $year = $1; $month = $2; $day = sprintf("%02d",$3); diff --git a/organize_videos.conf b/organize_videos.conf index ccc46e2..fd12413 100644 --- a/organize_videos.conf +++ b/organize_videos.conf @@ -30,7 +30,7 @@ $watchpathname = "/naspool/cloud/alan/files/InstantUpload/Camera;/naspool/cloud/ $merge_videos_by_day = "/naspool/videos/bin/merge_videos_by_day"; # Flag to merge videos by modification date instead of the date parsed from the filename -$merge_by_modification_date = 0; +$merge_by_modification_date = 1; # Path to the make_mkv script $make_mkv = "/naspool/videos/bin/make_mkv"; @@ -76,7 +76,7 @@ $no_recompress_file_ext = qr/\.(mp4)$/i; # Video file creation dates must not have changed in the last X minutes to process any of the video files # This is done to ensure that all videos from a given upload from a camera have completed prior to looking for videos to merge -$minage = "+60"; +$minage = "+120"; # What command should be used to find files that have changed (are at least $minage old) $find_changed_cmd = "find \"$srcpathname/\" -not -cmin $minage -a \\( $movie_file_ext \\)";