ffmpeg-python
ffmpeg-python copied to clipboard
Pipes not working
I'm trying to get pipes working in a class in the following manner
self.webcam = (
ffmpeg.input(
opts["device"],
format="avfoundation",
framerate=self.fps,
pix_fmt="uyvy422",
s=opts["size"],
probesize="42M",
)
.output("pipe:0", format="rawvideo")
.run_async(pipe_stdout=True, pipe_stdin=True)
)
self.writer = (
ffmpeg.input("pipe:0", format="rawvideo")
.output(self.name, pix_fmt="yuv420p")
.overwrite_output()
.run_async(pipe_stdin=True)
)
where opts["device"], opts["size"], self.name, and self.fps are objects within my class. When I call my code, I get the following error
Input #0, avfoundation, from 'HD Pro Webcam C920':
Duration: N/A, start: 79133.371567, bitrate: N/A
Stream #0:0: Video: rawvideo (UYVY / 0x59565955), uyvy422, 1920x1080, 30 fps, 30 tbr, 1000k tbn, 1000k tbc
Stream mapping:
Stream #0:0 -> #0:0 (rawvideo (native) -> rawvideo (native))
Press [q] to stop, [?] for help
Output #0, rawvideo, to 'pipe:0':
Metadata:
encoder : Lavf58.45.100
Stream #0:0: Video: rawvideo (UYVY / 0x59565955), uyvy422, 1920x1080, q=2-31, 995328 kb/s, 30 fps, 30 tbn, 30 tbc
Metadata:
encoder : Lavc58.91.100 rawvideo
av_interleaved_write_frame(): Bad file descriptor
Error writing trailer of pipe:0: Bad file descriptor
frame= 1 fps=0.0 q=-0.0 Lsize= 4050kB time=00:00:00.03 bitrate=995338.0kbits/s speed= 12x
video:4050kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.000000%
Conversion failed!
Not really sure where the problem is on the bad file descriptor? Any advice?
Were you able to figure this out? Facing the same error
Were you able to figure this out? Facing the same error
process = (
ffmpeg
.input(file)
.output("pipe:", format="rawvideo", pix_fmt="rgb24", s="27*48", vsync="0")
.run_async( pipe_stdout=True)
)
video_stream, err = process.communicate()
I also encountered this problem. Is there a solution?