4

I am trying to capture a video with a webcam (Logitech c270) and dump it to a file. However, at 1280x960, I get about 3fps using ffmpeg with the following command:

ffmpeg -f video4linux2 -input_format mjpeg -i /dev/video0 -vcodec mjpeg out2.mpeg

Is there a way to increase fps without simply reducing the resolution? Did I set anything wrong in the ffmpeg options?

This is the ffmpeg output

ffmpeg version 0.8.2-6:0.8.2-1+rpi1+b1, Copyright (c) 2000-2011 the Libav developers built on Jun 27 2012 01:07:05 with gcc 4.6.3

*** THIS PROGRAM IS DEPRECATED ***

This program is only provided for compatibility and will be removed in a future release. Please use avconv instead.

[video4linux2 @ 0x1399320] Estimating duration from bitrate, this may be inaccurate

Input #0, video4linux2, from '/dev/video0':
  Duration: N/A, start: 8397.386391, bitrate: N/A
  Stream #0.0: Video: mjpeg, yuvj422p, 1280x960, -5 kb/s, 30 tbr, 1000k tbn, 30 tbc

File 'out2.mpeg' already exists. Overwrite ? [y/N] y

[buffer @ 0x13992a0] w:1280 h:960 pixfmt:yuvj422p
[mpeg @ 0x139bac0] VBV buffer size not set, muxing may fail

Output #0, mpeg, to 'out2.mpeg':
  Metadata:
    encoder         : Lavf53.21.0
  Stream #0.0: Video: mjpeg, yuvj422p, 1280x960, q=2-31, 200 kb/s, 90k tbn, 30 tbc

Stream mapping:
  Stream #0.0 -> #0.0

Press ctrl-c to stop encoding
frame=   29 fps=  3 q=24.8 size=    1704kB time=0.97 bitrate=14440.5kbits/s dup=27 drframe=   31 fps=  3 q=24.8 size=    1796kB time=1.03 bitrate=14238.2kbits/s dup=28 dr
  • You really need to use an OpenMAX encoder, which may not exist yet. – Alex Chamberlain Oct 14 '12 at 18:13
  • I just would like ffmpeg to dump the mjpeg to a file, no need for encoding – miceterminator Oct 14 '12 at 18:21
  • O, I misread - I'm tired. Yeah, you've cocked it up – Alex Chamberlain Oct 14 '12 at 18:24
2

Try this

ffmpeg -f video4linux2 -input_format mjpeg -i /dev/video0 -vcodec copy out2.mpeg

-vcodec copy copies the video stream without transcoding of any kind.

  • Thank you this way I get up to 9 fps there are however some errors like [mpeg @ 0x1da2ae0] buffer underflow i=0 bufi=120936 size=140581 – miceterminator Oct 14 '12 at 18:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.