0

After capturing 2K video in 444p with OBS, I need to transcode it to a low quality proxy version that's still easy to scrub and not a huge file. I capture 3 audio tracks in 32-bit PCM and the image consists of two 1920x1080 parts - one is my desktop, one is input from my webcam:

Example frame from the original footage

Here's what ffprobe says about that file:

Input #0, matroska,webm, from 'original 2020-05-08 21-55-10.mkv':
  Metadata:
    ENCODER         : Lavf58.29.100
  Duration: 00:52:28.95, start: 0.000000, bitrate: 24282 kb/s
    Stream #0:0: Video: h264 (High 4:4:4 Predictive), yuvj444p(pc, bt709/unknown/unknown, progressive), 3840x1080, 62.50 fps, 60 tbr, 1k tbn, 120 tbc (default)
    Metadata:
      DURATION        : 00:52:28,950000000
    Stream #0:1: Audio: pcm_f32le, 48000 Hz, 2 channels, flt, 3072 kb/s (default)
    Metadata:
      DURATION        : 00:52:28,906000000
    Stream #0:2: Audio: pcm_f32le, 48000 Hz, 2 channels, flt, 3072 kb/s (default)
    Metadata:
      DURATION        : 00:52:28,906000000
    Stream #0:3: Audio: pcm_f32le, 48000 Hz, 2 channels, flt, 3072 kb/s (default)
    Metadata:
      DURATION        : 00:52:28,906000000

However editing video in Olive is pretty slow, and I think the biggest problem is high video bitrate.

For example my original captured file is almost 9 GB for 50-minutes of footage, and the playback is very slow.

How can I encode a small proxy file that'll work fast but maintain the same resolution so my transforms don't break when I replace the footage back to original?

2

I've come up with this ffmpeg command:

ffmpeg -i original.mkv -c:v libx264 -tune animation -crf 35 -x264opts keyint=10 -pix_fmt yuv420p -c:a pcm_s16le -map 0 proxy.mkv

What this will do:

  • use h.264 encoder with -c:v libx264 to give small files (prores would give huge files)
  • use -tune animation to optimize for screencasting
  • use very low quality to maintain small bitrate using -crf 35
  • define small GOP settings (complete keyframes will be placed every 10 frames - default settings use more) with -x264opts keyint=10 - this is a tradeoff between small filesize and bitrate and easy of scrubbing. For best scrubbing you'd want to set this to 1, so each frame is encoded independently. However 10 works for me so far.
  • Use chroma subsampling, as ffmpeg would otherwise maintain original pixel format and you don't want or need 444 for proxy - -pix_fmt yuv420p - this helps make the file lighter.
  • Encode audio in 16-bit PCM which is very fast to process and easy to scrub (the bitrate is constant) with -c:a pcm_s16le. Compared to video streams the bitrate is still small so using something like Vorbis instead is probably not needed.
  • Finally, we want to make sure ffmpeg keeps all audio streams in the output file using -map 0. Without it it'd pick just one audio stream and drop the rest.

Resulting file is 1.7 GB (from original 8.9 GB), and plays much more smoothly in Olive Video Editor.

Here's what ffprobe says about created proxy file:

Input #0, matroska,webm, from 'proxy 2020-05-08 21-55-10.mkv':
  Metadata:
    ENCODER         : Lavf58.29.100
  Duration: 00:52:28.95, start: 0.000000, bitrate: 7812 kb/s
    Stream #0:0: Video: h264 (High), yuv420p(progressive), 3840x1080, 60 fps, 60 tbr, 1k tbn, 120 tbc (default)
    Metadata:
      ENCODER         : Lavc58.54.100 libx264
      DURATION        : 00:52:28.950000000
Stream #0:1: Audio: pcm_s16le, 48000 Hz, 2 channels, s16, 1536 kb/s (default)
Metadata:
  ENCODER         : Lavc58.54.100 pcm_s16le
  DURATION        : 00:52:28.906000000
Stream #0:2: Audio: pcm_s16le, 48000 Hz, 2 channels, s16, 1536 kb/s (default)
Metadata:
  ENCODER         : Lavc58.54.100 pcm_s16le
  DURATION        : 00:52:28.906000000
Stream #0:3: Audio: pcm_s16le, 48000 Hz, 2 channels, s16, 1536 kb/s (default)
Metadata:
  ENCODER         : Lavc58.54.100 pcm_s16le
  DURATION        : 00:52:28.906000000
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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