EDIT: The second one is done now too. See http://youtu.be/izyf27eLPPA
This example isn't perfect, since I had to do a little editing in kdenlive and chose a poor output resolution and format (720p mp4). It looks ok in small screens but full screen looks pretty rough. But the point is that it is perfectly synchronized to the jack audio. The raw clips look great. This can only be accomplished through ffmpeg. With a patch. But it IS possible and here's how (using kxstudio):
#get tools and source
sudo apt-get install yasm libvorbis-dev libx263-dev libxfixes-dev
libmp3lame-dev
wget http://ffmpeg.org/releases/ffmpeg-2.4.2.tar.bz2
tar -xvf ffmpeg-2.4.2.tar.bz2
#patch the source
cd ffmpeg-2.4.2/libavdevice/
wget
http://sourceforge.net/p/infamousplugins/code/ci/2c97af07ea6fb54eca55f6bcdd707a3ad60c0325/tree/test/ffmpeg-2.4.2-jack.patch?format=raw
mv ffmpeg-2.4.2-jack.patch?format=raw ffmpeg-2.4.2-jack.patch
patch < ffmpeg-2.4.2-jack.patch
#build ffmpeg
cd ..
./configure --enable-x11grab --enable-libvorbis --enable-libx264 --enable-indev=jack
--enable-libmp3lame
--enable-gpl
make
sudo make install
sudo ln -s /usr/local/bin/ffmpeg /usr/local/bin/ffmpeg_harvid
#record a screencast using the current screen
ffmpeg
-fflags +genpts+igndts -f x11grab -vsync 0 -r 30 -s 1440x900 -i :0
-vcodec h264 -f jack -ac 2 -r:a 48000 -i screencast -acodec pcm_s16le
-r:v 30 -vsync 2 -async 1 -map 0:0,1,0 -map 1:0 -preset ultrafast -qp 0
"thisisonlyatest.mkv"
#compress it for youtube
ffmpeg -i "thisisonlyatest.mkv" -acodec mp3 -ab 160000 -vcodec h264 "thisisonlyatest-final.mkv"
The nice thing is that ubuntu 14.04 and variants use avconv so installing an ffmpeg binary shouldn't get in the way of anything. Alternatively to that last command to record if you use kxstudio or the ppa's use the kxstudio scripts as falkTX described here.
I wrote the patch, but the solution really comes from a patch made by male last year. The patch was incorporated into the 12.04 ppas ffmpeg build, but I am running 14.04 so it no longer applied. Necessity is the mother of invention. And updates. So I just adapted the changes to ffmpeg 2.4.2 (the current release) and figured out how to make it work so that I could start making videos about my plugins. Anyway the patch should apply to any distro and hopefully this will open the floodgates for many beautiful, perfectly sync'd linux audio tutorials and demo videos.
2 comments:
Could you please explain exactly how the "-map" data...
-map 0:0,1,0 -map 1:0
...breaks down as far as keeping the audio in sync with the video?
Thanks.
Hrm. Sorry I don't know all the ins and outs of ffmpeg. I literally copied this from the example command given by the patches author.
The -map is to manually select which streams are being recorded. The documentation says the option syntax is
-map [-]input_file_id[:stream_specifier][,sync_file_id[:stream_specifier]] | [linklabel] (output)
So it looks like the first map is for input 0 which is the video, then : marks that you want the 0th stream in the video, after the comma is the sync file. I suspect this is the secret, you are using stream 0 and 1 for sync'ing which is the the audio and the video. I could be wrong about it though. The second -map call just says to record the audio stream 0.
Post a Comment