Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I'm going to crop some desktop regions and overlay them on the scene.

avconv -f x11grab -s:v 100x100 -r 30 -i :0.0+10:10 
-f x11grab -s:v 100x100 -r 30 -i :0.0+200:200 
-f alsa -ac 2 -i pulse  
-c:a libvo_aacenc -b:a 96k -ar 44100 -ac 2 
-vf "color=black@0.8:1366x768:30, setpts=PTS-STARTPTS [BLACK];
    movie=/dev/video0:f=video4linux2, vflip, scale=240:-1, setpts=PTS-STARTPTS[CAM];
    [BLACK][in] overlay=0:0 [BLACK+in];
    [BLACK+in][CAM] overlay=1000:10 [out]" 
-c:v libx264 -preset veryfast -crf 22 -b:v 512k -bufsize 3000k -threads 0 
-f avi -y ScrVideo.avi

But it doesn't work and i don't know how to separate "Input #0" and "Input #1" in filter. Docs are very strange and everywhere only "[in]->[out]" scheme has been used. The result is black scene with camera. I tried to sprit the whole desktop (1366x768) on 2 pads inside the filter and crop regions there but it doesnt work too.

avconv version 0.8.10-4:0.8.10-0ubuntu0.12.04.1, Copyright (c) 2000-2013 the Libav developers
  built on Feb  6 2014 20:59:08 with gcc 4.6.3
[x11grab @ 0x9ce43c0] device: :0.0+10:10 -> display: :0.0 x: 10 y: 0 width: 100 height: 100
[x11grab @ 0x9ce43c0] shared memory extension  found
[x11grab @ 0x9ce43c0] Estimating duration from bitrate, this may be inaccurate
Input #0, x11grab, from ':0.0+10:10':
  Duration: N/A, start: 1396538114.117124, bitrate: 9600 kb/s
    Stream #0.0: Video: rawvideo, bgra, 100x100, 9600 kb/s, 30 tbr, 1000k tbn, 30 tbc
[x11grab @ 0x9cf3860] device: :0.0+200:200 -> display: :0.0 x: 200 y: 0 width: 100 height: 100
[x11grab @ 0x9cf3860] shared memory extension  found
[x11grab @ 0x9cf3860] Estimating duration from bitrate, this may be inaccurate
Input #1, x11grab, from ':0.0+200:200':
  Duration: N/A, start: 1396538114.154109, bitrate: 9600 kb/s
    Stream #1.0: Video: rawvideo, bgra, 100x100, 9600 kb/s, 30 tbr, 1000k tbn, 30 tbc
[alsa @ 0x9d0ce40] capture with some ALSA plugins, especially dsnoop, may hang.
[alsa @ 0x9d0ce40] Estimating duration from bitrate, this may be inaccurate                                                           
Input #2, alsa, from 'pulse':
  Duration: N/A, start: 1396538113.995116, bitrate: N/A
    Stream #2.0: Audio: pcm_s16le, 48000 Hz, 2 channels, s16, 1536 kb/s
Incompatible pixel format 'bgra' for codec 'libx264', auto-selecting format 'yuv420p'
[buffer @ 0x9d2ca00] w:100 h:100 pixfmt:bgra
[video4linux2 @ 0x9d21660] Estimating duration from bitrate, this may be inaccurate
[movie @ 0x9d21320] seek_point:0 format_name:video4linux2 file_name:/dev/video0 stream_index:0
[overlay @ 0x9d2dae0] auto-inserting filter 'auto-inserted scaler 0' between the filter 'src' and the filter 'Parsed filter 6 overlay'
[color @ 0x9d0fd00] w:1366 h:768 r:30/1 color:0x108080cc[yuva]
[color @ 0x9d0fd00] TB:0.033333
[scale @ 0x9d2ec60] w:100 h:100 fmt:bgra -> w:100 h:100 fmt:yuva420p flags:0x4
[overlay @ 0x9d2dae0] main w:1366 h:768 fmt:yuv420p overlay x:0 y:0 w:100 h:100 fmt:yuva420p
[overlay @ 0x9d2dae0] main_tb:1/30 overlay_tb:1/1000000 -> tb:1/3000000 exact:1
[scale @ 0x9d22260] w:640 h:480 fmt:yuyv422 -> w:240 h:180 fmt:yuva420p flags:0x4
[scale @ 0x9d22260] TB:0.000001
[overlay @ 0x9d21200] main w:1366 h:768 fmt:yuv420p overlay x:1000 y:10 w:240 h:180 fmt:yuva420p
[overlay @ 0x9d21200] main_tb:1/3000000 overlay_tb:1/1000000 -> tb:1/3000000 exact:1
[libx264 @ 0x9d0ee20] VBV bufsize set but maxrate unspecified, ignored
[libx264 @ 0x9d0ee20] using SAR=1/1
[libx264 @ 0x9d0ee20] using cpu capabilities: MMX2 SSE2Fast SSSE3 FastShuffle Cache64
[libx264 @ 0x9d0ee20] profile Main, level 3.2
Output #0, avi, to 'ScrVideo.avi':
  Metadata:
    ISFT            : Lavf53.21.1
    Stream #0.0: Video: libx264, yuv420p, 1366x768 [PAR 1:1 DAR 683:384], q=-1--1, 512 kb/s, 30 tbn, 30 tbc
    Stream #0.1: Audio: libvo_aacenc, 44100 Hz, 2 channels, s16, 96 kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (rawvideo -> libx264)
  Stream #2:0 -> #0:1 (pcm_s16le -> libvo_aacenc)
Press ctrl-c to stop encoding
frame=  219 fps= 31 q=-1.0 Lsize=     179kB time=6.34 bitrate= 231.3kbits/s
share|improve this question
    
It's hard to say, since i don't understand what doesn't work (you just say "doesn't work"). But you should probably use -filter_complex rather than -vf, and then you can stop using movie filter, which was a hack. –  Volodya Nov 10 at 9:19

1 Answer 1

After all I thrown out avconv and used actual version of ffmpeg from official site. There is a normal implementation of complex filters. Doesn't work means avconv crashing when i used such filters, more simple filters are not doing the job. The story was in April, mb now it's fixed but i'm not going to deal with avconv.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.