Newest 'ffmpeg' Questions - Stack Overflow
Les articles publiés sur le site
-
Video encoding in real time through node js ?
15 mai 2018, par user717166Do Anyone know realtime encode video in node with ffmpeg ? I know transloadit was done well on this. Any idea ?
https://transloadit.com/blog/2010/12/realtime-encoding-over-150x-faster
-
use ffmpeg to overlay a video on top of another using an alpha channel
15 mai 2018, par cloudravenSimilar to what alphamerge / alphaextract do, but instead of having two sources I want to use three
InputVideo1, AlphaofInputVideo1, BackgroundVideo
The idea would be to overlay inputvideo1 on top of backgroundvideo using AlphaofInputVideo1 to do a more accuracte blending. Is this possible? Using intermediate steps (e.g. using alphamerge and generate intermediate rgba bitmaps) is acceptable.
-
Node.js child_process TypeError : Cannot read property '_writableState' of undefined
15 mai 2018, par functorialI am trying to wrap a piece of ffmpeg's functionality in a Node.js API, using the
child_process
library, but when I attempt to send any data to ffmpeg's stdin pipe, I get an errorTypeError: Cannot read property '_writableState' of undefined
.import {spawn} from "child_process" export default frames => { // Spawn ffmpeg process const ffmpeg = spawn("ffmpeg", ["-f", "image2pipe", "-i", "-", "output.mkv"]) // Send frames to ffmpeg as stdin frames.forEach(ffmpeg.stdin.write) // Listen for output and errors return new Promise((resolve, reject) => { const chunks = [] ffmpeg.stdout.on("data", chunks.push) ffmpeg.stderr.on("data", reject(data)) ffmpeg.on("close", code => resolve(Buffer.concat(chunks)) ) }) }
Error:
TypeError: Cannot read property '_writableState' of undefined at Writable.write (_stream_writable.js:270:20) at Array.forEach (
) at exports.default (/home/fiendfan1/workspace/nodejs/declare/dist/app/common/encodeVideo.js:21:12) at _callee$ (/home/fiendfan1/workspace/nodejs/declare/dist/app/tests/video.js:34:84) at tryCatch (/home/fiendfan1/workspace/nodejs/declare/node_modules/regenerator-runtime/runtime.js:65:40) at Generator.invoke [as _invoke] (/home/fiendfan1/workspace/nodejs/declare/node_modules/regenerator-runtime/runtime.js:303:22) at Generator.prototype.(anonymous function) [as next] (/home/fiendfan1/workspace/nodejs/declare/node_modules/regenerator-runtime/runtime.js:117:21) at Generator.tryCatcher (/home/fiendfan1/workspace/nodejs/declare/node_modules/bluebird/js/release/util.js:16:23) at PromiseSpawn._promiseFulfilled (/home/fiendfan1/workspace/nodejs/declare/node_modules/bluebird/js/release/generators.js:97:49) at Promise._settlePromise (/home/fiendfan1/workspace/nodejs/declare/node_modules/bluebird/js/release/promise.js:574:26) at Promise._settlePromise0 (/home/fiendfan1/workspace/nodejs/declare/node_modules/bluebird/js/release/promise.js:614:10) at Promise._settlePromises (/home/fiendfan1/workspace/nodejs/declare/node_modules/bluebird/js/release/promise.js:693:18) at Async._drainQueue (/home/fiendfan1/workspace/nodejs/declare/node_modules/bluebird/js/release/async.js:133:16) at Async._drainQueues (/home/fiendfan1/workspace/nodejs/declare/node_modules/bluebird/js/release/async.js:143:10) at Immediate.Async.drainQueues [as _onImmediate] (/home/fiendfan1/workspace/nodejs/declare/node_modules/bluebird/js/release/async.js:17:14) at runCallback (timers.js:696:18) -
ffmpeg : given a video of any length, create timelapse video of 6-8 seconds long
14 mai 2018, par CDubI have an application which consumes video of any length (could be a few seconds, could be several minutes) and I want to use
ffmpeg
to return a "timelapse" version of the input video which will always be between 6 and 8 seconds long.I've been fiddling with the following:
ffmpeg -y -i in.mp4 -r 10 -vf setpts='0.01*PTS' -an out.mp4
Which seems to be a good start, but still generates very dynamic results given what
in.mp4
is.I also don't fully understand the verbiage in the ffmpeg documentation, so I'm not even sure what arguments to use for
setpts
, or ifsetpts
is the correct filter I want to use. -
Set input frame rate in pygame.Camera
14 mai 2018, par Thomas HubregtsenI am trying to get an input stream from a webcam on OS X
self.capture = pygame.camera('/dev/video{}'.format(camera), (640, 480), 'RGB')
I get an error (see below), but there are 2 pieces of information that I can not really stitch together. On first sight, it looks like I do not have the correct camera (not video4linux). However, when running
ffmpeg -f avfoundation -list_devices true -i ""
I get it listed
[AVFoundation input device @ 0x7fbb45700340] [1] FULL HD 1080P Webcam
The next part of the error talks about frame rate. It appears that the frame-rate is slightly off, and that I just next to select a different frame rate. Would this be possible with pygcam? Would this solve my problem?
Error:
Traceback (most recent call last): File "webcam2.py", line 129, in
VideoStreaming("52.191.118.156", 5558, 1)() File "webcam2.py", line 22, in __call__ with self.get_camera_context(self.camera_id) as frames: File "webcam2.py", line 89, in __enter__ size=(640, 480)) File "/Users/q433100/temp/brew-master/lib/python3.6/site-packages/imageio/core/functions.py", line 129, in get_reader return format.get_reader(request) File "/Users/q433100/temp/brew-master/lib/python3.6/site-packages/imageio/core/format.py", line 169, in get_reader return self.Reader(self, request) File "/Users/q433100/temp/brew-master/lib/python3.6/site-packages/imageio/core/format.py", line 218, in __init__ self._open(**self.request.kwargs.copy()) File "/Users/q433100/temp/brew-master/lib/python3.6/site-packages/imageio/plugins/ffmpeg.py", line 327, in _open self._load_infos() File "/Users/q433100/temp/brew-master/lib/python3.6/site-packages/imageio/plugins/ffmpeg.py", line 476, in _load_infos (self.request._video, ffmpeg_err)) IndexError: No video4linux camera at . FFMPEG STDERR OUTPUT: ffmpeg version 3.4.1 Copyright (c) 2000-2017 the FFmpeg developers built with Apple LLVM version 9.0.0 (clang-900.0.39.2) configuration: --prefix=/Users/q433100/temp/brew-master/Cellar/ffmpeg/3.4.1 --enable-shared --enable-pthreads --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-gpl --enable-libmp3lame --enable-libx264 --enable-libxvid --enable-opencl --enable-videotoolbox --disable-lzma libavutil 55. 78.100 / 55. 78.100 libavcodec 57.107.100 / 57.107.100 libavformat 57. 83.100 / 57. 83.100 libavdevice 57. 10.100 / 57. 10.100 libavfilter 6.107.100 / 6.107.100 libavresample 3. 7. 0 / 3. 7. 0 libswscale 4. 8.100 / 4. 8.100 libswresample 2. 9.100 / 2. 9.100 libpostproc 54. 7.100 / 54. 7.100 [avfoundation @ 0x7fbb9e000a00] Selected framerate (29.970030) is not supported by the device [avfoundation @ 0x7fbb9e000a00] Supported modes: [avfoundation @ 0x7fbb9e000a00] 160x120@[30.000030 30.000030]fps [avfoundation @ 0x7fbb9e000a00] 176x144@[30.000030 30.000030]fps [avfoundation @ 0x7fbb9e000a00] 320x240@[30.000030 30.000030]fps [avfoundation @ 0x7fbb9e000a00] 352x288@[30.000030 30.000030]fps [avfoundation @ 0x7fbb9e000a00] 640x360@[30.000030 30.000030]fps [avfoundation @ 0x7fbb9e000a00] 640x480@[30.000030 30.000030]fps [avfoundation @ 0x7fbb9e000a00] 800x600@[30.000030 30.000030]fps [avfoundation @ 0x7fbb9e000a00] 1024x576@[30.000030 30.000030]fps [avfoundation @ 0x7fbb9e000a00] 960x720@[30.000030 30.000030]fps [avfoundation @ 0x7fbb9e000a00] 1280x720@[30.000030 30.000030]fps [avfoundation @ 0x7fbb9e000a00] 1392x768@[30.000030 30.000030]fps [avfoundation @ 0x7fbb9e000a00] 1280x960@[30.000030 30.000030]fps [avfoundation @ 0x7fbb9e000a00] 1600x896@[30.000030 30.000030]fps [avfoundation @ 0x7fbb9e000a00] 1920x1080@[30.000030 30.000030]fps [avfoundation @ 0x7fbb9e000a00] 160x120@[30.000030 30.000030]fps [avfoundation @ 0x7fbb9e000a00] 176x144@[30.000030 30.000030]fps [avfoundation @ 0x7fbb9e000a00] 320x240@[30.000030 30.000030]fps [avfoundation @ 0x7fbb9e000a00] 352x288@[30.000030 30.000030]fps [avfoundation @ 0x7fbb9e000a00] 640x360@[30.000030 30.000030]fps [avfoundation @ 0x7fbb9e000a00] 640x480@[30.000030 30.000030]fps [avfoundation @ 0x7fbb9e000a00] 800x600@[20.000000 20.000000]fps [avfoundation @ 0x7fbb9e000a00] 1024x576@[8.000000 8.000000]fps [avfoundation @ 0x7fbb9e000a00] 960x720@[15.000015 15.000015]fps 1: Input/output error Update: If I try to force one of the mentioned supported frame rates with ffmped, I get a new error
$ffmpeg -f avfoundation -r 30.000030 -i "1" out.mpg ffmpeg version 3.4.1 Copyright (c) 2000-2017 the FFmpeg developers built with Apple LLVM version 9.0.0 (clang-900.0.39.2) configuration: --prefix=/Users/q433100/temp/brew-master/Cellar/ffmpeg/3.4.1 --enable-shared --enable-pthreads --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-gpl --enable-libmp3lame --enable-libx264 --enable-libxvid --enable-opencl --enable-videotoolbox --disable-lzma libavutil 55. 78.100 / 55. 78.100 libavcodec 57.107.100 / 57.107.100 libavformat 57. 83.100 / 57. 83.100 libavdevice 57. 10.100 / 57. 10.100 libavfilter 6.107.100 / 6.107.100 libavresample 3. 7. 0 / 3. 7. 0 libswscale 4. 8.100 / 4. 8.100 libswresample 2. 9.100 / 2. 9.100 libpostproc 54. 7.100 / 54. 7.100 [avfoundation @ 0x7fb3c8802600] An error occurred: The activeVideoMinFrameDuration passed is not supported by the device. Use -activeFormat.videoSupportedFrameRateRanges to discover valid ranges.1: Input/output error
Update 2: Setting the input frame rate to 15 directly in ffmpeg works. Now I just need to figure out how to do this in python with pygame.camera
$ ffmpeg -f avfoundation -r 15.000015 -i "1" out.avi