From 61dc6756d6b39bf9b433baf54d1e84af2944884e Mon Sep 17 00:00:00 2001 From: Leo Butler Date: Thu, 7 Jan 2021 20:24:10 -0600 Subject: [PATCH] ensure that I-frames have valid data With the current ffprobe [1], time or frame numbers for an I-frame may be output that are invalid (N/A). [1] ffprobe version 3.4.8-0ubuntu0.2 Copyright (c) 2007-2020 the FFmpeg developers --- ffmpeg-myth.scm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ffmpeg-myth.scm b/ffmpeg-myth.scm index d502fea..04b2292 100755 --- a/ffmpeg-myth.scm +++ b/ffmpeg-myth.scm @@ -138,13 +138,13 @@ (map (lambda(x) (drop x 2)) (mythconverg-select* "recordedmarkup" chanid starttime))) - (define (ffprobe-video-packets file filter-rule) (let ((frame-info (ffprobe-out-parser (shell-command-to-string (simple-format #f "~a -v error -select_streams v:0 -show_entries frame=pkt_pts_time,pkt_pos,pict_type,coded_picture_number,interlaced_frame:side_data=nil -print_format csv=nokey=1:print_section=0:s='~a' -i '~a'" ffprobe-bin ffprobe-separator file))))) (read-from-string (filter filter-rule frame-info)))) (define (ffprobe-i-frames file) - (ffprobe-video-packets file (lambda(l) (string=? "I" (third l))))) + ;; filter out bad I-frames with N/A data in either the time (1) or frame number slot (2) + (ffprobe-video-packets file (lambda(l) (and (string=? "I" (third l)) (not (string=? "N/A" (first l))) (not (string=? "N/A" (second l))))))) (define (ffprobe-stream-info file) (let* ((stream-info (shell-command-to-string (simple-format #f "~a -v error -show_streams -print_format csv=nokey=0:s='~a' -i '~a'" ffprobe-bin ffprobe-separator file))))