我想通过Skype进行录制的视频采访,并且正在寻找一种可靠的工具来实现这一目标。
有没有不慢或没有故障的东西?
我正在跑步(K)Ubuntu。
我想通过Skype进行录制的视频采访,并且正在寻找一种可靠的工具来实现这一目标。
有没有不慢或没有故障的东西?
我正在跑步(K)Ubuntu。
Answers:
有软件recordMyDesktop http://recordmydesktop.sourceforge.net/about.php,您可以记录屏幕上任何想要的部分。我用它来记录我的Skype会话。
sudo apt-get install recordmydesktop
从主要渠道安装它。
此命令将捕获您的整个桌面:因此,无论何时要记录skype会话(或其他任何内容),请使用此命令。
ffmpeg -f x11grab -s wxga -r 25 -i :0.0 -sameq /tmp/out.mpg
借助ffmpeg和大量可用的帮助文章(包括本网站),在通话过程中(或在任何X11桌面活动中)录制实时视频和音频并不是很难。但是,如果您追求更高的质量,则将迅速达到同时获取和压缩媒体这一简单方法的极限。因此,需要一种工具(或一组工具)来实现以下目的:
下面的Bash脚本(myrec
,myrec-novideo
和myproc
)是我在这个任务的尝试。我敢肯定有写这些脚本的更整洁的方法,但是我正在旅途中学习Bash脚本(一旦投入使用,我会非常满意,我可能会补充)。
ffmpeg
pulseaudio
skype
如果1
还是2
不存在于你的系统,你的首选包管理器安装它们(我用的synaptic
)。要skype
访问www.skype.com。
myrec
myrec
(或任何适合您的名称)myrec
通过发出以下命令使可执行文件:chmod +x myrec
User settings
部分以适合您的设置:
#!/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
在下一节中,仅记录音频由单独的脚本处理。
myrec-novideo
myrec-novideo
(或任何适合您的名称)myrec-novideo
通过发出以下命令使可执行文件:chmod +x myrec-novideo
User settings
部分以适合您的设置:
#!/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
(或任何适合您的名称)myproc
通过发出以下命令使可执行文件:chmod +x myproc
User settings
部分以适合您的设置:
#!/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
由于ffmpeg
的灵活性,myproc
可以处理可能包含或不包含视频流的文件。
myrec
一下您的设置。通常,尝试将视频通话窗口放在您的网络摄像头附近,以便另一侧的人有机会认为您在看他们。打开终端窗口。每当您希望开始录制时,请使用以下命令:
. myrec some description
. myrec-novideo some description
some description
在两个脚本中都是可选的。您可以使用该Tab
键扩展脚本名称以保存一些键入内容。
ffmpeg
将开始记录到名为的文件temp_YYYYMMDD_HHMMSS_some_description.mkv
,其中YYYYMMDD_HHMMSS
是记录的日期和时间。
q
,在ffmpeg
正在录制的终端窗口上按。. myproc
以处理(压缩)文件。您可以手动执行此操作,也可以设置cron
工作以在外出时执行。temp_
文件。default
。我以前在这里有麦克风名称,但是此设置在系统更新后停止工作。可能仅限于我的设置或pulseaudio
。Pulse
的回声消除模块已加载,但我认为这仅是为了消除我自己的语音回声。问题是,当将麦克风音频与声卡音频混合时,稍有延迟就会使最终的流难以收听。有谁知道如何防止麦克风录制扬声器的声音?我希望您发现这些工具有用。我期待着听到您的想法以求改进和评论。
Open Broadcaster Software(OBS)Studio将所有这些要求结合到一个易于使用的前端中。
它是开源的,跨平台的:
对于Ubuntu 15.04和更高版本:
sudo add-apt-repository ppa:obsproject/obs-studio
sudo apt-get update && sudo apt-get install obs-studio ffmpeg
对于其他发行版/早期Ubuntu版本,请查看git Wiki