High Quality Screen Capture with FFmpeg

plumzl picture plumzl · Aug 18, 2014 · Viewed 11.2k times · Source

I'm trying to figure out a command for high quality screen capture on REHL.

I have tried various options, but none really worked. The quality is not good enough. I'm quite new to ffmpeg and doesn't quite understand all the different flags. So any help would be appreciated!

The commands I have tried:

ffmpeg -y -f x11grab -r 30 -s 1920x1080 -i :0.0+0,0 -vcodec libx264 -strict -2 -b:v 16M output.mov

The first command I tried. The weird thing is it doesn't seem to preserve the bitrate specified -b:v 16M. The output video's bitrate is only 2mb/s. Is that not the correct way to specify bitrate when doing screen capture?

ffmpeg -f x11grab -s 1920x1080 -r 30 -i :0.0 -qscale 0 -vcodec huffyuv output.mov

The huffyuv codec is supposed to be lossless, but the quality doesn't seem to be any better than the libx264 output.

ffmpeg -f x11grab -r 30 -s 1920x1080 -i :0.0+0,0 -vcodec copy -pix_fmt yuv420p -qscale 0 -an output.mkv
ffmpeg -f rawvideo -pix_fmt yuv420p -s:v 1920x1080 -r 30 -i output.mkv -an -c:v libx264 -qscale 0 result.mov 

I'm even trying to capture rawvideo and then convert it to libx264 codec viedeo. But the output is corrupted.

I'm using the version of ffmpeg that's built on April 23rd this year. It doesn't have the preset like -vpre lossless_ultrafast which I see mentioned in a lot posts.

Edit:

After more research, this is the command I end up using. I have to use h264 codec and yuv420p as pixel_fmt since I need to be able to play the quicktimes using quicktime.

ffmpeg -y -f x11grab -framerate 30 -video_size 1920x1080 -i :0.0+0,0 -c:v libx264 -pix_fmt yuv420p -qp 0 -preset ultrafast output.mov

The quality doesn't seem to be much improved even though -qp is set to 0. But it could also because of the rgb conversion to yuv color space according to this post.

https://trac.ffmpeg.org/wiki/Encode/H.264

Answer

matan7890 picture matan7890 · Aug 18, 2014

Found this on the internet, maybe it will answer your question:

http://wiki.oz9aec.net/index.php/High_quality_screen_capture_with_Ffmpeg

Edit: This answer is outdated as mentioned in the comments. Please ignore.