dshow webcam and microphone capture

For the developers that use FFmpeg in their software.
rogerdpack
Posts: 1872
Joined: Fri Aug 05, 2011 9:56 pm

Re: dshow webcam and microphone capture

Post by rogerdpack » Mon Aug 27, 2012 6:38 pm

just wondering if there's some trick to speeding ffmpeg in there somewhere...

fuwaneko
Posts: 6
Joined: Sat Aug 06, 2011 11:37 am

Re: dshow webcam and microphone capture

Post by fuwaneko » Tue Aug 28, 2012 3:41 am

rogerdpack wrote:just wondering if there's some trick to speeding ffmpeg in there somewhere...
It actually only separates AV decoding and encoding. That's important when recording from a live source like webcam or microphone to ensure you do not lose any packets. I.e. if you use complex codec the time program spends encoding may be high, and some packets will never reach program's input during that time. I'm not sure if ffmpeg internally handles this, but w/o threading I had tons of lost packets.

Basically you put all incoming packets into a deque (two of them: for audio and video) and then process it in a separate thread maintaining audio-video synchronization. You should also minimize operations on deque to minimize time program spends in mutex lock waiting for other thread.

rogerdpack
Posts: 1872
Joined: Fri Aug 05, 2011 9:56 pm

Re: dshow webcam and microphone capture

Post by rogerdpack » Wed Aug 29, 2012 1:57 pm

Interesting idea. Thanks!
(I know dshow has an rtbufsize you can set, but it may not be as good that, especially re-ordering wise).

prakharj
Posts: 1
Joined: Fri Jul 28, 2017 6:02 am

Re: dshow webcam and microphone capture

Post by prakharj » Fri Jul 28, 2017 6:07 am

fuwaneko wrote:
Mon Aug 27, 2012 3:00 am
I don't know if this helps. But here is my old source file. It features:
- DShow capture from webcam and microphone
- encoding via VFW dll
- basic usage of ffmpeg api.

Sorry it's poorly commented, but general idea should be clear. Also features multithreaded encoding with boost.thread. If you have any questions I'd be glad to help, it's really hard to find anything good on ffmpeg api.

Hi,

I tried to use this code but just to capture microphone audio as mp3. The captured audio has low pitch sound of the microphone. Can you help me with this issue ?

link for the recorded file https://drive.google.com/file/d/0BwEbdh ... sp=sharing

rogerdpack
Posts: 1872
Joined: Fri Aug 05, 2011 9:56 pm

Re: dshow webcam and microphone capture

Post by rogerdpack » Mon Aug 28, 2017 10:48 pm

what command line? what if you save as .wav? unfortunately it works OK here hmm

Post Reply