[FFmpeg-devel] [PATCH] handle EAGAIN case in ffmpeg.c
Wed Sep 12 14:43:11 CEST 2007
Ramiro Polla wrote:
> The best thing IMO is to make realtime grabbing in separate threads.
This can be true for some grabbing interfaces. But if you use v4l2 a
single thread can do the work (as a matter of fact, ffmpeg is perfectly
able to grab v4l2 video and oss audio, with perfect A/V synch). The
trick is that v4l2 provides a timestamp for each captured frame (so, if
ffmpeg blocks while reading another input - for example the audio - and
reads a frame "too late", it can still know when the frame was sampled,
and can synchronize it with the audio). The "old" v4l can also work in a
single-threaded environment, but that is trickier (relies on
non-blocking audio input, and A/V synch is more fragile).
> It requires many changes in ffmpeg though. It's been suggested to make
> libavgrab , and I'm working on this too.
I suspect libavgrab is a separate issue respect to this one (it is
already possible to capture audio and video in different threads by
using the current libavformat - I did it some time ago in a simple
application I developed, and it worked without big problems)
Anyway, if you are working on libavgrab I'd like to know some details
about it (mainly, how it will look like - is it a simple split of all
the "grabbing" inputs from libaformat, or are you implementing a
different API / structure?). I still have my ALSA input and output
formats somewhere, and I'd like to have them included in libavgrab...
More information about the ffmpeg-devel