Answers.Body: <p>Firstly, you should stream webcam and mic through the udp multicast address i.e. 224.1.1.1:10001.</p>
  <p>Secondly, you execute ffmpeg -i udp://224.1.1.1:10001 out.mp3 or more options of the <a href="https://ffmpeg.org/ffmpeg.html#Audio-Options" rel="nofollow noreferrer">FFMPEG audio</a> to do the audio extraction on another command prompt.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-08-09T01:33:12.760Z
Answers.LastActivityDate: 2020-08-09T01:33:12.760Z
Answers.UserDisplayName: xer-rex
Body: <p>While I was checking <a href="https://trac.ffmpeg.org/wiki/StreamingGuide" rel="nofollow noreferrer">streaming guide</a>, I noticed that I can stream my webcam and mic using a command like the following:</p>
  <pre><code>ffmpeg -f dshow -i video=&quot;screen-capture-recorder&quot;:audio=&quot;Stereo Mix (IDT High Definition&quot; \
  -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://192.168.5.215:48550
  </code></pre>
  <p>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?</p>
  
Tags: <ffmpeg>
Title: Saving audio while streaming video using ffmpeg
UserDisplayName: Afshin
ThreadText: # Saving audio while streaming video using ffmpeg
  
  (Asked by: username_0 on 2020-08-08)
  
  While I was checking [streaming guide](https://trac.ffmpeg.org/wiki/StreamingGuide), 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://192.168.5.215:48550
  
  ```
  
  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?
  
  **Tags:** ffmpeg
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2020-08-09. Score: 0
  
  Firstly, you should stream webcam and mic through the udp multicast address i.e. 224.1.1.1:10001.
  
  Secondly, you execute ffmpeg -i udp://224.1.1.1:10001 out.mp3 or more options of the [FFMPEG audio](https://ffmpeg.org/ffmpeg.html#Audio-Options) to do the audio extraction on another command prompt.
  
  
  ---
  
  