[FFmpeg-devel] grabbing from dv1394

Michel Bardiaux mbardiaux
Tue Jun 5 15:00:42 CEST 2007

Tommi Sakari Uimonen wrote:
> Hello.
> I got the dv1394 grabbing working with a patch from 
> http://svn.pardus.org.tr/pardus/devel/applications/multimedia/ffmpeg/files/ffmpeg-dv1394.patch
> I grab with:
> ./ffmpeg -f dv1394 -i /dev/dv1394/0 -f avi -acodec copy -vcodec copy -y 
> outfile.avi
> FFmpeg version SVN-r8793, Copyright (c) 2000-2007 Fabrice Bellard, et al.
>    configuration: --enable-gpl --enable-pthreads --enable-x11grab 
> --enable-dc1394 --enable-liba52 --enable-liba52bin --enable-libdts 
> --enable-libfaac --enable-libfaad --enable-libfaadbin --enable-libmp3lame 
> --enable-libogg --enable-libtheora --enable-libvorbis --enable-xvid
>    libavutil version: 49.4.0
>    libavcodec version: 51.40.4
>    libavformat version: 51.12.1
>    built on Apr 27 2007 00:03:12, gcc: 4.1.2 20060928 (prerelease) (Ubuntu 
> 4.1.1-13ubuntu5)

You should always post the *complete* output messages. In this case, it 
would have told us the actual containers, codecs, sizes, ...

And that version is old.

> (I have ffmpeg globally installed also and that does not handle dv1394 
> grabbing, being an ubuntu package)
> Now the problem is that the output has glitches every now and then; seems 
> like some frames are skipped and some parts are recorded twice (like 
> jumping half a second forward/back in the stream) and some frames are not 
> entirely correct - they contain parts from other frames.
> dvgrab however works just fine, so it's not a hardware problem
> My machine is fast enough to handle the processing (Core2Duo), ffmpeg was 
> using about 45% CPU with copying the streams, and about 80% with encoding 
> on the fly to mpeg4. So the framedropping shouldn't be caused by slow 
> computer.
> I have also tried to pipe dvgrab output to ffmpeg, but never figured out 
> the right way to do it. I tried for instance
> dvgrab --format dv1 - | ffmpeg -i - -acodec copy -sameq -y outfile.avi
> but I got 'pipe:: could not find codec parameters' error.

Again, without the full output...

> Anyone experiencing the same?
You are writing raw video to file. That eats a lot of I/O resources, and 
a large fraction of that use will be concentrated in bursts - which will 
interfere with the interrupts from the TV card.

There are various ways: patch ffmpeg so that there is an fsync after 
every write; or a sync(2) after every frame write; or a separate process 
that does a sync(2) every second; or write to a partition that is 
mounted with -o sync.

Michel Bardiaux
R&D Director
T +32 [0] 2 790 29 41
F +32 [0] 2 790 29 02
E mailto:mbardiaux at mediaxim.be

Mediaxim NV/SA
Vorstlaan 191 Boulevard du Souverain
Brussel 1160 Bruxelles

More information about the ffmpeg-devel mailing list