Page 1 of 2 12 LastLast
Results 1 to 10 of 16

Thread: record my desktop using ffmpeg

  1. #1
    gymnart's Avatar
    gymnart is offline Busy Penguin
    Join Date
    Aug 2008
    Posts
    392

    Default record my desktop using ffmpeg

    I just tried an experiment with the command:
    Code:
    ffmpeg -f alsa -ac 2 -i pulse -f x11grab -r 15 -s 1280x1024 -i :0.0 -acodec pcm_s16le -vcodec libx264 -preset ultrafast -threads 0 sillyexp.avi
    But it didn't work. I know I must have not done something right. (I just copied and pasted the command from a post by oldcpu and then just changed the screensize in the command)
    I got this message when I started it:
    Code:
    FFmpeg version SVN-r201104161305, Copyright (c) 2000-2011 the FFmpeg developers
      built on Apr 16 2011 11:36:21 with gcc 4.5.1 20101208 [gcc-4_5-branch revision 167585]
      configuration: --shlibdir=/usr/lib64 --prefix=/usr --mandir=/usr/share/man --libdir=/usr/lib64 --enable-shared --enable-libmp3lame --enable-libvorbis --enable-libtheora --enable-libspeex --enable-libxvid --enable-postproc --enable-gpl --enable-x11grab --extra-cflags='-fmessage-length=0 -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables -g -fPIC -I/usr/include/gsm' --enable-debug --disable-stripping --enable-libgsm --enable-libschroedinger --enable-libdirac --enable-avfilter --enable-libvpx --enable-version3 --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libx264 --enable-libdc1394 --enable-pthreads --enable-librtmp
      libavutil    50. 40. 1 / 50. 40. 1
      libavcodec   52.119. 1 / 52.119. 1
      libavformat  52.108. 0 / 52.108. 0
      libavdevice  52.  4. 0 / 52.  4. 0
      libavfilter   1. 79. 0 /  1. 79. 0
      libswscale    0. 13. 0 /  0. 13. 0
      libpostproc  51.  2. 0 / 51.  2. 0
    [alsa @ 0x63f8b0] capture with some ALSA plugins, especially dsnoop, may hang.
    [alsa @ 0x63f8b0] Estimating duration from bitrate, this may be inaccurate
    Input #0, alsa, from 'pulse':
      Duration: N/A, start: 1327265270.733789, bitrate: N/A
        Stream #0.0: Audio: pcm_s16le, 44100 Hz, 2 channels, s16, 1411 kb/s
    [x11grab @ 0x640b50] device: :0.0 -> display: :0.0 x: 0 y: 0 width: 1280 height: 1024
    [x11grab @ 0x640b50] shared memory extension found
    [x11grab @ 0x640b50] Estimating duration from bitrate, this may be inaccurate
    Input #1, x11grab, from ':0.0':
      Duration: N/A, start: 1327265270.819803, bitrate: 629145 kb/s
        Stream #1.0: Video: rawvideo, bgra, 1280x1024, 629145 kb/s, 15 tbr, 1000k tbn, 15 tbc
    Unrecognized option 'preset'
    I'm not sure what to do. I've even searched for a file with the name I gave it but found nothing.

  2. #2
    caf4926's Avatar
    caf4926 is offline Administrator
    Join Date
    Jun 2008
    Location
    The English Lake District. UK - GMT/BST
    Posts
    32,791
    Blog Entries
    11

    Default Re: record my desktop using ffmpeg

    Try this

    Code:
    ffmpeg -f x11grab -s `xdpyinfo | grep 'dimensions:'|awk '{print $2}'` -r 25 -i :0.0 -sameq output.mkv
    Box: 12.1 | KDE 4.8.2 | AMD 64 X2 5200+ | nVidia 8500GT | 4GB RAM
    Lap #1: 12.1 | Duo T4300 | KDE4.8.2 | Intel M4 Graphics | Lenovo G550 | 3GB RAM
    Lap#2: 12.1 | KDE 4.8.2 | Celeron 550 | Intel 965GM | Lenovo R61 | +EeePC | 12.1 | KDE T'Weed
    My_Guides

  3. #3
    oldcpu's Avatar
    oldcpu is online now Global Moderator
    Join Date
    Mar 2008
    Location
    Europe
    Posts
    23,565
    Blog Entries
    23

    Default Re: record my desktop using ffmpeg

    Quote Originally Posted by gymnart View Post
    I just tried an experiment with the command:
    Code:
    ffmpeg -f alsa -ac 2 -i pulse -f x11grab -r 15 -s 1280x1024 -i :0.0 -acodec pcm_s16le -vcodec libx264 -preset ultrafast -threads 0 sillyexp.avi
    But it didn't work. I know I must have not done something right. (I just copied and pasted the command from a post by oldcpu and then just changed the screensize in the command)
    I got this message when I started it:
    Code:
    FFmpeg version SVN-r201104161305, Copyright (c) 2000-2011 the FFmpeg developers
      built on Apr 16 2011 11:36:21 with gcc 4.5.1 20101208 [gcc-4_5-branch revision 167585]
      configuration: --shlibdir=/usr/lib64 --prefix=/usr --mandir=/usr/share/man --libdir=/usr/lib64 --enable-shared --enable-libmp3lame --enable-libvorbis --enable-libtheora --enable-libspeex --enable-libxvid --enable-postproc --enable-gpl --enable-x11grab --extra-cflags='-fmessage-length=0 -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables -g -fPIC -I/usr/include/gsm' --enable-debug --disable-stripping --enable-libgsm --enable-libschroedinger --enable-libdirac --enable-avfilter --enable-libvpx --enable-version3 --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libx264 --enable-libdc1394 --enable-pthreads --enable-librtmp
      libavutil    50. 40. 1 / 50. 40. 1
      libavcodec   52.119. 1 / 52.119. 1
      libavformat  52.108. 0 / 52.108. 0
      libavdevice  52.  4. 0 / 52.  4. 0
      libavfilter   1. 79. 0 /  1. 79. 0
      libswscale    0. 13. 0 /  0. 13. 0
      libpostproc  51.  2. 0 / 51.  2. 0
    [alsa @ 0x63f8b0] capture with some ALSA plugins, especially dsnoop, may hang.
    [alsa @ 0x63f8b0] Estimating duration from bitrate, this may be inaccurate
    Input #0, alsa, from 'pulse':
      Duration: N/A, start: 1327265270.733789, bitrate: N/A
        Stream #0.0: Audio: pcm_s16le, 44100 Hz, 2 channels, s16, 1411 kb/s
    [x11grab @ 0x640b50] device: :0.0 -> display: :0.0 x: 0 y: 0 width: 1280 height: 1024
    [x11grab @ 0x640b50] shared memory extension found
    [x11grab @ 0x640b50] Estimating duration from bitrate, this may be inaccurate
    Input #1, x11grab, from ':0.0':
      Duration: N/A, start: 1327265270.819803, bitrate: 629145 kb/s
        Stream #1.0: Video: rawvideo, bgra, 1280x1024, 629145 kb/s, 15 tbr, 1000k tbn, 15 tbc
    Unrecognized option 'preset'
    I'm not sure what to do. I've even searched for a file with the name I gave it but found nothing.
    I blogged about this here: Capturing video of one's desktop - Blogs - openSUSE Forums

    Note the error message 'Unrecognized option 'preset' ' ... that indicates ffmpeg does NOT like the option 'preset'

    The ffmpeg developers changed their ffmep version, or its possibly you are using an OLD ffmpeg version and need to use the OLD argument.

    I note my openSUSE-11.4 PC has this for the ffmpeg version:
    Code:
    ffmpeg version 0.9.1, Copyright (c) 2000-2012 the FFmpeg developers
      built on Jan  6 2012 11:01:08 with gcc 4.5.1 20101208 [gcc-4_5-branch revision 167585]
    while yours has this for the ffmpeg version:
    Code:
    FFmpeg version SVN-r201104161305, Copyright (c) 2000-2011 the FFmpeg developers
      built on Apr 16 2011 11:36:21 with gcc 4.5.1 20101208 [gcc-4_5-branch revision 167585]
    that makes me think you are not using the most current packman packager packaged ffmpeg version.

    The command line I originally used before the change was:
    Code:
    ffmpeg -f alsa -ac 2 -i hw:1,0 -f x11grab -r 15 -s 1280x1024 -i :0.0 -acodec pcm_s16le -vcodec libx264 -vpre lossless_ultrafast -threads 0 output.avi
    but the ffmpeg developers stopped using ' -vpre lossless_untrafast ' and instead with the latest ffmpeg used 'preset ultrafast ' which means this:
    Code:
    ffmpeg -f alsa -ac 2 -i pulse -f x11grab -r 15 -s 1280x1024 -i  :0.0 -acodec pcm_s16le -vcodec libx264 -preset ultrafast -threads  0 output.avi
    So try the ' -vpre lossless_ultrafast ' instead.

    Or better yet, UPDATE your ffmpeg version if you can do so without breaking other apps (such as winff .... )
    Last edited by oldcpu; 23-Jan-2012 at 23:07.

  4. #4
    gymnart's Avatar
    gymnart is offline Busy Penguin
    Join Date
    Aug 2008
    Posts
    392

    Default Re: record my desktop using ffmpeg

    @ caf4926: That worked! But, there was no sound.
    @ oldcpu: I'll read your blog. I just updated my ffmpeg package and it didn't break any packages. I used the packman repo.
    The command you gave
    Code:
    ffmpeg -f alsa -ac 2 -i pulse -f x11grab -r 15 -s 1280x1024 -i  :0.0 -acodec pcm_s16le -vcodec libx264 -preset ultrafast -threads  0 output.avi
    worked nicely and did have sound! Cooool!! Now I can record myself making 3D models. *does happy dance* Wanna see it when it's done?

  5. #5
    oldcpu's Avatar
    oldcpu is online now Global Moderator
    Join Date
    Mar 2008
    Location
    Europe
    Posts
    23,565
    Blog Entries
    23

    Default Re: record my desktop using ffmpeg

    Quote Originally Posted by gymnart View Post
    The command you gave ... worked nicely and did have sound! Cooool!!
    Good news.

    Its difficult to stay on top of ffmpeg as the developers change the interface fairly often.

    Quote Originally Posted by gymnart View Post
    Now I can record myself making 3D models. *does happy dance* Wanna see it when it's done?
    Sure

  6. #6
    caf4926's Avatar
    caf4926 is offline Administrator
    Join Date
    Jun 2008
    Location
    The English Lake District. UK - GMT/BST
    Posts
    32,791
    Blog Entries
    11

    Default Re: record my desktop using ffmpeg

    @oldcpu
    I see this with your code
    Code:
    ALSA lib pcm.c:2212:(snd_pcm_open_noupdate) Unknown PCM pulse
    [alsa @ 0x807d2e0] cannot open audio device pulse (No such file or directory)
    pulse: Input/output error
    Box: 12.1 | KDE 4.8.2 | AMD 64 X2 5200+ | nVidia 8500GT | 4GB RAM
    Lap #1: 12.1 | Duo T4300 | KDE4.8.2 | Intel M4 Graphics | Lenovo G550 | 3GB RAM
    Lap#2: 12.1 | KDE 4.8.2 | Celeron 550 | Intel 965GM | Lenovo R61 | +EeePC | 12.1 | KDE T'Weed
    My_Guides

  7. #7
    oldcpu's Avatar
    oldcpu is online now Global Moderator
    Join Date
    Mar 2008
    Location
    Europe
    Posts
    23,565
    Blog Entries
    23

    Default Re: record my desktop using ffmpeg

    Quote Originally Posted by caf4926 View Post
    @oldcpu
    I see this with your code
    Code:
    ALSA lib pcm.c:2212:(snd_pcm_open_noupdate) Unknown PCM pulse
    [alsa @ 0x807d2e0] cannot open audio device pulse (No such file or directory)
    pulse: Input/output error
    I don't get that error. ... It possibly means I have something installed that you don't ? But my ffmpeg install is pretty basic:
    Code:
    oldcpu@corei7:~> rpm -qa '*ffmpeg*'
    ffmpeg-0.9.1-1.1.x86_64
    chromium-ffmpeg-18.0.972.0-100.1.x86_64                                                                                                                                                 
    gstreamer-0_10-ffmpeg-0.10.11-1000.11.x86_64
    libffmpeg-devel-0.9.1-1.1.x86_64
    Here is what I get from the ffmpeg command:
    Code:
    oldcpu@corei7:~> ffmpeg -f alsa -ac 2 -i pulse -f x11grab -r 15 -s 1280x1024 -i  :0.0 -acodec pcm_s16le -vcodec libx264 -preset ultrafast -threads  0 output.avi
    ffmpeg version 0.9.1, Copyright (c) 2000-2012 the FFmpeg developers
      built on Jan  6 2012 11:01:08 with gcc 4.5.1 20101208 [gcc-4_5-branch revision 167585]
      configuration: --shlibdir=/usr/lib64 --prefix=/usr --mandir=/usr/share/man --libdir=/usr/lib64 --enable-shared --disable-static --enable-libmp3lame --enable-libvorbis --enable-libtheora --enable-libspeex --enable-libxvid --enable-postproc --enable-gpl --enable-x11grab --extra-cflags='-fmessage-length=0 -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables -g -fPIC -I/usr/include/gsm' --enable-debug --disable-stripping --enable-libgsm --enable-libschroedinger --enable-libdirac --enable-avfilter --enable-libvpx --enable-version3 --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libx264 --enable-libdc1394 --enable-pthreads --enable-librtmp
      libavutil    51. 32. 0 / 51. 32. 0
      libavcodec   53. 42. 4 / 53. 42. 4
      libavformat  53. 24. 2 / 53. 24. 2
      libavdevice  53.  4. 0 / 53.  4. 0
      libavfilter   2. 53. 0 /  2. 53. 0
      libswscale    2.  1. 0 /  2.  1. 0
      libpostproc  51.  2. 0 / 51.  2. 0
    [alsa @ 0x635a80] Estimating duration from bitrate, this may be inaccurate
    Input #0, alsa, from 'pulse':
      Duration: N/A, start: 1327385289.770833, bitrate: N/A
        Stream #0:0: Audio: pcm_s16le, 48000 Hz, 2 channels, s16, 1536 kb/s
    [x11grab @ 0x7fc758006c40] device: :0.0 -> display: :0.0 x: 0 y: 0 width: 1280 height: 1024
    [x11grab @ 0x7fc758006c40] shared memory extension found
    [x11grab @ 0x7fc758006c40] Estimating duration from bitrate, this may be inaccurate
    Input #1, x11grab, from ':0.0':                                                                                                                                                         
      Duration: N/A, start: 1327385289.861135, bitrate: 629145 kb/s
        Stream #1:0: Video: rawvideo (BGRA / 0x41524742), bgra, 1280x1024, 629145 kb/s, 15 tbr, 1000k tbn, 15 tbc
    Incompatible pixel format 'bgra' for codec 'libx264', auto-selecting format 'yuv420p'
    [buffer @ 0x7fc758014400] w:1280 h:1024 pixfmt:bgra tb:1/1000000 sar:0/1 sws_param:                                                                                                     
    [buffersink @ 0x7fc758015ea0] auto-inserting filter 'auto-inserted scale 0' between the filter 'src' and the filter 'out'
    [scale @ 0x7fc75802e1e0] w:1280 h:1024 fmt:bgra -> w:1280 h:1024 fmt:yuv420p flags:0x4
    [libx264 @ 0x7fc758014e20] using cpu capabilities: MMX2 SSE2Fast SSSE3 FastShuffle SSE4.2
    [libx264 @ 0x7fc758014e20] profile Constrained Baseline, level 3.2
    Output #0, avi, to 'output.avi':
      Metadata:
        ISFT            : Lavf53.24.2
        Stream #0:0: Video: h264 (H264 / 0x34363248), yuv420p, 1280x1024, q=-1--1, 15 tbn, 15 tbc
        Stream #0:1: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 48000 Hz, 2 channels, s16, 1536 kb/s
    Stream mapping:
      Stream #1:0 -> #0:0 (rawvideo -> libx264)
      Stream #0:0 -> #0:1 (pcm_s16le -> pcm_s16le)
    Press [q] to stop, [?] for help
    frame= 1400 fps = 15 q=3.0 size= 42800kB time=00:01:50.00 bitrate=3000.0kbits/s
    where that last line is incrementally constantly

    I also have 'ffmpeg' tuned previous using 'pavucontrol'.

    and

    and


    Perhaps you have another application running that is not using pulse audio that is refusing to share the audio device with pulse audio ?

  8. #8
    caf4926's Avatar
    caf4926 is offline Administrator
    Join Date
    Jun 2008
    Location
    The English Lake District. UK - GMT/BST
    Posts
    32,791
    Blog Entries
    11

    Default Re: record my desktop using ffmpeg

    Only difference is I don't have:

    libffmpeg-devel-0.9.1-1.1.x86_64

    I don't want to mess on this machine as I don't actually need the audio record on it.
    I look in on my other machine later.
    Thanks @oldcpu
    Box: 12.1 | KDE 4.8.2 | AMD 64 X2 5200+ | nVidia 8500GT | 4GB RAM
    Lap #1: 12.1 | Duo T4300 | KDE4.8.2 | Intel M4 Graphics | Lenovo G550 | 3GB RAM
    Lap#2: 12.1 | KDE 4.8.2 | Celeron 550 | Intel 965GM | Lenovo R61 | +EeePC | 12.1 | KDE T'Weed
    My_Guides

  9. #9
    gymnart's Avatar
    gymnart is offline Busy Penguin
    Join Date
    Aug 2008
    Posts
    392

    Default Re: record my desktop using ffmpeg

    I'm trying out Avidemux for editing my video (following this tutorial: How to get started with avidemux, edit and convert any video format ) . I can't seem to get the sound when I save the video. When saving, it says: Audio codec: NONE. So far, I've tried using mpeg2, vorbis, and mp3 lame as well as setting audio to "copy" but none of them work, there is no sound in the resulting video. It's nice and sharp though.
    For some video settings, Kino can't play it at all but MPlayer does (still without sound though).
    *What setting for audio do you use?

    Kino exports the video with audio without problems but the visual quality is rather blurry and you can't read what's on the screen.

    Shall I start another thread for this problem?

  10. #10
    caf4926's Avatar
    caf4926 is offline Administrator
    Join Date
    Jun 2008
    Location
    The English Lake District. UK - GMT/BST
    Posts
    32,791
    Blog Entries
    11

    Default Re: record my desktop using ffmpeg

    I have not used avidemux in recent months
    I have always used 'copy' on audio
    I'm fairly sure there have been some posts either in the forum or in packman ML about some issues recently, but I can't recall what issues.

    Recently I have used handbrake. Seems to work OK
    Box: 12.1 | KDE 4.8.2 | AMD 64 X2 5200+ | nVidia 8500GT | 4GB RAM
    Lap #1: 12.1 | Duo T4300 | KDE4.8.2 | Intel M4 Graphics | Lenovo G550 | 3GB RAM
    Lap#2: 12.1 | KDE 4.8.2 | Celeron 550 | Intel 965GM | Lenovo R61 | +EeePC | 12.1 | KDE T'Weed
    My_Guides

Page 1 of 2 12 LastLast

Tags for this Thread

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.5.2