Results 1 to 10 of 10

Thread: ffmpeg screen capture

Hybrid View

  1. #1
    Join Date
    Sep 2008
    Beans
    529
    Distro
    Ubuntu 12.04 Precise Pangolin

    ffmpeg screen capture

    I am using the following command to capture video being played in my browser.

    ffmpeg -f x11grab -s 768x576 -r 30 -i :0.0+300,150 ~/output.mpg -ab 64k

    I can capture the video but there are two problems
    * Video quality is too poor how can i improve it ?
    * Sound is not being recorded, perhaps i have not mentioned the sound capture device. But i do not have much idea abt it.

    Can any one plz help me with this ?

    .

  2. #2
    Join Date
    Feb 2008
    Location
    In my skin.
    Beans
    Hidden!
    Distro
    Xubuntu

  3. #3
    Join Date
    Sep 2008
    Beans
    529
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: ffmpeg screen capture

    Any solution ?

  4. #4
    Join Date
    Sep 2006
    Beans
    3,513

    Re: ffmpeg screen capture


  5. #5
    Join Date
    Sep 2008
    Beans
    529
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: ffmpeg screen capture

    Quote Originally Posted by FakeOutdoorsman View Post
    Thats a wonderful thread ! Things are mentioned in great details. But when i use the following code :

    ffmpeg -f alsa -ac 2 -i pulse -f x11grab -r 30 -s 618x474 -i :0.0+450,134 -acodec pcm_s16le -vcodec libx264 -preset ultrafast -crf 0 -threads 0 output.mkv

    I get the following error :

    [matroska @ 0x8309ba0] Application provided invalid, non monotonically increasing dts to muxer in stream 1: 1 >= 1
    av_interleaved_write_frame(): Invalid argument


    With this command :

    ffmpeg -f alsa -i hw:0,0 -f x11grab -r 30 -s 1024x768 -i :0.0 -vcodec libx264 -preset ultrafast -crf 0 -an -y output.mkv -acodec pcm_s16le -y output.wav

    I get this error :

    ffmpeg version 0.8.3-4:0.8.3-0ubuntu0.12.04.1, Copyright (c) 2000-2012 the Libav developers
    built on Jun 12 2012 16:37:58 with gcc 4.6.3
    *** THIS PROGRAM IS DEPRECATED ***
    This program is only provided for compatibility and will be removed in a future release. Please use avconv instead.
    [alsa @ 0x87f6240] Estimating duration from bitrate, this may be inaccurate
    Input #0, alsa, from 'hw:0,0':
    Duration: N/A, start: 35358.999152, bitrate: N/A
    Stream #0.0: Audio: pcm_s16le, 48000 Hz, 2 channels, s16, 1536 kb/s
    [x11grab @ 0x8806740] device: :0.0 -> display: :0.0 x: 0 y: 0 width: 1024 height: 768
    [x11grab @ 0x8806740] shared memory extension found
    [x11grab @ 0x8806740] Estimating duration from bitrate, this may be inaccurate
    Input #1, x11grab, from ':0.0':
    Duration: N/A, start: 1349473809.635993, bitrate: 754974 kb/s
    Stream #1.0: Video: rawvideo, bgra, 1024x768, 754974 kb/s, 30 tbr, 1000k tbn, 30 tbc
    Output #1, wav, to 'output.wav':
    Output file #1 does not contain any stream


    Moreover if i only use ffmpeg -f alsa -i hw:0,0 -acodec pcm_s16le -y output.wav command it captures sound from the ic and not the application / speaker sound. How do i change over to it ?

    As mentioned earlier i can always record the video by ffmpeg -f x11grab -s 768x576 -r 30 -i :0.0+300,150 ~/output.mpg command.

    Can you kindly tell me what is going wrong ?

    This command is working
    ffmpeg -f alsa -i hw:0,0 -acodec pcm_s16le -f x11grab -s 320x240 -r 30 -i :0.0 ~/out3.mpg
    but the video quality is too poor (i would like to record a lossless video) and the sound is being captured from the mic and not from the speaker / application. And with this command ffmpeg -f alsa -i hw:0,0 -acodec pcm_s16le -f x11grab -r 30 -s 618x474 -i :0.0+350,134 ~/out4.m4v the video quality is good, but the sound is not sync with the video and again the sound is captured from the mic.

    .
    Last edited by 3dmatrix; October 5th, 2012 at 11:56 PM.

  6. #6
    Join Date
    Sep 2006
    Beans
    3,513

    Re: ffmpeg screen capture

    Quote Originally Posted by 3dmatrix View Post
    Thats a wonderful thread ! Things are mentioned in great details. But when i use the following code :

    Code:
    ffmpeg -f alsa -ac 2 -i pulse -f x11grab -r 30 -s 618x474 -i :0.0+450,134 -acodec pcm_s16le -vcodec libx264 -preset ultrafast -crf 0 -threads 0 output.mkv
    I get the following error :

    Code:
    [matroska @ 0x8309ba0] Application provided invalid, non monotonically increasing dts to muxer in stream 1: 1 >= 1
    av_interleaved_write_frame(): Invalid argument
    The guide was written for FFmpeg. Ubuntu no longer uses FFmpeg, but supplies a "fake" ffmpeg package from a fork called libav. It may work as expected with the real ffmpeg (it works for me). You can either compile it as shown here: How To Compile FFmpeg and x264 on Ubuntu, or perhaps use Jon Severinsson's FFmpeg PPA. I recommend compiling since the PPA will not provide the latest FFmpeg code.

    Quote Originally Posted by 3dmatrix View Post
    Moreover if i only use ffmpeg -f alsa -i hw:0,0 -acodec pcm_s16le -y output.wav command it captures sound from the ic and not the application / speaker sound. How do i change over to it ?
    See Capturing audio with FFmpeg and ALSA, or if you use pulse instead of alsa see the FAQ in the screencast guide.

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
  •