LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 11-15-2016, 10:36 PM   #1
Sefyir
Member
 
Registered: Mar 2015
Distribution: Linux Mint
Posts: 634

Rep: Reputation: 316Reputation: 316Reputation: 316Reputation: 316
Record multiple files in one ffmpeg command


I'm trying to create a screencast with 4 inputs. I'd like to do all 4 recordings to 4 different files in one ffmepg command
  • Audio Output from Desktop (music files etc)
  • Microphone Output
  • Webcam Output
  • Desktop (X11) Output

I'd like to have 4 files when done recording, allowing me to interact with each part separately in a video editor (or mux with ffmpeg)

These 4 commands do the job - but they're not in sync, it's also difficult to stop them at the same time due to the nature of backgrounding processes.

Code:
# Record x11
ffmpeg -framerate 60 -video_size 1920x1080 -f x11grab -i :0.0 x11.mp4 &

# Record webcam
ffmpeg -framerate 30 -f v4l2 -i /dev/video0 webcam.mp4 &

# Record mic
ffmpeg -f alsa -ac 2 -ar 44100 -i pulse -acodec libfdk_aac mic.aac &

# Record Desktop Audio
ffmpeg -f pulse -ac 2 -i alsa_output.pci-0000_01_00.1.hdmi-stereo.monitor -acodec libfdk_aac desktop_audio.aac &
I attempted them combined like this:

Code:
ffmpeg -framerate 60 -video_size 1920x1080 -f x11grab -i :0.0 x11.mp4 \
 -f v4l2 -framerate 30 -i /dev/video0 webcam.mp4 \
 -f alsa -ac 2 -ar 44100 -i pulse -acodec libfdk_aac mic.aac \ 
 -f pulse -ac 2 -i alsa_output.pci-0000_01_00.1.hdmi-stereo.monitor -acodec libfdk_aac desktop_audio.aac
But the webcam.mp4 and x11.mp4 are identical and have audio, the desktop_audio.aac and mic.aac are both recordings of the microphone!
Is there something I'm doing wrong? I seem to be getting half of what I want
 
Old 11-16-2016, 01:20 AM   #2
Sefyir
Member
 
Registered: Mar 2015
Distribution: Linux Mint
Posts: 634

Original Poster
Rep: Reputation: 316Reputation: 316Reputation: 316Reputation: 316
Ok, with the use of ffmpeg's map function this is possible and solved!
I tried to make it as human readable as possible, the inputs and mapping are respectfully ordered. Each file only contains their own map.
Eg, -f x11grab goes to -map 0:v:0 x11.mp4 and nothing else

Code:
  ffmpeg \
   -f x11grab -framerate 60 -video_size 1920x1080 -i :0.0 \
   -f v4l2 -framerate 30 -i /dev/video0 \
   -f alsa -ac 2 -ar 44100 -i pulse \
   -f pulse -ac 2 -i alsa_output.pci-0000_01_00.1.hdmi-stereo.monitor \
   -map 0:v:0 x11.mp4 \
   -map 1:v:0 webcam.mp4 \
   -map 2:a:0 -acodec libfdk_aac mic.aac \
   -map 3:a:0 -acodec libfdk_aac desktop_audio.aac
 
  


Reply

Tags
ffmpeg



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
ffmpeg can't record desktop + sound lord_didger Linux - Desktop 4 06-19-2012 05:19 AM
How do you split mpg files using a ffmpeg command? milkjerry3 Linux - Newbie 19 05-12-2011 08:09 AM
[SOLVED] split multi line record into multiple files with awk pcock Programming 10 11-12-2009 04:12 AM
Feed multiple files into ffmpeg? Anithen Linux - Software 2 08-25-2008 01:13 AM
how to record with ffmpeg evaristegalois Linux - Software 1 09-07-2006 06:58 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 03:49 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration