video icon indicating copy to clipboard operation
video copied to clipboard

Possible bugs with (clip ...)

Open srfoster opened this issue 5 years ago • 2 comments

I'm getting some confusing behavior with (clip ...) -- both when I (preview ...) and when I (render ...).

Here, I expected the previewer to show me a 1-second clip that starts at the 10-second mark of my original clip and ends at the 11-second mark of the original.

#lang racket

(require video/base video/player video/render)

(define m (clip "original.mp4"
                #:start 10 
                #:length 1))

(preview m)

Instead, it shows me a 1-second clip starting at the 0-second mark of my original.

The behavior with (render ...) is different, but also unexpected. Again, I expected the previewer to show me a 1-second clip that starts at the 10-second mark of my original clip and ends at the 11-second mark of the original.

#lang racket

(require video/base video/player video/render)

(define m (clip "original.mp4"
                #:start 10 
                #:length 1))

(render m "out.mp4" #:width 640 #:height 480)

Instead, I get a 10 second clip that actually does start at the right spot (the 10-second mark), and it has the 1-second of footage. But it seems to be padded at the end, making the clip 10-seconds long.

> ffmpeg -i out.mp4 2>&1 | grep "Duration"
Duration: 00:00:10.96, start: 0.000000, bitrate: 25 kb/s

I should mention that I'm on the #stable branch. I'm about to retry with the most recent version.

srfoster avatar Mar 16 '19 19:03 srfoster

On #master, I get slightly different results -- but it still doesn't feel quite right.

#lang racket

(require video/base video/player video/render)

(define m (clip "original.mp4"
                #:start 10 
                #:length 1))

(render m "out.mp4" #:width 640 #:height 480)

This gives me an output file that begins with the 1-second bit that I wanted, but it appears to be padded with a bunch of blackness at the end. The file is about 30-minutes long -- the same length as my original.mp4.

>ffmpeg -i out.mp4 2>&1 | grep "Duration"
Duration: 00:29:21.34, start: 0.000000, bitrate: 0 kb/s

As for the previewer, it seems to have the same bug as on #stable: it just shows me a 1-second clip starting at the very beginning of my original.mp4 rather than the 10-second mark.

srfoster avatar Mar 16 '19 19:03 srfoster

Just installed video-testing with Racket 7.8 CS under macOS 10.14, and having similar issues.

The preview always starts at 0, no matter what I give for #:start.

What the previewer player shows as the current position oscillates rapidly between a credible value and something that looks random.

Trying to preview a playlist consisting of a few clip producers (which all work individually) runs out of memory inside DrRacket. From a plain Racket REPL,

(require video/player)
(preview vid)

opens a player with a black image area and then crashes:

; in-vertices: vertex #f not in graph #<weighted-graph>
; Context:
;  .../graph/graph-weighted.rkt:191:0 in-weighted-graph-neighbors
;  .../graph/graph-fns-basic.rkt:57:4 for-loop
;  .../graph/graph-fns-basic.rkt:46:0 bfs/generalized
;  .../private/ffmpeg-pipeline.rkt:1650:0 get-seek-point
;  .../private/ffmpeg-pipeline.rkt:1291:0 init-filter-graph
;  .../video/render.rkt:515:7
;  .../video/player.rkt:103:4 !play method in video-player-server%
;  .../video/player.rkt:458:0 preview
;  .../private/arrow-val-first.rkt:555:3

khinsen avatar Sep 21 '20 09:09 khinsen