Skip to content

Instantly share code, notes, and snippets.

@johnbender
Created July 27, 2012 18:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save johnbender/238d9905bfc0e0c9d6e6 to your computer and use it in GitHub Desktop.
Save johnbender/238d9905bfc0e0c9d6e6 to your computer and use it in GitHub Desktop.
OUTRES="1280x720"
FPS="15"
QUAL="superfast"
STREAM_KEY="$1"
ffmpeg \
-f alsa -ac 2 -i pulse \
-f x11grab -s 1680x1050 -r "$FPS" -i :0.0+0,0 -aspect 16:10 \
-vf "movie=/dev/video0:f=video4linux2, setpts=N/($FPS*TB), scale=300:-1 [movie]; [in][movie] overlay=main_w-overlay_w:0 [out]" \
-vcodec libx264 -vpre "$QUAL" -s "$OUTRES" \
-acodec libmp3lame -ab 128k -ar 22050 \
-threads 4 \
~/foo.mp4
ffmpeg version 0.7.6-4:0.7.6-0ubuntu0.11.10.1, Copyright (c) 2000-2011 the Libav developers
built on Jun 12 2012 16:44:09 with gcc 4.6.1
configuration: --extra-version='4:0.7.6-0ubuntu0.11.10.1' --arch=amd64 --prefix=/usr --enable-vdpau --enable-bzlib --enable-libgsm --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libvorbis --enable-pthreads --enable-zlib --enable-libvpx --enable-runtime-cpudetect --enable-vaapi --enable-gpl --enable-postproc --enable-swscale --enable-x11grab --enable-libdc1394 --enable-shared --disable-static
WARNING: library configuration mismatch
avutil configuration: --extra-version='4:0.7.6ubuntu0.11.10.1' --arch=amd64 --prefix=/usr --enable-vdpau --enable-bzlib --enable-libgsm --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libvorbis --enable-pthreads --enable-zlib --enable-libvpx --enable-runtime-cpudetect --enable-vaapi --enable-libopenjpeg --enable-gpl --enable-postproc --enable-swscale --enable-x11grab --enable-libdirac --enable-libmp3lame --enable-librtmp --enable-libx264 --enable-libxvid --enable-libvo-aacenc --enable-version3 --enable-libvo-amrwbenc --enable-version3 --enable-libdc1394 --enable-shared --disable-static
avcodec configuration: --extra-version='4:0.7.6ubuntu0.11.10.1' --arch=amd64 --prefix=/usr --enable-vdpau --enable-bzlib --enable-libgsm --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libvorbis --enable-pthreads --enable-zlib --enable-libvpx --enable-runtime-cpudetect --enable-vaapi --enable-libopenjpeg --enable-gpl --enable-postproc --enable-swscale --enable-x11grab --enable-libdirac --enable-libmp3lame --enable-librtmp --enable-libx264 --enable-libxvid --enable-libvo-aacenc --enable-version3 --enable-libvo-amrwbenc --enable-version3 --enable-libdc1394 --enable-shared --disable-static
libavutil 51. 7. 0 / 51. 7. 0
libavcodec 53. 6. 0 / 53. 6. 0
libavformat 53. 3. 0 / 53. 3. 0
libavdevice 53. 0. 0 / 53. 0. 0
libavfilter 2. 4. 0 / 2. 4. 0
libswscale 2. 0. 0 / 2. 0. 0
libpostproc 52. 0. 0 / 52. 0. 0
[alsa @ 0xb55560] capture with some ALSA plugins, especially dsnoop, may hang.
[alsa @ 0xb55560] Estimating duration from bitrate, this may be inaccurate
Input #0, alsa, from 'pulse':
Duration: N/A, start: 1343412077.826288, bitrate: N/A
Stream #0.0: Audio: pcm_s16le, 48000 Hz, 2 channels, s16, 1536 kb/s
[x11grab @ 0xb4e820] device: :0.0+0,0 -> display: :0.0 x: 0 y: 0 width: 1680 height: 1050
[x11grab @ 0xb4e820] shared memory extension found
[x11grab @ 0xb4e820] Estimating duration from bitrate, this may be inaccurate
Input #1, x11grab, from ':0.0+0,0':
Duration: N/A, start: 1343412077.911558, bitrate: 846720 kb/s
Stream #1.0: Video: rawvideo, bgra, 1680x1050, 846720 kb/s, 15 tbr, 1000k tbn, 15 tbc
File '/home/nickel/foo.mp4' already exists. Overwrite ? [y/N] y
Incompatible pixel format 'bgra' for codec 'libx264', auto-selecting format 'yuv420p'
[buffer @ 0xb7ffe0] w:1680 h:1050 pixfmt:bgra
[video4linux2 @ 0xb885c0] Estimating duration from bitrate, this may be inaccurate
[movie @ 0xb81c80] seek_point:0 format_name:video4linux2 file_name:/dev/video0 stream_index:0
[scale @ 0xb81220] w:1680 h:1050 fmt:bgra -> w:1280 h:720 fmt:yuv420p flags:0x4
[movie @ 0xb81c80] TB:0.000001
[scale @ 0xb89bc0] w:1280 h:720 fmt:yuyv422 -> w:300 h:169 fmt:yuva420p flags:0x4
[overlay @ 0xb8ad40] main w:1280 h:720 fmt:yuv420p overlay x:980 y:0 w:300 h:169 fmt:yuva420p
[overlay @ 0xb8ad40] main_tb:1/1000000 overlay_tb:1/1000000 -> tb:1/1000000 exact:1
[libx264 @ 0xb567c0] using SAR=9/10
[libx264 @ 0xb567c0] using cpu capabilities: MMX2 SSE2Fast SSSE3 FastShuffle SSE4.2 AVX
[libx264 @ 0xb567c0] profile High, level 3.1
[libx264 @ 0xb567c0] 264 - core 116 r2042 178455c - H.264/MPEG-4 AVC codec - Copyleft 2003-2011 - http://www.videolan.org/x264.html - options: cabac=1 ref=1 deblock=1:0:0 analyse=0x3:0x3 me=dia subme=1 psy=1 psy_rd=1.00:0.00 mixed_ref=0 me_range=16 chroma_me=1 trellis=0 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=0 threads=4 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=0 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc=abr mbtree=0 bitrate=200 ratetol=1.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.41 pb_ratio=1.25 aq=1:1.00
Output #0, mp4, to '/home/nickel/foo.mp4':
Metadata:
encoder : Lavf53.3.0
Stream #0.0: Video: libx264, yuv420p, 1280x720 [PAR 9:10 DAR 8:5], q=0-69, 200 kb/s, 15 tbn, 15 tbc
Stream #0.1: Audio: libmp3lame, 22050 Hz, 2 channels, s16, 128 kb/s
Stream mapping:
Stream #1.0 -> #0.0
Stream #0.0 -> #0.1
Press ctrl-c to stop encoding
^Cframe= 272 fps= 20 q=-1.0 Lsize= 781kB time=17.35 bitrate= 368.9kbits/s dup=174 drop=0
video:499kB audio:271kB global headers:0kB muxing overhead 1.376914%
frame I:2 Avg QP:30.09 size: 98165
[libx264 @ 0xb567c0] frame P:78 Avg QP:29.20 size: 3726
[libx264 @ 0xb567c0] frame B:192 Avg QP:28.95 size: 123
[libx264 @ 0xb567c0] consecutive B-frames: 5.9% 0.0% 0.0% 94.1%
[libx264 @ 0xb567c0] mb I I16..4: 63.1% 12.8% 24.1%
[libx264 @ 0xb567c0] mb P I16..4: 3.4% 0.2% 0.1% P16..4: 9.0% 0.0% 0.0% 0.0% 0.0% skip:87.4%
[libx264 @ 0xb567c0] mb B I16..4: 0.0% 0.0% 0.0% B16..8: 0.6% 0.0% 0.0% direct: 0.4% skip:98.9% L0:54.2% L1:43.4% BI: 2.4%
[libx264 @ 0xb567c0] final ratefactor: 37.96
[libx264 @ 0xb567c0] 8x8 transform intra:7.8% inter:13.7%
[libx264 @ 0xb567c0] coded y,uvDC,uvAC intra: 34.2% 23.9% 21.3% inter: 1.2% 1.2% 0.4%
[libx264 @ 0xb567c0] i16 v,h,dc,p: 77% 20% 3% 1%
[libx264 @ 0xb567c0] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 18% 26% 21% 5% 5% 3% 4% 4% 13%
[libx264 @ 0xb567c0] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 30% 25% 13% 3% 9% 4% 4% 3% 9%
[libx264 @ 0xb567c0] i8c dc,h,v,p: 61% 28% 10% 1%
[libx264 @ 0xb567c0] kb/s:225.31
Received signal 2: terminating.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment