Answers.Body: <p>I've come up with this ffmpeg command:</p>
  
  <pre><code>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
  </code></pre>
  
  <p>What this will do:</p>
  
  <ul>
  <li>use h.264 encoder with <code>-c:v libx264</code> to give small files (prores would give huge files)</li>
  <li>use <code>-tune animation</code> to optimize for screencasting</li>
  <li>use very low quality to maintain small bitrate using <code>-crf 35</code></li>
  <li>define small GOP settings (complete keyframes will be placed every 10 frames - default settings use more) with <code>-x264opts keyint=10</code> - 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.</li>
  <li>Use chroma subsampling, as ffmpeg would otherwise maintain original pixel format and you don't want or need 444 for proxy - <code>-pix_fmt yuv420p</code> - this helps make the file lighter.</li>
  <li>Encode audio in 16-bit PCM which is very fast to process and easy to scrub (the bitrate is constant) with <code>-c:a pcm_s16le</code>. Compared to video streams the bitrate is still small so using something like Vorbis instead is probably not needed.</li>
  <li>Finally, we want to make sure ffmpeg keeps all audio streams in the output file using <code>-map 0</code>. Without it it'd pick just one audio stream and drop the rest.</li>
  </ul>
  
  <p>Resulting file is 1.7 GB (from original 8.9 GB), and plays much more smoothly in Olive Video Editor.</p>
  
  <p>Here's what ffprobe says about created proxy file:</p>
  
  <pre><code>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
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-05-09T13:15:14.987Z
Answers.LastActivityDate: 2020-05-09T13:15:14.987Z
Answers.UserDisplayName: unfa
Body: <p>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:</p>
  
  <p><a href="https://i.sstatic.net/IZk4p.jpg" rel="nofollow noreferrer"><img src="https://i.sstatic.net/IZk4p.jpg" alt="Example frame from the original footage"></a></p>
  
  <p>Here's what ffprobe says about that file:</p>
  
  <pre><code>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
  </code></pre>
  
  <p>However editing video in <a href="https://www.olivevideoeditor.org/" rel="nofollow noreferrer">Olive</a> is pretty slow, and I think the biggest problem is high video bitrate.</p>
  
  <p>For example my original captured file is almost 9 GB for 50-minutes of footage, and the playback is very slow.</p>
  
  <p>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?</p>
  
Tags: <ffmpeg><encoding><conversion><linux><intermediate>
Title: Encode a small proxy file with multiple audio streams for editing on Linux
UserDisplayName: unfa
ThreadText: # Encode a small proxy file with multiple audio streams for editing on Linux
  
  (Asked by: username_0 on 2020-05-09)
  
  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](https://i.sstatic.net/IZk4p.jpg)](https://i.sstatic.net/IZk4p.jpg)
  
  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](https://www.olivevideoeditor.org/) 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?
  
  **Tags:** ffmpeg, encoding, conversion, linux, intermediate
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_0 on 2020-05-09. Score: 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
  
  ```
  
  
  ---
  
  