LinuxQuestions.org
Did you know LQ has a Linux Hardware Compatibility List?
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
LinkBack Search this Thread
Old 04-28-2011, 05:43 AM   #1
tchino
LQ Newbie
 
Registered: May 2007
Posts: 1

Rep: Reputation: 0
recording desktop with ffmpeg


bonjour
im using slackware 13.1 , and tried to record my desktop with recordmydesktop but the qualite was very bad, then i googled the subject little, and i found this commande with ffmpeg here is it:


ffmpeg -f alsa -ac 2 -i hw:0,0 -f x11grab -r 30 -s $(xwininfo -root | grep 'geometry' | awk '{print $2;}') -i :0.0 -acodec pcm_s16le -vcodec libx264 -vpre lossless_ultrafast -threads 0 -y output.mkv

and i have this output


[11:41:14][khalid@novice ~]$ ffmpeg -f alsa -ac 2 -i hw:0,0 -f x11grab -r 30 -s $(xwininfo -root | grep 'geometry' | awk '{print $2;}') -i :0.0 -acodec pcm_s16le -vcodec libx264 -vpre lossless_ultrafast -threads 0 -y output.mkv
FFmpeg version 0.6.1, Copyright (c) 2000-2010 the FFmpeg developers
built on Mar 23 2011 01:02:34 with gcc 4.4.4
configuration: --prefix=/usr --libdir=/usr/lib --shlibdir=/usr/lib --mandir=/usr/man --enable-libmp3lame --enable-libfaac --enable-nonfree --enable-gpl --enable-version3 --enable-postproc --enable-avfilter --enable-libdc1394 --enable-libfaad --enable-libgsm --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-librtmp --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libvpx --enable-libx264 --enable-runtime-cpudetect --enable-vaapi --disable-vdpau --enable-memalign-hack --enable-pthreads --enable-x11grab --enable-bzlib --enable-zlib --enable-shared --enable-static --disable-debug --extra-cflags='-I/tmp/build/tmp-ffmpeg/ffmpegdeps/usr/include -DRUNTIME_CPUDETECT' --extra-ldflags='-L/tmp/build/tmp-ffmpeg/ffmpegdeps/usr/lib -lssl -lcrypto -lz -lusb'
libavutil 50.15. 1 / 50.15. 1
libavcodec 52.73. 2 / 52.73. 2
libavformat 52.64. 2 / 52.64. 2
libavdevice 52. 2. 0 / 52. 2. 0
libavfilter 1.19. 0 / 1.19. 0
libswscale 0.11. 0 / 0.11. 0
libpostproc 51. 2. 0 / 51. 2. 0
[alsa @ 0x807a460]Estimating duration from bitrate, this may be inaccurate
Input #0, alsa, from 'hw:0,0':
Duration: N/A, start: 1211.999858, bitrate: N/A
Stream #0.0: Audio: pcm_s16le, 44100 Hz, 2 channels, s16, 1411 kb/s
[x11grab @ 0x8083e30]device: :0.0 -> display: :0.0 x: 0 y: 0 width: 1280 height: 1024
[x11grab @ 0x8083e30]shared memory extension found
[x11grab @ 0x8083e30]Estimating duration from bitrate, this may be inaccurate
Input #1, x11grab, from ':0.0':
Duration: N/A, start: 1303990874.886658, bitrate: 1258291 kb/s
Stream #1.0: Video: rawvideo, bgra, 1280x1024, 1258291 kb/s, 30 tbr, 1000k tbn, 30 tbc
[libx264 @ 0x80907e0]using cpu capabilities: MMX2 SSE2Fast SSSE3 FastShuffle SSE4.1 Cache64
[libx264 @ 0x80907e0]profile High 4:4:4 Predictive, level 3.2, bit depth 8
[libx264 @ 0x80907e0]64 - core 113 - H.264/MPEG-4 AVC codec - Copyleft 2003-2011 - 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=3 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 'output.mkv':
Metadata:
encoder : Lavf52.64.2
Stream #0.0: Video: libx264, yuv420p, 1280x1024, q=10-51, 200 kb/s, 1k tbn, 30 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
[alsa @ 0x807a460]ALSA buffer xrun.
[matroska @ 0x808f850]st:1 error, non monotone timestamps 1 >= 13.5kbits/s
av_interleaved_write_frame(): Operation not permitted



help me please
 
Old 04-28-2011, 05:01 PM   #2
spiderbatdad
Member
 
Registered: Nov 2009
Location: mote of dust suspended in a sunbeam
Distribution: Arch Linux / Ubuntu 10.10
Posts: 40

Rep: Reputation: 17
sorry not sure, and I haven't used ffmpeg for a few years. Of course there is a graphical front end called gtk-recordmydesktop. Don't know how it installs on slack. Assuming all the params are correct in your command..."operation not permitted" suggests a permissions problem. That is; try running as root. Or alter the command where you have:"$(xwininfo -root | grep 'geometry' |" to maybe "-user"
 
0 members found this post helpful.
Old 04-28-2011, 06:15 PM   #3
Telengard
Member
 
Registered: Apr 2007
Location: USA
Distribution: Kubuntu 8.04
Posts: 579
Blog Entries: 8

Rep: Reputation: 147Reputation: 147
I don't know why ffmpeg is failing, but I think the command can be simplified a bit. There is no need to pipe the output of grep into awk. Just drop the regular expression into the awk command.

Also the semicolon (;) is not needed after print $2. You only need it when you put multiple commands on the same line of the AWK program.

Code:
ffmpeg -f alsa -ac 2 -i hw:0,0 -f x11grab -r 30 -s $(xwininfo -root | awk '/geometry/ {print $2}') -i :0.0 -acodec pcm_s16le -vcodec libx264 -vpre lossless_ultrafast -threads 0 -y output.mkv

Last edited by Telengard; 04-28-2011 at 06:22 PM. Reason: version info already in OP
 
Old 04-28-2011, 06:30 PM   #4
Telengard
Member
 
Registered: Apr 2007
Location: USA
Distribution: Kubuntu 8.04
Posts: 579
Blog Entries: 8

Rep: Reputation: 147Reputation: 147
Quote:
Originally Posted by spiderbatdad View Post
Or alter the command where you have:"$(xwininfo -root | grep 'geometry' |" to maybe "-user"
I note that the xwininfo command does not have a -user option.

http://linux.die.net/man/1/xwininfo

Quote:
Originally Posted by man xwininfo
-root
This option specifies that X's root window is the target window. This is useful in situations where the root window is completely obscured.
Don't get me wrong though. I'm not saying that running the command as root won't help. I just don't know yet.
 
Old 04-28-2011, 06:46 PM   #5
Telengard
Member
 
Registered: Apr 2007
Location: USA
Distribution: Kubuntu 8.04
Posts: 579
Blog Entries: 8

Rep: Reputation: 147Reputation: 147
I can't get ffmpeg to work at all on my system. Even the examples in the man page fail. So I don't think there is any hope that I can help solve the problem. I hope at least the information I have already provided will prove useful to you.

Good luck.
 
Old 04-29-2011, 03:36 PM   #6
spiderbatdad
Member
 
Registered: Nov 2009
Location: mote of dust suspended in a sunbeam
Distribution: Arch Linux / Ubuntu 10.10
Posts: 40

Rep: Reputation: 17
I just ran the command:
Code:
ffmpeg -f alsa -ac 2 -i hw:0,0 -f x11grab -r 30 -s $(xwininfo -root | awk '/geometry/ {print $2}') -i :0.0 -acodec pcm_s16le -vcodec libx264 -vpre lossless_ultrafast -threads 0 -y output.mkv
and it worked for me.

Code:
~$ ffmpeg -f alsa -ac 2 -i hw:0,0 -f x11grab -r 30 -s $(xwininfo -root | awk '/geometry/ {print $2}') -i :0.0 -acodec pcm_s16le -vcodec libx264 -vpre lossless_ultrafast -threads 0 -y output.mkv
FFmpeg version 0.6-4:0.6-2ubuntu6, Copyright (c) 2000-2010 the FFmpeg developers
  built on Oct  5 2010 22:35:47 with gcc 4.4.5
  configuration: --extra-version=4:0.6-2ubuntu6 --prefix=/usr --enable-avfilter --enable-avfilter-lavf --enable-vdpau --enable-bzlib --enable-libgsm --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libvorbis --enable-vaapi --enable-pthreads --enable-zlib --enable-libvpx --disable-stripping --enable-runtime-cpudetect --enable-gpl --enable-postproc --enable-x11grab --enable-libdc1394 --enable-shared --disable-static
  WARNING: library configuration mismatch
  libavutil   configuration: --extra-version=4:0.6-2ubuntu3 --prefix=/usr --enable-avfilter --enable-avfilter-lavf --enable-vdpau --enable-bzlib --enable-libdirac --enable-libgsm --enable-libopenjpeg --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libvorbis --enable-vaapi --enable-pthreads --enable-zlib --enable-libvpx --disable-stripping --enable-runtime-cpudetect --enable-libmp3lame --enable-gpl --enable-postproc --enable-x11grab --enable-libfaad --enable-libxvid --enable-libx264 --enable-librtmp --enable-libdc1394 --shlibdir=/usr/lib/i686/cmov --cpu=i686 --enable-shared --disable-static --disable-ffmpeg --disable-ffplay
  libavcodec  configuration: --extra-version=4:0.6-2ubuntu3 --prefix=/usr --enable-avfilter --enable-avfilter-lavf --enable-vdpau --enable-bzlib --enable-libdirac --enable-libgsm --enable-libopenjpeg --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libvorbis --enable-vaapi --enable-pthreads --enable-zlib --enable-libvpx --disable-stripping --enable-runtime-cpudetect --enable-libmp3lame --enable-gpl --enable-postproc --enable-x11grab --enable-libfaad --enable-libxvid --enable-libx264 --enable-librtmp --enable-libdc1394 --shlibdir=/usr/lib/i686/cmov --cpu=i686 --enable-shared --disable-static --disable-ffmpeg --disable-ffplay
  libavformat configuration: --extra-version=4:0.6-2ubuntu3 --prefix=/usr --enable-avfilter --enable-avfilter-lavf --enable-vdpau --enable-bzlib --enable-libdirac --enable-libgsm --enable-libopenjpeg --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libvorbis --enable-vaapi --enable-pthreads --enable-zlib --enable-libvpx --disable-stripping --enable-runtime-cpudetect --enable-libmp3lame --enable-gpl --enable-postproc --enable-x11grab --enable-libfaad --enable-libxvid --enable-libx264 --enable-librtmp --enable-libdc1394 --shlibdir=/usr/lib/i686/cmov --cpu=i686 --enable-shared --disable-static --disable-ffmpeg --disable-ffplay
  libavdevice configuration: --extra-version=4:0.6-2ubuntu3 --prefix=/usr --enable-avfilter --enable-avfilter-lavf --enable-vdpau --enable-bzlib --enable-libdirac --enable-libgsm --enable-libopenjpeg --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libvorbis --enable-vaapi --enable-pthreads --enable-zlib --enable-libvpx --disable-stripping --enable-runtime-cpudetect --enable-libmp3lame --enable-gpl --enable-postproc --enable-x11grab --enable-libfaad --enable-libxvid --enable-libx264 --enable-librtmp --enable-libdc1394 --shlibdir=/usr/lib/i686/cmov --cpu=i686 --enable-shared --disable-static --disable-ffmpeg --disable-ffplay
  libavfilter configuration: --extra-version=4:0.6-2ubuntu6 --prefix=/usr --enable-avfilter --enable-avfilter-lavf --enable-vdpau --enable-bzlib --enable-libgsm --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libvorbis --enable-vaapi --enable-pthreads --enable-zlib --enable-libvpx --disable-stripping --enable-runtime-cpudetect --enable-gpl --enable-postproc --enable-x11grab --enable-libdc1394 --shlibdir=/usr/lib/i686/cmov --cpu=i686 --enable-shared --disable-static --disable-ffmpeg --disable-ffplay
  libswscale  configuration: --extra-version=4:0.6-2ubuntu6 --prefix=/usr --enable-avfilter --enable-avfilter-lavf --enable-vdpau --enable-bzlib --enable-libgsm --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libvorbis --enable-vaapi --enable-pthreads --enable-zlib --enable-libvpx --disable-stripping --enable-runtime-cpudetect --enable-gpl --enable-postproc --enable-x11grab --enable-libdc1394 --shlibdir=/usr/lib/i686/cmov --cpu=i686 --enable-shared --disable-static --disable-ffmpeg --disable-ffplay
  libpostproc configuration: --extra-version=4:0.6-2ubuntu3 --prefix=/usr --enable-avfilter --enable-avfilter-lavf --enable-vdpau --enable-bzlib --enable-libdirac --enable-libgsm --enable-libopenjpeg --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libvorbis --enable-vaapi --enable-pthreads --enable-zlib --enable-libvpx --disable-stripping --enable-runtime-cpudetect --enable-libmp3lame --enable-gpl --enable-postproc --enable-x11grab --enable-libfaad --enable-libxvid --enable-libx264 --enable-librtmp --enable-libdc1394 --shlibdir=/usr/lib/i686/cmov --cpu=i686 --enable-shared --disable-static --disable-ffmpeg --disable-ffplay
  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
  libavfilter    1.19. 0 /  1.19. 0
  libswscale     0.11. 0 /  0.11. 0
  libpostproc   51. 2. 0 / 51. 2. 0
[alsa @ 0x8496be0]Estimating duration from bitrate, this may be inaccurate
Input #0, alsa, from 'hw:0,0':
  Duration: N/A, start: 488.000014, bitrate: N/A
    Stream #0.0: Audio: pcm_s16le, 44100 Hz, 2 channels, s16, 1411 kb/s
[x11grab @ 0x84a4400]device: :0.0 -> display: :0.0 x: 0 y: 0 width: 1024 height: 600
[x11grab @ 0x84a4400]shared memory extension  found
[x11grab @ 0x84a4400]Estimating duration from bitrate, this may be inaccurate
Input #1, x11grab, from ':0.0':
  Duration: N/A, start: 1304108724.761774, bitrate: 589824 kb/s
    Stream #1.0: Video: rawvideo, bgra, 1024x600, 589824 kb/s, 30 tbr, 1000k tbn, 30 tbc
[libx264 @ 0x84b1bb0]using cpu capabilities: MMX2 SSE2Fast SSSE3 Cache64 SlowCTZ SlowAtom
[libx264 @ 0x84b1bb0]profile High 4:4:4 Predictive, level 3.1
[libx264 @ 0x84b1bb0]64 - core 98 Ubuntu_2:0.98.1653+git88b90d9-3 - 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=3 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 'output.mkv':
  Metadata:
    encoder         : Lavf52.64.2
    Stream #0.0: Video: libx264, yuv420p, 1024x600, q=10-51, 200 kb/s, 1k tbn, 30 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=  244 fps=  9 q=-1.0 Lsize=    5704kB time=27.31 bitrate=1711.1kbits/s    
video:996kB audio:4704kB global headers:0kB muxing overhead 0.062343%
[libx264 @ 0x84b1bb0]frame I:1     Avg QP: 0.00  size:309275
[libx264 @ 0x84b1bb0]frame P:243   Avg QP: 0.00  size:  2923
[libx264 @ 0x84b1bb0]mb I  I16..4: 45.4%  0.0% 54.6%
[libx264 @ 0x84b1bb0]mb P  I16..4: 26.7%  0.0%  0.0%  P16..4:  0.1%  0.0%  0.0%  0.0%  0.0%    skip:73.1%
[libx264 @ 0x84b1bb0]coded y,uvDC,uvAC intra: 1.4% 14.7% 14.7% inter: 0.1% 0.2% 0.2%
[libx264 @ 0x84b1bb0]i16 v,h,dc,p: 100%  0%  0%  0%
[libx264 @ 0x84b1bb0]i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 52% 31%  3%  2%  2%  2%  2%  2%  4%
[libx264 @ 0x84b1bb0]i8c dc,h,v,p: 87%  3% 10%  0%
[libx264 @ 0x84b1bb0]kb/s:294.48
It also works piping the output of grep to awk.
I notice my cli output lists a number of other dependencies and libraries not shown in the OP's. The error (non-monochrome timestamps) may be a bug. http://code.google.com/p/xuggle/issues/detail?id=51
Hopefully you can find info on non-monchrome timestamps...and maybe patch or get a newer version of ffmpeg.

Last edited by spiderbatdad; 04-29-2011 at 04:00 PM.
 
Old 04-29-2011, 03:41 PM   #7
Telengard
Member
 
Registered: Apr 2007
Location: USA
Distribution: Kubuntu 8.04
Posts: 579
Blog Entries: 8

Rep: Reputation: 147Reputation: 147
Quote:
Originally Posted by spiderbatdad View Post
I just ran the command:
Code:
ffmpeg -f alsa -ac 2 -i hw:0,0 -f x11grab -r 30 -s $(xwininfo -root | awk '/geometry/ {print $2}') -i :0.0 -acodec pcm_s16le -vcodec libx264 -vpre lossless_ultrafast -threads 0 -y output.mkv
and it worked perfectly for me.
Good to know

I'm just a bit perturbed that even the simple examples from the man page fail for me. Not really interested in troubleshooting it though, because this system is going to be upgraded soon anyway.
 
  


Reply

Tags
ffmpeg


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Recording sound as well as video with FFmpeg and x11grab andrew.46 Slackware 3 06-07-2009 02:00 PM
desktop recording software sreejithkoiloth Linux - Software 3 05-15-2009 03:35 AM
Desktop recording application redhat0 Linux - Software 2 07-03-2006 09:29 AM
Recording video of my desktop/applications? brynjarh Linux - Software 2 03-24-2006 10:06 AM
FFMPEG : recording Television broadcast. _UnPrEdictAbLe_ Linux - Software 0 03-14-2006 09:32 AM


All times are GMT -5. The time now is 03:22 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration