LoginSignup
4

More than 5 years have passed since last update.

fswebcamのエラー回避策

Posted at

fswebcam

fswebcamは簡単にコマンドラインからUVCカメラのキャプチャができて便利なツールです。

fswebcam tst.jpg

とすると静止画をキャプチャしてファイルに落としてくれます。便利。

しかし、、

fswebcam foo.jpg  
--- Opening /dev/video0...
Trying source module v4l2...
/dev/video0 opened.
No input was specified, using the first.
Adjusting resolution from 384x288 to 320x240.
--- Capturing frame...
GD Error: gd-jpeg: JPEG library reports unrecoverable error: Not a JPEG file: starts with 0x08 0x0aCaptured frame in 0.00 seconds.
--- Processing captured image...
Writing JPEG image to 'foo.jpg'.

こんな感じで出力ファイルが破損していることが環境により起こりました。Ubuntu16.04で確認。

対応

fswebcam tst.jpg -D 1

-Dオプションで撮影までの待ち時間(秒)を指定できます。待ち時間を入れてあげると回避できました。初期化が間に合わないといったことが起こっているんでしょうか。。

参考リンク

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4