How to record from webcam, with ffmpeg? - Printable Version +- PINE64 (https://forum.pine64.org) +-- Forum: Pinebook Pro (https://forum.pine64.org/forumdisplay.php?fid=111) +--- Forum: Linux on Pinebook Pro (https://forum.pine64.org/forumdisplay.php?fid=114) +--- Thread: How to record from webcam, with ffmpeg? (/showthread.php?tid=11178) |
How to record from webcam, with ffmpeg? - gleachkr - 08-28-2020 Hi Folks, I need to record some videos, and it would be nice to be able to use the PBP for this. Unfortunately, I'm having some trouble getting ffmpeg to do an acceptable job of keeping recorded audio and video in sync. I wonder if anyone has any tips, or has had any luck recording decent videos? Here's the command I've been using: Code: v4l2-ctl --set-fmt-video=width=640,height=480 -d /dev/video4 #this video format gets a decent framerate I'm running an up-to-date manjaro system. Thanks! RE: How to record from webcam, with ffmpeg? - jiyong - 08-28-2020 Do you really have no other alternative than the webcam (smartphone, tablet, other computer)? In my opinion the webcam doesn't qualify as decent. When you really have to, try Cheese or Kamoso. I have tried screen recording with FFMPEG, but gave up and went with SimpleScreenRecorder. I don't know how to capture the command, but I thought it uses FFMPEG. RE: How to record from webcam, with ffmpeg? - gleachkr - 08-28-2020 (08-28-2020, 10:21 AM)jiyong Wrote: Do you really have no other alternative than the webcam (smartphone, tablet, other computer)? I do have alternatives, so this isn't life or death, but I'd like to use the PBP (it would be convenient, and I'd just like to know how to do this, for the sake of knowing). The video and audio quality are actually perfectly OK for my purposes. The only issue is audio synchronization. It would be nice to be able to do this with ffmpeg or some simple command line too. RE: How to record from webcam, with ffmpeg? - gleachkr - 08-28-2020 For what it's worth, guvcview seems to have a similar issue - I can get a decent framerate, but audio and video are out of sync. RE: How to record from webcam, with ffmpeg? - barray - 08-28-2020 Some tips and tricks (that may or may not help): * Checkout different video encoding formats (h264 can be "heavy", motion jpeg or something could be lighter (but bigger)) * Compile ffmepg on the device with some CPU specific flags, try to use formats you have hardware acceleration for * Check what formats come out of the camera, cheap webcams are usually YUYV, but some offer RGB and even jpeg (creating a motion jpeg from a jpeg is easy) RE: How to record from webcam, with ffmpeg? - jiyong - 08-29-2020 I never bothered with the webcam (too crappy in my opinion), but I can add some experience with SimpleScreenRecorder. I can record the 1080p screen with h264, so 480p should not be a problem. So far I was never able to get clean sound from the built-in mic. Example: https://www.youtube.com/watch?v=DGLrmzwp-YI I decided to buy the RØDE NT-USB mini microphone and it solved my audio issues. https://www.youtube.com/watch?v=XN7ZEmgVBzA If all else fails, record the output of the webcam while displaying it with another app with SimpleScreenRecorder. You can tell SimpleScreenRecorder to record just a part of the screen. RE: How to record from webcam, with ffmpeg? - gleachkr - 09-15-2020 So, for what it's worth, I've so far gotten decent audio/video synchronization with the following ffmpeg invocation: Code: #!/usr/bin/env bash |