Answers.Body: <p>Combined command:</p>
  
  <pre><code>ffmpeg -i input0.mov -i input1.mov -filter_complex "[0]scale=640x360[v0];[1]scale=640x360[v1];[v0][v1]hstack,split[video][image]" -map "[video]" output.mp4 -map 0:a audio0.mp3 -map 1:a audio1.mp3 -map "[image]" -frames:v 1 image.jpg
  </code></pre>
  
  <p>For a 4 videos into a 2x2 layout:</p>
  
  <pre><code>ffmpeg -i input0.mov -i input1.mov -i input2.mov -i input3.mov -filter_complex "[0]scale=640x360[v0];[1]scale=640x360[v1];[2]scale=640x360[v2];[3]scale=640x360[v3];[v0][v1][v2][v3]xstack=inputs=4:layout=0_0|w0_0|0_h0|w0_h0,split[video][image]" -map "[video]" output.mp4 -map 0:a audio0.mp3 -map 1:a audio1.mp3 -map 2:a audio2.mp3 -map 3:a audio3.mp3 -map "[image]" -frames:v 1 image.jpg
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-04-26T21:38:58.543Z
Answers.Text: Your answer works for the split screen video and 2 separate mp3s if I exclude:
  "image.jpg"  at the end  
  
  Unfortunately if I add "image.jpg" it makes the video and audio about 1 frame long and doesn't create a thumbnail of the finished resultant splitscreen video, just input1.mov.  
  Any ideas?
Answers.UserDisplayName: Ben Hardy
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-04-27T17:35:07.010Z
Answers.Text: @BenHardy See updated answer. Wasn't able to test the first iteration and I forgot a few things.
Answers.UserDisplayName: llogan
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-04-27T20:36:45.947Z
Answers.Text: This works perfectly. Could this code be adapted for 4 videos? </>
Answers.UserDisplayName: Ben Hardy
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-04-27T21:16:48.113Z
Answers.Text: @BenHardy See updated answer.
Answers.UserDisplayName: llogan
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-04-26T19:11:29.403Z
Answers.LastActivityDate: 2020-04-27T21:16:40.697Z
Answers.LastEditDate: 2020-04-27T21:16:40.697Z
Answers.UserDisplayName: llogan
Body: <p>I'm using ffmpeg to create several single splitscreen videos out of 2 separate videos. The 2 videos have audio so I want to extract the 2 video's audio streams as 2 separate mp3s and also create a thumbnail out of the finished splitscreen video. Is it possible to do these 3 actions in one pass?</p>
  
  <p>Here is the code I'd use to create the splitscreen video:</p>
  
  <p><code>ffmpeg -i input0.mov -i input1.mov  -filter_complex "[0]scale=640x360[v0];[1]scale=640x360[v1];[v0][v1] xstack=inputs=2:layout=0_0|w0_0|[v]" -map "[v]" -an output.mp4</code></p>
  
  <p>Here is the code I'd use to create the thumbnail of the resultant splitscreen video:</p>
  
  <p><code>ffmpeg -y -i input.mp4 -vframes 1  OUTPUT.jpg</code></p>
  
  <p>Here is the code I'd use to create one mp3</p>
  
  <p><code>ffmpeg -i input0.mov output0.mp3</code></p>
  
Tags: <video><ffmpeg><audio><conversion><transcoding>
Title: Create one split screen video, separate audio streams and a thumbnail from the resultant split screen video - all in one pass
UserDisplayName: Ben Hardy
ThreadText: # Create one split screen video, separate audio streams and a thumbnail from the resultant split screen video - all in one pass
  
  (Asked by: username_0 on 2020-04-26)
  
  I'm using ffmpeg to create several single splitscreen videos out of 2 separate videos. The 2 videos have audio so I want to extract the 2 video's audio streams as 2 separate mp3s and also create a thumbnail out of the finished splitscreen video. Is it possible to do these 3 actions in one pass?
  
  Here is the code I'd use to create the splitscreen video:
  
  `ffmpeg -i input0.mov -i input1.mov -filter_complex "[0]scale=640x360[v0];[1]scale=640x360[v1];[v0][v1] xstack=inputs=2:layout=0_0|w0_0|[v]" -map "[v]" -an output.mp4`
  
  Here is the code I'd use to create the thumbnail of the resultant splitscreen video:
  
  `ffmpeg -y -i input.mp4 -vframes 1 OUTPUT.jpg`
  
  Here is the code I'd use to create one mp3
  
  `ffmpeg -i input0.mov output0.mp3`
  
  **Tags:** video, ffmpeg, audio, conversion, transcoding
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2020-04-26. Score: 1 | Accepted answer
  
  Combined command:
  
  ```
  ffmpeg -i input0.mov -i input1.mov -filter_complex "[0]scale=640x360[v0];[1]scale=640x360[v1];[v0][v1]hstack,split[video][image]" -map "[video]" output.mp4 -map 0:a audio0.mp3 -map 1:a audio1.mp3 -map "[image]" -frames:v 1 image.jpg
  
  ```
  
  For a 4 videos into a 2x2 layout:
  
  ```
  ffmpeg -i input0.mov -i input1.mov -i input2.mov -i input3.mov -filter_complex "[0]scale=640x360[v0];[1]scale=640x360[v1];[2]scale=640x360[v2];[3]scale=640x360[v3];[v0][v1][v2][v3]xstack=inputs=4:layout=0_0|w0_0|0_h0|w0_h0,split[video][image]" -map "[video]" output.mp4 -map 0:a audio0.mp3 -map 1:a audio1.mp3 -map 2:a audio2.mp3 -map 3:a audio3.mp3 -map "[image]" -frames:v 1 image.jpg
  
  ```
  
  > **Comments:**
  > **username_0**: Your answer works for the split screen video and 2 separate mp3s if I exclude: "image.jpg"  at the end    Unfortunately if I add "image.jpg" it makes the video and audio about 1 frame long and doesn't create a thumbnail of the finished resultant splitscreen video, just input1.mov.   Any ideas?  
  > **username_1**: @username_0 See updated answer. Wasn't able to test the first iteration and I forgot a few things.  
  > **username_0**: This works perfectly. Could this code be adapted for 4 videos? </>  
  > **username_1**: @username_0 See updated answer.  
  
  ---
  
  