videolang / video

Source Code for Video language.
https://lang.video
Apache License 2.0
125 stars 12 forks source link

Rendering without a specified file extension ends badly #24

Closed BenChung closed 6 years ago

BenChung commented 6 years ago

The following code:

#lang racket
(require video/base)
(require video/render)

(define v2 "PLISS_Jun21_13-42-00.mov")

(define (get-indexed-video source index)
  (clip source #:filters (list (mux-filter #:type 'video
                                           #:index index))))

  (define screen (get-indexed-video v2 0))
  (define camera (get-indexed-video v2 2))

(define background (color "black" #:properties (hash "start" 0 "end" +inf.0 "width" 1280)))
(define logo (image "pliss-logo-col.png"))

(define output (multitrack
 background
 (composite-transition 0 0 480/1032 480/1032)
 camera
 (composite-transition 480/1296 120/720 1 1)
 screen
 (composite-transition 40/1280 411/720 400/1280 209/688)
 logo))
(render/pretty output "composite"
               #:width 1280
               #:height 720
               #:fps 24)

Fails with the following error (in the terminal, with errortrace):

[NULL @ 0000000002f4f240] Unable to find a suitable output format for 'C:\Users\Ben Chung\Videos\pliss\./composite'
avformat-context->C: argument is not non-null `avformat-context' pointer
 argument: #f
 errortrace...:
  C:\Users\Ben Chung\Documents\GitHub\video\video\private\ffmpeg-pipeline.rkt:499:4: (avformat-alloc-output-context2 output-format format-name file)
  C:\Users\Ben Chung\Documents\GitHub\video\video\render.rkt:455:14: (stream-bundle->file out-path bundle-spec #:format-name format-name)
  C:\Users\Ben Chung\Documents\GitHub\video\video\render.rkt:316:9: (match settings ((struct* render-settings ((destination dest) (width ....) (....) ....)) (define extension (match format ....)) (define bundle-spec (match ....)) (define format-name (....))
(define video-streams ....) (define ....) (....) ....))
  C:\Users\Ben Chung\Documents\GitHub\video\video\render.rkt:309:6: (call-with-semaphore current-render-settings-lock (╬╗ () (set! video-graph (video:mk-render-graph)) (set! video-sink (....)) (set! current-render-settings ....) (match ....)))
  C:\Users\Ben Chung\Documents\GitHub\video\video\render.rkt:208:4: (render/async video dest #:render-mixin render-mixin #:width width #:height height #:start ....)
  C:\Users\Ben Chung\Videos\pliss\composite.rkt:28:0: (render/pretty screen "./composite" #:width 1280 #:height 720 #:fps 24)

This is resolved by adding a .mov extension to the output filename, but it would be nice if Video was able to pass on the ffmpeg error message, and if it inferred the mov output format automatically.

LeifAndersen commented 6 years ago

It looks to me like the error message is being printed out:

Unable to find a suitable output format for 'C:\Users\Ben Chung\Videos\pliss\./composite'

It would be nice though to have a #:format flag for the render function to set an output format without being based on the filename.

LeifAndersen commented 6 years ago

As it looks like this issue has been fixed I'm going to close it. Let me know if that is incorrect or otherwise changes.