Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

Trying to capture screen to video file encoded with lossless x264:

vic@vic-X202E ~/Desktop » ffmpeg -f x11grab -r 15 -s 1366x768 -i :0.0 -sameq -vcodec libx264 -preset:v ultrafast test.mkv
ffmpeg version 0.8.4-6:0.8.4-0ubuntu0.12.10.1, Copyright (c) 2000-2012 the Libav developers
  built on Nov  6 2012 16:51:11 with gcc 4.7.2
*** THIS PROGRAM IS DEPRECATED ***
This program is only provided for compatibility and will be removed in a future release. Please use avconv instead.
[x11grab @ 0xc2bf60] device: :0.0 -> display: :0.0 x: 0 y: 0 width: 1366 height: 768
[x11grab @ 0xc2bf60] shared memory extension  found
[x11grab @ 0xc2bf60] Estimating duration from bitrate, this may be inaccurate
Input #0, x11grab, from ':0.0':
  Duration: N/A, start: 1357648973.267658, bitrate: 503562 kb/s
    Stream #0.0: Video: rawvideo, bgra, 1366x768, 503562 kb/s, 15 tbr, 1000k tbn, 15 tbc
Unrecognized option 'preset:v'
Failed to set value 'ultrafast' for option 'preset:v'

Another try:

vic@vic-X202E ~/Desktop » ffmpeg -f x11grab -r 15 -s 1366x768 -i :0.0 -sameq -vcodec libx264 -preset ultrafast test.mkv  
ffmpeg version 0.8.4-6:0.8.4-0ubuntu0.12.10.1, Copyright (c) 2000-2012 the Libav developers
  built on Nov  6 2012 16:51:11 with gcc 4.7.2
*** THIS PROGRAM IS DEPRECATED ***
This program is only provided for compatibility and will be removed in a future release. Please use avconv instead.
[x11grab @ 0x2482f60] device: :0.0 -> display: :0.0 x: 0 y: 0 width: 1366 height: 768
[x11grab @ 0x2482f60] shared memory extension  found
[x11grab @ 0x2482f60] Estimating duration from bitrate, this may be inaccurate
Input #0, x11grab, from ':0.0':
  Duration: N/A, start: 1357648985.325860, bitrate: 503562 kb/s
    Stream #0.0: Video: rawvideo, bgra, 1366x768, 503562 kb/s, 15 tbr, 1000k tbn, 15 tbc
Unrecognized option 'preset'
Failed to set value 'ultrafast' for option 'preset'
vic@vic-X202E ~/Desktop » 

Something broken? Using Kubuntu 12.10.

share|improve this question

2 Answers 2

up vote 5 down vote accepted

Please don't use the same_quant option. It doesn't achieve what you think it does.

Now, to achieve lossless compression, you need to specify a constant quality of 0 with -crf 0.

avconv -f x11grab -r 15 -s 1366x768 -i :0.0 \
-c:v libx264 -preset ultrafast -crf 0 \
test.mkv

See the x264 encoding guide for more options. If you don't have x264, you need libavcodec-extra.


Note that FFmpeg and Libav should treat this command the same. The problem with your system is that your FFmpeg version is terribly outdated. You should compile it yourself or download a static build from the homepage. Both would include x264.

share|improve this answer

Try using avconv in place of ffmpeg. (The relationship between these two forks in Ubuntu appears to be a complex issue).

On my 12.10 system I have both the executables for ffmpeg and avconv, but only preset files for avconv (in /usr/share/avconv).

Try:

avconv -f x11grab -r 15 -s 1366x768 -i :0.0 -same_quant -codec:v libx264 -pre:v ultrafast test.mkv
share|improve this answer
    
I am getting "Unknown encoder 'libx264'" –  warvariuc Jan 8 '13 at 13:50
1  
sudo apt-get install libx264-120 ? –  chronitis Jan 8 '13 at 15:29
    
ok, it worked after i installed package libavcodec-extra-53. Thanks! –  warvariuc Jan 8 '13 at 15:45
    
The command you gave doesn't achieve lossless compression. –  slhck Feb 3 '13 at 15:12

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.