OrderAndChaos
OrderAndChaos

Reputation: 3860

Recording Screen with FFmpeg

I recently used the FFmpeg bash commands below to capture a screen recording.

Are there any improvements that I could make to streamline this process?

Or perhaps some settings to reduce the size of the output files?

Ideally, I'd like to capture to mp4 directly. Is this possible?

Any advice generally about FFmpeg screen recording would be most appreciated.

ffmpeg -f x11grab -y -r 30 -s 1920x1080 -i :0.0 -vcodec huffyuv out.avi
# Then convert it to .mp4
ffmpeg -y -i out.avi -s 1920x1080 -f mp4 -vcodec libx264 -preset slow -crf 18 -b:v 3000k -maxrate 4000k -bufsize 512k -c:a aac -b:a 128k -strict -2 out.mp4
# and remove the .avi
rm out.avi

Upvotes: 3

Views: 6126

Answers (1)

Gyan
Gyan

Reputation: 92938

In general, for FFmpeg, input formats and output formats aren't tied to one another, so you can save in any format as long as the codecs are acceptable in the output format.

So, this will do,

ffmpeg -f x11grab -y -framerate 30 -s 1920x1080 -i :0.0 -c:v libx264 -preset superfast -crf 18 out.mp4

You may need to add -pix_fmt yuv420p after -i :0.0 for player compatibility.

Upvotes: 8

Related Questions