41

I'm doing a series of tutorials by recording the screen and my voice. Just as PNG works best for screenshots, while JPEG is better suited for photographs (although lossy), which video encoding & container formats are better for screen recording?

Please provide suggestions for both:

  1. The Master copy (for editing & archiving. (Almost) Lossless)
  2. Distribution copies (high compression with acceptable loss)

Points to consider:

  • High quality video with on-screen text being legible
  • Good compression. I guess both inter-frame & intra-frame compression will be effective.
  • Please mention recommended values of configurable parameters like frame rate, compression level, etc.
  • Closed captions to be supported (not "hard-coded" onto the video). I'm inclining towards .srt format
  • Viewable on Windows, Linux & MacOS
Dheeraj Vepakomma
  • 26,870
  • 17
  • 81
  • 104

4 Answers4

25

Master copy
Lossless - HUFFYUV in AVI is a good option.
Lossy - MJPEG (series of JPEG) in AVI is a good option, where each frame will be independently encoded. The editing will be faster.

Distribution
Video codec - Use either H.264 video (not free) or VP8 (free video codec by Google). You should use codec with inter frame compression as screen recording tends to have a lot of similarity across frames, hence allowing for a better compression. Both VP8 and H.264 support inter compression where as MJPEG does not.

File format - Depending on video codec, you can use either MP4 or MKV file format. H.264 is more often encapsulated in MP4 container and VP8 in MKV. Google WebM format is subset of MKV format.

Subtitles - SRT is good choice for external subtitles. MKV supports internal subtitles if you want to embed subtitles inside MKV file as a separate stream.

Frame rate - 24 fps is good enough frame rate for your use case. You can actually use even lower frame rates if needed.

Bitrate/Compression level - Depends on resolution of the video. You should be able find good tutorials which provide which bitrate is best for given resolution.

Support - MKV with VP8 will play on Windows (Windows Media player) and Linux provided necessary software is installed. VLC Player is available on both Windows and Linux and plays MKV with VP8 without any issues.

Oak Bytes
  • 4,649
  • 4
  • 36
  • 53
3

One important thing to consider when capturing a mostly static screen (desktop recording) is to use the VBR (Variable Bit Rate) option over CBR (Constant Bit Rate), in my case it reduced video size nearly 10 times without losing quality (the video stream average bitrate became comparable to the audio stream =-D).

H.264 has such option, but you have to set it manually, as usually default is CBR (at least in OBS Studio). If you use command line, ffmpeg has CRF (Constant Quality) by default, which also works pretty well for non-camera recorded videos.

Waruyama
  • 3,267
  • 1
  • 32
  • 42
Klesun
  • 12,280
  • 5
  • 59
  • 52
2

For your master copy, there is another approach you could use.

I was able to get insane compression rates when using 7zip to compress MJPEG video. That's mainly because of small differences in the frames, which you have in some types of screen recordings. If you record 3d games I don't think it would help though.

Marcel Burkhard
  • 3,453
  • 1
  • 29
  • 35
0

For distribution, you can use ffmpeg with the GNU libx264 codec on Linux.

Record full screen without audio :

ffmpeg -hide_banner -video_size $(xrandr | awk '/\*/{printf$1}') -f x11grab -i $DISPLAY.0 screenRecording.mp4

Record full screen with audio :

ffmpeg -hide_banner -video_size $(xrandr | awk '/\*/{printf$1}') -f x11grab -i $DISPLAY.0 -f pulse -i default screenRecording.mp4

The H.264 profile chosen by ffmpeg (when given -f x11grab argument on an MP4 output file) will be :

[libx264 @ 0x6f47200] profile High 4:4:4 Predictive, level 4.0, 4:4:4, 8-bit

Record chosen/selected window without audio :

ffmpeg -hide_banner -window_id $(xwininfo | awk '/Window id:/{printf$4}') -f x11grab -i $DISPLAY.0 windowRecording.mp4

Record chosen/selected window with audio :

ffmpeg -hide_banner -window_id $(xwininfo | awk '/Window id:/{printf$4}') -f x11grab -i $DISPLAY.0 -f pulse -i default windowRecording.mp4

The H.264 profile chosen by ffmpeg in that case will be :

[libx264 @ 0x6f47200] profile High 4:4:4 Predictive, level 3.1, 4:4:4, 8-bit

For more information on screen recording with ffmpeg and examples for Linux, Windows or MacOS, you can read this : https://trac.ffmpeg.org/wiki/Capture/Desktop

For more information on the x11grab device : https://www.ffmpeg.org/ffmpeg-devices.html#x11grab (or type man ffmpeg-devices)

For more information on libx264 with ffmpeg : https://trac.ffmpeg.org/wiki/Encode/H.264 (or type man x264)

For more information on ffmpeg, you can read this : https://trac.ffmpeg.org/wiki

SebMa
  • 4,037
  • 29
  • 39