Open timkendall opened 9 years ago
Maybe the issue is that -i "0"
maps to something other than /dev/video0
.
Could you please try the following :
/dev/video0
from the command lineerror
handlers to your FfmpegCommand
and see what error ffmpeg returns (you can also check the 2nd and 3rd arguments to the error handler to get the directo output of ffmpeg)Alright so it turns out that my issue was me being ignorant of how the library works. Got live recording from both Facetime Camera and a connected USB camera with the following -
It came down to just following the instructions here for each OS.
On OSX:
var capture = ffmpeg('default') // See above article
// Set input format (depends on OS, will not work if this isn't correct!)
.inputFormat('avfoundation')
// Set output format
.format('mp4')
// Set size
.size(SIZE)
// Set FPS
.fps(FPS)
// Set video codec
.videoCodec('libx264')
// Record stream for 15sec
.duration('0:15')
.save('camera-recording.mp4');
On Ubuntu (14.04.1):
var capture = ffmpeg('/dev/video0')
// Set input format (depends on OS, will not work if this isn't correct!)
.inputFormat('v4l2')
// Set output format
.format('mp4')
// Set size
.size(SIZE)
// Set FPS
.fps(FPS)
// Set video codec
.videoCodec('libx264')
// Record stream for 15sec
.duration('0:15')
.save('camera-recording.mp4');
Nice to see you solved your problem, and thanks for the hints on how to get it to work. You shouldn't need to set the format explicitly, though, as ffmpeg is able to determine it automatically based on the output file extension.
Oh, and I'm keeping this one open as I would like to be able to pass capture device indices as inputs.
How to end a stream recording, If I dont want to set a timeout? Is there any api call to be made?
Yes @crosofg, you can call command.kill()
.
@njoyard But that does not get into the callback on"end" .
Nope, that calls 'error' instead (which is the right thing to do, as ffmpeg did not terminate normally).
@njoyard Can you tell me the clean to terminate the process?
Yes @crosofg, you can
call command.kill()
.
This is the only way to terminate the process when the source does not end and no video duration was set on the command.
can any one tell me how to capture the video for the webcam through fluent ffmpeg in windows?
Hi everybody, is there a way to capture having a realtime preview in a video tag?
thanx to anybody who will answer
Has anybody used this library with recording a live video stream from a connected camera? Ideally it would be as easy as -
I've used
ffmpeg -f avfoundation -i "0" ffmpeg-facetime.mpg
to record from the built in Facetime HD camera on my mac but I can't get this to work with the library.Is this even close?