Linuxにおけるディスクトップの動画キャプチャpart2
ffmpegのオプションでH.264フォーマット変換できることが分かった。
これでディスクトップ動画のキャプチャのアウトプットを
直接H.264/AVCでできないだろうか?
できれば、zoomeへのアップロードがだいぶ楽になる。
ただし、H.264フォーマットだと編集ツールが少ないので後でこまるかも。
動画のキャプチャは
$ ffmpeg -f x11grab -s sxga -i :0.0 out.avi
でいけるようだ。出力ファイル形式や、解像度は各自の環境に合わせる必要がある。
マニュアルの抜粋
$ ffmpeg [[infile options][-i infile]]... {[outfile options] outfile}...
- f fmt
Force format.(動画キャプチャのとき)
- i filename
Input filename.(変換のとき)
- fs limit_size
Set the file size limit.(アップ用の動画を作る際の目安)
- s size
Set frame size. The format is wxh (ffserver default = 160x128, ffm-
peg default = same as source). The following abbreviations are
recognized:
sqcif 128x96
qcif 176x144
cif 352x288
4cif 704x576
qqvga 160x120
qvga 320x240
vga 640x480
svga 800x600
xga 1024x768
uxga 1600x1200
qxga 2048x1536
sxga 1280x1024
qsxga 2560x2048
hsxga 5120x4096
wvga 852x480
wxga 1366x768
wsxga 1600x1024
wuxga 1920x1200
woxga 2560x1600
wqsxga 3200x2048
wquxga 3840x2400
whsxga 6400x4096
whuxga 7680x4800
cga 320x200
ega 640x350
hd480 852x480
hd720 1280x720
hd1080 1920x1080
Set aspect ratio (4:3, 16:9 or 1.3333, 1.7777).
アップ動画を作るには3:4になるようにしておくと吉。
FFmpeg can grab the X11 display.
$ ffmpeg -f x11grab -s cif -i :0.0 /tmp/out.mpg
0.0 is display.screen number of your X11 server, same as the DISPLAY environment variable.
$ ffmpeg -f x11grab -s cif -i :0.0+10,20 /tmp/out.mpg
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 for the grabbing.
そのままでは下記エラーが出たので必要そうなライブラリをyumでインストール
Unknown input or output format: x11grab
xvicapの方が用途に合っている気がしてきた。
xvidcap [-v] [ --mf | --sf ] [--file file name pattern |- ] [--fps frames per second] [--cap_geometry geometry]
[--rescale size percentage] [--quality quality percentage] [--source x11|shm ] [--time maximum duration in
seconds] [--frames maximum frames] [--start_no initial frame number] [--continue yes|no ] [--gui yes|no ]
[--auto] [--codec video codec] [--codec-help] [--format output file format] [--format-help] [--audio yes|no ]
[--aucodec audio codec] [--aucodec-help] [--audio_in audio capture device |- ] [--audio_bits audio bit rate]
[--audio_rate audio sample rate] [--audio_channels audio channels]
$ xvidcap
参考URL
http://ffmpeg.mplayerhq.hu/
http://www.komoto.org/etc/h264.html
http://peace-pact-2007.blogspot.com/2007/08/blog-post_7370.html
http://www.jp.netbsd.org/ja/JP/Documentation/Packages/list/x11/xvidcap/README.html
http://www.ne.jp/asahi/azure/ghost/t2/diary/dia200601.html