Results 1 to 10 of 246

Thread: HOWTO: Proper Screencasting on Linux

Threaded View

  1. #11
    Join Date
    Oct 2010
    Beans
    2
    Distro
    Ubuntu 10.10 Maverick Meerkat

    Re: HOWTO: Proper Screencasting on Linux

    Hi,

    I have tried to do some recordings using this method, and everything works for me with the exception that audio and video are out of sync. This was a bitter disappointment for me, because other than the audio/video sync problem, I found ffmpeg/x11grab to be far superior to any other screencasting software on linux.

    The audio seems to be delayed about 1 second or so, here is an example video: http://www.youtube.com/watch?v=1-dIQrZ_EPg
    (The click sound is actually played at the same time when "Click" is echoed in the console.)

    This is what the console said after entering the command:
    Code:
    jacob@ubuntu:~/Desktop$ ffmpeg -f alsa -ac 2 -i pulse -f x11grab -r 25 -s 800x600 -i :0.0 -acodec pcm_s16le -vcodec libx264 -vpre lossless_ultrafast -threads 0 video.mkv
    FFmpeg version 0.6.1, Copyright (c) 2000-2010 the FFmpeg developers
      built on Oct 19 2010 21:18:26 with gcc 4.4.5
      configuration: --enable-gpl --enable-version3 --enable-nonfree --enable-postproc --enable-libfaac --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxvid --enable-x11grab --enable-pthreads
      libavutil     50.15. 1 / 50.15. 1
      libavcodec    52.72. 2 / 52.72. 2
      libavformat   52.64. 2 / 52.64. 2
      libavdevice   52. 2. 0 / 52. 2. 0
      libswscale     0.11. 0 /  0.11. 0
      libpostproc   51. 2. 0 / 51. 2. 0
    [alsa @ 0x2868420]capture with some ALSA plugins, especially dsnoop, may hang.
    [alsa @ 0x2868420]Estimating duration from bitrate, this may be inaccurate
    Input #0, alsa, from 'pulse':
      Duration: N/A, start: 1287516545.387204, bitrate: N/A
        Stream #0.0: Audio: pcm_s16le, 44100 Hz, 2 channels, s16, 1411 kb/s
    [x11grab @ 0x2887fc0]device: :0.0 -> display: :0.0 x: 0 y: 0 width: 800 height: 600
    [x11grab @ 0x2887fc0]shared memory extension  found
    [x11grab @ 0x2887fc0]Estimating duration from bitrate, this may be inaccurate
    Input #1, x11grab, from ':0.0':
      Duration: N/A, start: 1287516545.801613, bitrate: 384000 kb/s
        Stream #1.0: Video: rawvideo, bgra, 800x600, 384000 kb/s, 25 tbr, 1000k tbn, 25 tbc
    [libx264 @ 0x2897430]using cpu capabilities: MMX2 SSE2Fast FastShuffle SSEMisalign LZCNT
    [libx264 @ 0x2897430]profile High 4:4:4 Predictive, level 3.1, bit depth 8
    [libx264 @ 0x2897430]64 - core 107 r1745 4785e8e - H.264/MPEG-4 AVC codec - Copyleft 2003-2010 - http://www.videolan.org/x264.html - options: cabac=0 ref=1 deblock=1:0:0 analyse=0x1:0 me=dia subme=0 psy=0 mixed_ref=0 me_range=16 chroma_me=1 trellis=0 8x8dct=0 cqm=0 deadzone=21,11 fast_pskip=0 chroma_qp_offset=0 threads=6 sliced_threads=0 nr=0 decimate=1 interlaced=0 constrained_intra=0 bframes=0 weightp=0 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc=cqp mbtree=0 qp=0
    Output #0, matroska, to 'video.mkv':
      Metadata:
        encoder         : Lavf52.64.2
        Stream #0.0: Video: libx264, yuv420p, 800x600, q=10-51, 200 kb/s, 1k tbn, 25 tbc
        Stream #0.1: Audio: pcm_s16le, 44100 Hz, 2 channels, s16, 1411 kb/s
    Stream mapping:
      Stream #1.0 -> #0.0
      Stream #0.0 -> #0.1
    Press [q] to stop encoding
    frame=  670 fps= 25 q=0.0 Lsize=    6433kB time=26.52 bitrate=1987.0kbits/s    
    video:1828kB audio:4569kB global headers:0kB muxing overhead 0.564713%
    [libx264 @ 0x2897430]frame I:3     Avg QP: 0.00  size:304422
    [libx264 @ 0x2897430]frame P:667   Avg QP: 0.00  size:  1437
    [libx264 @ 0x2897430]mb I  I16..4: 42.2%  0.0% 57.8%
    [libx264 @ 0x2897430]mb P  I16..4:  0.4%  0.0%  0.0%  P16..4:  0.1%  0.0%  0.0%  0.0%  0.0%    skip:99.5%
    [libx264 @ 0x2897430]coded y,uvDC,uvAC intra: 87.2% 86.2% 85.9% inter: 0.1% 0.1% 0.1%
    [libx264 @ 0x2897430]i16 v,h,dc,p: 41% 25% 32%  2%
    [libx264 @ 0x2897430]i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 30% 26% 16%  5%  4%  3%  4%  4%  8%
    [libx264 @ 0x2897430]i8c dc,h,v,p: 28% 15% 54%  3%
    [libx264 @ 0x2897430]kb/s:558.68
    jacob@ubuntu:~/Desktop$
    I had the idea to add -itsoffset 1 to the first command in "Step 1" of the first post, which at first seemed to work, as the output file had synchronous audio and video:
    Code:
    ffmpeg -f alsa -ac 2 -i pulse -itsoffset 1 -f x11grab -r 25 -s 800x600 -i :0.0 -acodec pcm_s16le -vcodec libx264 -vpre lossless_ultrafast -threads 0 video.mkv
    However, when I tried to encode the lossless video file using the first command in "Step 2" of the first post, the audio delay was present again in the encoded video file.
    Even when I added -itsoffset 1 to the command for the encoding, the delay was still there, as if the itsoffset option would not have changed anything:
    Code:
    ffmpeg -i video.mkv -acodec libfaac -ab 128k -ac 2 -itsoffset 1 -vcodec libx264 -vpre slow -crf 22 -threads 0 video-final.mp4
    I don't understand why the itsoffset option did not work for the encoding. Did I use it in the wrong way? But even if did, the itsoffset should have had a permanent effect on the recording and therefore the offset should stay intact while reencoding, shouldn't it?

    I tried several other things, but none of them worked:
    • I compiled ffmpeg with and without pthreads
    • I disabled compiz
    • I ran the encoding and recording with -threads 1 and -threads 0
    • I tried to use -async and -vsync, but I suppose they are meant for a completely different matter, right?
    • I tried hw:0,0 and /dev/dsp instead of pulse


    Edit: By the way, converting regular video files works trouble-free with ffmpeg, so it's not a general issue with my ffmpeg installation.

    I use Ubuntu 10.10 64bit.

    I'd be deeply grateful if someone could help me with that... I am despairing.

    Thanks a lot!
    Last edited by user1220; October 19th, 2010 at 11:59 PM.

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •