Compensate for ffprobe deficiency in probing h265-encoded files

The current version of ffprobe,

ffprobe version 4.2.4-1ubuntu0.1 Copyright (c) 2007-2020 the FFmpeg developers

prints a value of 0 for each frame number in an h265-encoded
mpegts. So, we need to count for ourselves.


Experiments with h265-encoded videos shows that there is great
compression (~30-40% better than h264), but:

-the mythling player on android can't play them;
-the 8-yr old asus frontend can play cartoons fine, but not
 "real-life" video
-transcoding is about 1/3 the speed with libx265 vs. libx264

I will revisit the issue when one of the first two points makes it
possible, but until one of them needs to be replaced, I will stick
with h264.
This commit is contained in:
Leo Butler 2021-04-18 06:46:48 -05:00
parent eb0f6c85cc
commit a483779bc1
1 changed files with 9 additions and 29 deletions

View File

@ -138,48 +138,28 @@
(define (mythconverg-select* table chanid starttime)
(mythconverg-execute+parse (simple-format #f "select * from ~a where chanid=~a and starttime=~a;" table chanid starttime)))
(define (mythconverg-get-recorded chanid starttime)
(apply (lambda(l1 l2) (map cons l1 l2)) (mythconverg-select* "recorded" chanid starttime)))
(map-cons (mythconverg-select* "recorded" chanid starttime)))
(define (mythconverg-get-recordedmarkup chanid starttime)
(map (lambda(x) (drop x 2)) (mythconverg-select* "recordedmarkup" chanid starttime)))
(define (ffprobe-video-packets file filter-rule)
(let ((frame-info (ffprobe-out-parser
(let ((frame-info (read-from-string (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))))
(c -1))
(define (add-coded_picture_number l)
(set! c (+ c 1))
(list (first l) (second l) (third l) c (fifth l)))
(filter filter-rule (map add-coded_picture_number frame-info))))
(define (ffprobe-i-frames file)
;; 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)))))))
(ffprobe-video-packets file (lambda(l) (and (eq? 'I (third l)) (not (eq? 'N/A (first l))) (not (eq? '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))))
(map make-dotted-alist (k-v-parser (ffprobe-out-parser stream-info)))))
;; (define (mythutil-get-cut/skip-list chanid starttime cut-or-skip)
;; (let ((drop (if (eq? cut-or-skip 'skip) 22 9))
;; (lst (shell-command-to-string (simple-format #f "mythutil --quiet --get~alist --chanid ~a --starttime ~a" cut-or-skip chanid starttime))))
;; (cond ((> (string-length lst) drop)
;; (read-from-string
;; (map (lambda (s) (string-split s #\-))
;; (string-split
;; (string-drop-right (string-drop lst drop) 1)
;; #\,))))
;; (#t
;; (error (simple-format #f "mythutil-get-cut/skip-list: mythutil returned '~a'\n" lst))))))
;; (define (mythutil-get-retention-list cs)
;; ;; if the first cut does not start at frame 0, add a pseudo cut
;; (let* ((l (if (eq? (caar cs) 0) cs (append (list (list 0 0)) cs))))
;; (define (f x a)
;; ;;(simple-format #t "x=~a\n" x)
;; (if (or (null? x) (null? (cdr x)))
;; a
;; (f (cdr x) (append (list (list (cadar x) (caadr x))) a))))
;; (cond ((= (length l) 1)
;; (list (list (cadar l) 'infinity)))
;; (#t
;; (reverse (f l '()))))))
(define (mysql-get-cut/skip-list chanid starttime cut-or-skip)
(let* ((s-e (if (eq? cut-or-skip 'cut) '(1 . 0) '(4 . 5)))