I'd like to conduct recorded video interviews with Skype and am looking for a reliable tool to accomplish that.
Is there anything out there that's not slow or buggy?
I'm running (K)Ubuntu.
I'd like to conduct recorded video interviews with Skype and am looking for a reliable tool to accomplish that.
Is there anything out there that's not slow or buggy?
I'm running (K)Ubuntu.
This command will capture your full desktop: So use this command, whenever you want to record skype-conversation ( or anything else )
ffmpeg -f x11grab -s wxga -r 25 -i :0.0 -sameq /tmp/out.mpg
There is software recordMyDesktop http://recordmydesktop.sourceforge.net/about.php which you can record any part of you screen you want. I use it to record my skype sessions.
sudo apt-get install recordmydesktop
to install it from main channels.
Recording live video and audio during a call (or during any X11 desktop activity) is not very difficult thanks to ffmpeg and the amount of help articles available (including this site). However, if you aim at higher quality, you will quickly reach the limits of the simple approach of simultaneous media grabbing and compressing. Hence the need for a tool (or a set of tools) that would enable to:
The following Bash scripts (myrec
, myrec-novideo
and myproc
) are my attempt at this task. I am sure there are neater ways of writing these scripts, but I was learning Bash scripting on the go (with tremendous satisfaction once I got it to work, I might add).
ffmpeg
pulseaudio
skype
If 1
or 2
are not present in your system, install them with your preferred package manager (I use synaptic
). For skype
visit www.skype.com.
myrec
myrec
(or whatever name works for you)myrec
executable by issuing the command: chmod +x myrec
User settings
section to suit your setup:
#!/bin/bash
echo "Record lossless audio and lossless video for further processing."
echo "Created file name always starts with temp_YYYYMMDD_HHMMSS."
echo "Syntax:"
echo "myrec [optional file description]"
echo "Optional file description is appended to the file name, with spaces replaced by underscores."
echo
echo
### User settings - adjust values to suit your system and needs
# I used to have the name of my webcam mic here, but that stopped working after a system update. "default" was the only fix I found. If you have more than one microphone connected, you may need to tell Pulseaudio which mic you want to be the default, I think pavucontrol is the utility for it.
# If you want to try supplying a name here, run pacmd, then within it the command list-sources will give you a list of possible microphones. Use the name field value without angle brackets.
microphone_audio_device="default"
# Run pacmd, within it the command list-sinks will give you a list of devices to choose from. Use the name field value without angle brackets.
speakers_audio_device="alsa_output.pci-0000_00_1b.0.analog-stereo.monitor"
# Select frame size.
# Some standard frame sizes for reference:
# wvga 852x480
# wxga 1366x768
# wsxga 1600x1024
# wuxga 1920x1200
# woxga 2560x1600
# wqsxga 3200x2048
# wquxga 3840x2400
# whsxga 6400x4096
# whuxga 7680x4800
frame_size="wsxga"
# Framerate in frames per second
framerate="30"
# Indicate which screen the video should be recorded from and an optional offset.
# For example:
# :0.0+10,20
# where 0.0 is display.screen number of your X11 server, same as the DISPLAY environment variable. 10 is the x-offset and 20 the y-offset of the frame, measured from the top left corner of the screen to the top left corner of the frame.
frame_position=":0.0"
# Include the trailing slash after target directory name.
# Expect a very large file!
target_directory="/target/directory/name/"
### End of user settings
record_command="ffmpeg -f pulse -thread_queue_size 512k -i $speakers_audio_device -f pulse -thread_queue_size 512k -i $microphone_audio_device -f x11grab -s $frame_size -r $framerate -thread_queue_size 512k -i $frame_position -map 0 -map 1 -map 2 -codec:a copy -codec:v libx264 -qp 0 -preset ultrafast"
temporary_file_prefix="temp_"
# The IFS (Internal Field Separator) system variable stores the character that separates command line arguments.
# We can use it to replace spaces with underscores.
temp=$IFS
IFS='_'
description="$*"
IFS=$temp
if [ $# -eq 0 ]; then
$record_command $target_directory$temporary_file_prefix`date +%Y%m%d_%H%M%S`.mkv
else
$record_command $target_directory$temporary_file_prefix`date +%Y%m%d_%H%M%S`_$description.mkv
fi
Recording audio only is handled by a separate script in the following section.
myrec-novideo
myrec-novideo
(or whatever name works for you)myrec-novideo
executable by issuing the command: chmod +x myrec-novideo
User settings
section to suit your setup:
#!/bin/bash
echo "Record lossless audio for further processing."
echo "Created file name always starts with temp_YYYYMMDD_HHMMSS."
echo "Syntax:"
echo "myrec-novideo [optional file description]"
echo "Optional file description is appended to the file name, with spaces replaced by underscores."
echo
echo
### User settings - adjust values to suit your system
# I used to have the name of my webcam mic here, but that stopped working after a system update. "default" was the only fix I found. If you have more than one microphone connected, you may need to tell Pulseaudio which mic you want to be the default, I think pavucontrol is the utility for it.
# If you want to try supplying a name here, run pacmd, then within it the command list-sources will give you a list of possible microphones. Use the name field value without angle brackets.
microphone_audio_device="default"
# Run pacmd, within it the command list-sinks will give you a list of devices to choose from. Use the name field value without angle brackets.
speakers_audio_device="alsa_output.pci-0000_00_1b.0.analog-stereo.monitor"
# Include the trailing slash after target directory name.
# Expect a large file!
target_directory="/target/directory/name/"
### End of user settings
record_command="ffmpeg -f pulse -thread_queue_size 512k -i $speakers_audio_device -f pulse -thread_queue_size 512k -i $microphone_audio_device -map 0 -map 1 -codec:a copy -codec:a copy"
temporary_file_prefix="temp_"
# The IFS (Internal Field Separator) system variable stores the character that separates command line arguments.
# We can use it to replace spaces with underscores.
temp=$IFS
IFS='_'
description="$*"
IFS=$temp
if [ $# -eq 0 ]; then
$record_command $target_directory$temporary_file_prefix`date +%Y%m%d_%H%M%S`.mkv
else
$record_command $target_directory$temporary_file_prefix`date +%Y%m%d_%H%M%S`_$description.mkv
fi
myproc
myproc
(or whatever name works for you)myproc
executable by issuing the command: chmod +x myproc
User settings
section to suit your setup:
#!/bin/bash
echo "Compress files recorded with myrec or myrec-novideo."
echo "For files to be processed they need to reside in the storage directory and start with temp_"
echo "The two audio tracks (mic and speakers) are mixed together into one new stream, but they are also available as separate tracks in the final file."
# Mixing is because players I know cannot play two audio tracks from the same file simultaneously.
# The mic also captures sounds produced by the speakers. It has two effects:
# 1. You can use this single track to hear both yourself (the mic) and whatever came out of your speakers. Personally I did not like the degraded quality of recorded speaker sounds, hence the direct recording off the sound card and mixing that with the mic track.
# 2. Speaker sounds recorded by the mic are slightly delayed when compared to the direct recording off the sound card. The mixed track is thus hard to listen to.
# I do have echo cancellation module loaded in Pulseaudio, perhaps there is something wrong with my configuration?
### User settings
# Indicate storage directory without the trailing slash
storage_directory="/storage/directory/name"
### End of user settings
# Any temp_ file may contain 3 streams (audio, audio, video) indexed as (0, 1, 2), or just 2 streams (audio, audio) indexed as (0, 1).
# A file temp2_ contains just one stream: both audio streams from temp_ mixed.
# The step with temp2_ is necessary as the mixing option (-filter_complex) is a global option (i.e. not stream-specific). Attempts at doing it all in one go prevent the separate tracks from being copied into the final file.
for f in $storage_directory/temp_*
do
if [ -e ${f/temp_/} ]
then
# Do not overwrite an existing final file. Prevents unnecessary work when the script is run regularly as a cron job.
echo "$f: A final file (without temp_) already exists. Skipping. If you want to reencode, please delete the final file manually."
else
# Variable g will contain the name of the second temporary file with both audio streams mixed into one.
g=${f/temp_/temp2_}
# Mixing mic and sound card tracks into one stream
ffmpeg -i "$f" -map 0:0 -map 0:1 -filter_complex amix=inputs=2:duration=longest:dropout_transition=2 -codec:a libvorbis -n "$g"
# Create the final file: copy the mixed audio stream from temp2_, add and compress both separate audio streams from temp_, compress at high quality the video stream from temp_.
# The question mark in -map 0:2? tells ffmpeg to ignore the error if this stream (video) is missing. Allows this same script to be used for audio-only recordings.
ffmpeg -i "$f" -i "$g" -map 1:0 -map 0:0 -map 0:1 -map 0:2? -codec:a:0 copy -codec:a:1 libvorbis -codec:a:2 libvorbis -codec:v libx264 -qp 18 -preset slow -threads 0 -n "${g/temp2_/}"
# Delete temp2_
rm "$g"
fi
done
Thanks to ffmpeg
's flexibility, myproc
can process files that may or may not contain the video stream.
myrec
of your settings. In general, try to have the video call window somewhere near your webcam, so that the person on the other side has a chance to think that you are looking them in the eye.Have a terminal window open. Whenever you wish to start recording, use the command:
. myrec some description
. myrec-novideo some description
some description
is optional in both scripts. You can use the Tab
key to expand script names to save some typing.
ffmpeg
will start recording to a file named temp_YYYYMMDD_HHMMSS_some_description.mkv
, where YYYYMMDD_HHMMSS
is the date and time of the recording.
q
at the terminal window where ffmpeg
is recording once you are ready to stop.. myproc
to process (compress) the files. You can either do it manually, or set up a cron
job to do it while you are away.temp_
file.default
. I used to have the mic name there, but this setting stopped working after a system update. It could be something restricted to my setup only, or to pulseaudio
.Pulse
's echo cancellation module is loaded, but I think it is only meant to cancel my own voice echo. The thing is that when mic audio is mixed with sound card audio the slight delay makes the resulting stream hard to listen to. Does anyone have an idea how to prevent the mic from recording the sounds from the speakers?I hope you find these tools useful. I look forward to hearing your thoughts for improvement and comments.
Open Broadcaster Software (OBS) Studio ties all these requirements into an easy to use frontend.
It's open source, and cross platform:
For Ubuntu 15.04 and later:
sudo add-apt-repository ppa:obsproject/obs-studio
sudo apt-get update && sudo apt-get install obs-studio ffmpeg
For other distros/earlier Ubuntu versions, checkout the git wiki