acowley / ffmpeg-light

Minimal Haskell bindings to the FFmpeg library
BSD 3-Clause "New" or "Revised" License
67 stars 29 forks source link

Webcam example #52

Closed ivanperez-keera closed 3 years ago

ivanperez-keera commented 4 years ago

Hi,

When I try the webcam example with:

./demo cam

I get:

demo: user error (ffmpeg failed opening file: No such file or directory)

If I enable debugging in Main.hs, I see:

Could not open framebuffer device '0:0': No such file or directory

Any advice?

acowley commented 4 years ago

You could try another device address like "/dev/video0".

ivanperez-keera commented 4 years ago

Thanks for getting back to me :)

I got:

[fbdev @ 0x14837a0] FBIOGET_VSCREENINFO: Inappropriate ioctl for device
demo: user error (ffmpeg failed opening file: Inappropriate ioctl for device)
acowley commented 4 years ago

I think the issue is something with ffmpeg, so you may want to remove Haskell from the equation and try a C test program. Here is an SO QA on the relevant function.

ivanperez-keera commented 4 years ago

Running that reports Success!

ffmpeg capture also works fine for me.

acowley commented 4 years ago

Sorry this took ages. I finally got a webcam on my main Linux development machine and was able to track down how to do this. It was very awkward, but it should work great now. There's a large PR adding an audio API to ffmpeg-light, so I layered the linux webcam fix atop those commits to avoid making the life of that PR any harder. You can checkout the audio branch from this repo to get the new audio API work-in-progress and fixed linux webcam support. Usage example.

ivanperez-keera commented 4 years ago

Not at all. You're busy! Thanks a lot for tracking it down and trying to make it work.

I have tried the usage example on two computers. On one, it works! :) On the other, I get:

Main: user error (ffmpeg failed opening file: Connection timed out)
CallStack (from HasCallStack):
  error, called at src/Codec/FFmpeg/Juicy.hs:128:27 in ffmpeg-light-0.13.0-LerafVQSgWeBJG0Lp5zGQy:Codec.FFmpeg.Juicy

On this second computer (a Macbook Air running Ubuntu 18.04), when I try the demo that comes with the examples, I get:

$ ./.cabal-sandbox/bin/demo cam
Aborted
acowley commented 4 years ago

Progress! 😀 One question is where the camera shows up in the file system. Is it at /dev/video0? Another possibility is that I’m using a newer ffmpeg. That I might be able to test as I think I have a laptop with a camera and Ubuntu 18.04. Not tonight, but hopefully soon.

gelisam commented 4 years ago

On this second computer (a Macbook Air running Ubuntu 18.04)

demo cam works fine on my MacBook Air, so I am guessing that it's the OS, not the hardware.

ivanperez-keera commented 4 years ago

Is it at /dev/video0?

It is!

No rush. The fact that this is working at least on one computer allows me to continue, so it's already great. If this is merged into master, I think this issue can be closed.