[FFmpeg-user] Obviating for webcam startup times for live webcam recording?

Mathieu Bosi mathieu.bosi at gmail.com
Mon Feb 5 20:40:57 EET 2018


I am successfully recording videos from my webcam using ffmpeg under
windows with the
Direct Show source type with the following command line:

  ffmpeg -f dshow -video_size 640x360 -rtbufsize 4MB -framerate 30
-pixel_format yuyv422 -i video="Logitech BRIO" out.mp4

All is working nicely, however I encountered the following problem:
since the ffmpeg command line is launched, the webcam takes some time
(around 2-3 seconds) to start streaming.
I know that this is a limitation that depends on the webcam way of
functioning / driver,
since this will happen with any other software accessing it (e.g. Skype).

The thing is that I would need video recording start to be as fast as
possible since the command line is started.

I was thinking that a possible solution would be to use a first instance of
ffmpeg to read the webcam,
keeping it running and continuously "streaming" it to a second ffmpeg
instance that could then
access the live stream of data only when needed.
I thought that in this way webcam video recording startup delay would be
eliminated or greatly reduced.

A note: I need to record more than one video, so I would let instance 1
always run, and only launch instance 2 when I want to record a new video.

So, my question are the following:
1. is such two "ffmpeg instances" configuration possible?
2. if so, what is the most efficient way to stream / pipe the video data
from instance 1 (hot webcam) to instance 2 (save to disk) with minimal
video quality loss?

Thanks for your help!


Mathieu Bosi

More information about the ffmpeg-user mailing list