Broken pipe when writing to external program's stream
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
SBCL |
Invalid
|
Undecided
|
Unassigned |
Bug Description
Maybe this is related to bug # 1405921 but I see a dependency on the OS version which is not reported there. I want to write data to an external instance of ffmpeg to create some videos for visualization. While the code is working on a Linux setup of the original author and on macOS 10.13. it fails on macOS 10.15. with the following error:
Couldn't write to #<SB-SYS:FD-STREAM for "descriptor 7" {100227EB23}>:
Broken pipe
I made sure that SBCL is allowed to access the hard drive and control other programs in macOS' security settings. Everything works for a simple example as given in Edi Weitz' book (http://
Please let me know if I can provide anymore information.
This is how far I could boil it down:
-- minimal.lisp
;; Using external-program
(ql:quickload "external-program")
;; The size of the video
(defparameter *width* 640)
(defparameter *height* 480)
;; Setting up ffmpeg
(defparameter *ffmpeg-args*
(list "-loglevel" "debug"
"-nostats"
"-nostdin"
"-f" "rawvideo"
"-s" (format nil "~Dx~D" *width* *height*)
"-pix_fmt" "bgra"
"-r" (format nil "~D" 25)
"-i" "-"
"-an"
"-f" "mp4"
"-pix_fmt" "yuv420p"
"-c:v" "libx264"
"-level" "3.1"
"-y"
"out.mp4"))
;; Make sure ffmpeg is installed and found in $PATH
(defparameter *p*
(external-
;; I get a running process after this line
(let ((buffer (make-array (* *width* *height* 4)
;; 0 means a complete black frame
;; 255 means a complete white frame
))
(dotimes (i 50)
(write-sequence buffer (external-
(format t ";;; Frame: ~,20D~%" i)))
(close (external-
-- SBCL's version
$ sbcl --version
SBCL 1.5.9
-- OS
$ uname -a
Darwin Martins-
--
*features*
(:OSICAT-FD-STREAMS CFFI-FEATURES:
CFFI-FEATURES:UNIX CFFI-FEATURES:
ALEXANDRIA.
:ASDF3.2 :ASDF3.1 :ASDF3 :ASDF2 :ASDF :OS-MACOSX :OS-UNIX
:NON-BASE-
:ANSI-CL :AVX2 :BSD :C-STACK-
:COMPACT-
:FP-AND-
:IMMOBILE-SPACE :INODE64 :INTEGER-EQL-VOP :LINKAGE-TABLE :LITTLE-ENDIAN
:MACH-
:OS-PROVIDES-
:PACKAGE-
:SB-EVAL :SB-LDB :SB-PACKAGE-LOCKS :SB-SIMD-PACK :SB-SIMD-PACK-256
:SB-SOURCE-
:STACK-
:STACK-
:STACK-
:UNWIND-
description: | updated |
Changed in sbcl: | |
status: | Incomplete → Invalid |
Can you redo it without using external-program?