Page 11 of 25 FirstFirst ... 91011121321 ... LastLast
Results 101 to 110 of 246

Thread: HOWTO: Proper Screencasting on Linux

  1. #101
    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.

  2. #102
    Join Date
    Sep 2006
    Beans
    548

    Re: HOWTO: Proper Screencasting on Linux

    What happens if you rearrange your capture command slightly? Is it in sync this way?

    Code:
    ffmpeg -f alsa -ac 2 -i pulse -acodec pcm_s16le -f x11grab -r 25 -s 800x600 -i :0.0 -vcodec libx264 -vpre lossless_ultrafast -threads 0 video.mkv

  3. #103
    Join Date
    Sep 2006
    Beans
    3,480

    Re: HOWTO: Proper Screencasting on Linux

    The ugly mouse cursor issue has been fixed by FFmpeg revision 25690: Make x11grab cursor drawing suck less.

  4. #104
    Join Date
    Jul 2009
    Location
    CyberspacEastEngland
    Beans
    Hidden!
    Distro
    Ubuntu 14.04 Trusty Tahr

    Re: HOWTO: Proper Screencasting on Linux

    hi there


    wonder if this can be done


    i want to record myself TO DO a rosegarden presentation


    so i need to record microphone and also music coming out of desktop


    basically all sound


    now

    this here

    Q: How can I control PulseAudio input? (e.g. capture application audio instead of mic)
    A: Install “pavucontrol“. Start recording with ffmpeg. Start pavucontrol. Go to the “Recording” tab and you’ll find ffmpeg listed there. Change audio capture from “Internal Audio Analog Stereo” to “Monitor of Internal Audio Analog Stereo“.
    Now it should record system and application audio instead of microphone.

    This setting will be remembered. The next time you want to capture with FFmpeg, it will automatically start recording system audio. If you want to revert this, use pavucontrol again to change back to microphone input.


    does not say how to record all sound sources at once only one or the other



    can this be done?


    ps and compounded problem i use a lexicon alpha box and it does not allow for the options listed here

    can I control PulseAudio input? (e.g. capture application audio instead of mic)
    A: Install “pavucontrol“. Start recording with ffmpeg. Start pavucontrol. Go to the “Recording” tab and you’ll find ffmpeg listed there. Change audio capture from “Internal Audio Analog Stereo” to “Monitor of Internal Audio Analog Stereo“.
    Now it should record system and application audio instead of microphone.
    SEE IMAGE



    thank you shan
    Attached Images Attached Images
    • File Type: png 1.png (42.8 KB, 11 views)
    Last edited by shantiq; November 16th, 2010 at 11:05 AM.
    Linux is Latin for off-the-beaten-track [◄►] ● Is there Voodoo in the machine?
    ShanArt ● Mark as SolvedXmms

  5. #105
    Join Date
    May 2009
    Beans
    3

    Re: HOWTO: Proper Screencasting on Linux

    I'm not user1220 but I do have this same problem that my audio is out of sync by a little over a second and I can say no, rearranging the command to put the -acodec earlier does not help, what I have to do to fix the offset in the second step is to do

    Code:
    ffmpeg -i video.mkv -itsoffset 2.00 -i video.mkv -map 1:0 -map 0:1 -acodec libfaac -threads 0 -ab 128k -ac 2 -vcodec libx264 -vpre slow -threads 0 video.mp4
    To use -map you need to specify the input twice, once (in my case) two seconds offset.

  6. #106
    Join Date
    May 2008
    Beans
    3

    Re: HOWTO: Proper Screencasting on Linux

    I love this tutorial!

    I do notice, though, when I record a screencast, that my fps shown in the terminal window is very low, usually around 3 fps.

    What can I do to make it faster?

    Thanks!

  7. #107
    Join Date
    Oct 2007
    Beans
    5

    Re: HOWTO: Proper Screencasting on Linux

    Here is a small shell script that wraps around the first example provided in the tutorial. To use it, save it and make it executable. Either invoke it from the command line or double-click and run it. It will prompt you for the file to save, and then ask you to select a window with your mouse, which will set the region of the screen to capture.

    Code:
    #!/bin/sh
    
    if [ -z "$1" ]; then
       file="$(zenity --title="Select an output file" --file-selection --filename=screencast.mkv --save --confirm-overwrite --file-filter=mkv)"
    else
       file="$1"
    fi
    rm -f "$file"
    
    echo "Select the window to capture"
    
    region="$(xwininfo | awk "
       /Absolute upper-left X/{ulx=\$4}
       /Absolute upper-left Y/{uly=\$4}
       /Width/{w=\$2}
       /Height/{h=\$2}
       END {
          printf \"-s %dx%d -i ${DISPLAY}+%d,%d\", 2*sprintf(\"%d\", w/2), 2*sprintf(\"%d\", h/2), ulx, uly
       }")"
    
    echo "Will record region $region"
    read -p "Press Enter to begin"
    
    set -x
    ffmpeg -f alsa -ac 1 -i pulse -f x11grab -r 30 $region \
       -acodec pcm_s16le -vcodec libx264 -vpre lossless_ultrafast -threads 0 "$file"

  8. #108
    Join Date
    Mar 2011
    Beans
    1

    Question Re: HOWTO: Proper Screencasting on Linux

    Is it possible to use ffmpeg to push output to a media server or setup a live streaming video feed of the X11 session?
    Last edited by jddalton; March 17th, 2011 at 09:22 AM. Reason: fix typo

  9. #109
    Join Date
    Mar 2011
    Beans
    13

    Re: HOWTO: Proper Screencasting on Linux

    thank you that works great it is simply smooth love this tutorial

  10. #110
    Join Date
    Mar 2007
    Beans
    Hidden!

    Re: HOWTO: Proper Screencasting on Linux

    Someone is working on a python GUI application for screencasting with ffmpeg+x264:
    https://code.launchpad.net/kazam
    Freedom is neither exclusive nor unlimited.

Page 11 of 25 FirstFirst ... 91011121321 ... LastLast

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
  •