While I was checking streaming guide, I noticed that I can stream my webcam and mic using a command like the following:

ffmpeg -f dshow -i video="screen-capture-recorder":audio="Stereo Mix (IDT High Definition" \
-vcodec libx264 -preset ultrafast -tune zerolatency -r 10 -async 1 -acodec libmp3lame -ab 24k \ 
-ar 22050 -bsf:v h264_mp4toannexb -maxrate 750k -bufsize 3000k -f mpegts udp://

But wonder if I can save audio in a file while streaming video. The reason is that I want to use opencv to process video stream and then merge the result of opencv processing with the audio file. Any idea if it is possible to save audio in a file while streaming video alone?


Firstly, you should stream webcam and mic through the udp multicast address i.e.

Secondly, you execute ffmpeg -i udp:// out.mp3 or more options of the FFMPEG audio to do the audio extraction on another command prompt.

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.