Answers.Body: <p>At least using Shotcut, you can get lossless output at minimum file size using the FFV1 codec.</p>
  <ol>
  <li><p>In the export window, choose the <code>lossless/FFV1</code> preset.</p>
  </li>
  <li><p>Click the <strong>Advanced</strong> button at the bottom.</p>
  </li>
  <li><p>Go to the <strong>Codec</strong> tab, and set the <strong>GOP</strong> to <code>250</code> frames.</p>
  </li>
  <li><p>Go to the <strong>Other</strong> tab, delete everything there and type the following:</p>
  <pre><code> coder=1
   context=1
   pix_fmt=bgr0
   mlt_image_format=rgb24
  </code></pre>
  </li>
  </ol>
  <p>Source: <a href="https://forum.shotcut.org/t/lossless-annoyances/18344/2" rel="nofollow noreferrer">https://forum.shotcut.org/t/lossless-annoyances/18344/2</a></p>
  <hr />
  <h2>Edit (June 2021)</h2>
  <p>The newer versions of Shotcut have better options for lossless encoding with smaller output file size. Here are the steps:</p>
  <ol>
  <li><p>Click the <strong>Settings</strong> menu &gt; <strong>Video Mode</strong> &gt; <strong>Custom</strong> &gt; <strong>Add...</strong>, then set <strong>Colorspace</strong> to <code>BT.709</code> and click <strong>OK</strong>.</p>
  </li>
  <li><p>In the <strong>Export</strong> window, choose any preset and click the <strong>Advanced</strong> button at the bottom.</p>
  </li>
  <li><p>In the <strong>Codec</strong> tab, set <strong>Codec</strong> to <code>libx264rgb</code>, set <strong>Rate control</strong> to <code>Quality-based VBR</code>, set <strong>Quality</strong> to <code>100%</code>, and set <strong>GOP</strong> to <code>250</code>.</p>
  </li>
  <li><p>In the <strong>Other</strong> tab, delete everything and paste the following:</p>
  <pre><code> pix_fmt=bgr24
   mlt_image_format=rgb24
   qp=0
  </code></pre>
  </li>
  </ol>
  <p>When you're done you can save these settings for later use; click the <strong>+</strong> button at the bottom of the <strong>Presets</strong> list and choose a name for your custom preset.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-05-30T21:19:59.667Z
Answers.LastActivityDate: 2021-06-24T13:17:49.130Z
Answers.LastEditDate: 2021-06-24T13:17:49.130Z
Answers.UserDisplayName: Ben
Body: <p>I recorded some video-game footage in 320x200 and then upscaled it to 1920x1440 using ffmpeg (nearest-neighbor, lossless libx264).</p>
  
  <p>Screenshots of the upscaled footage have pixel-perfect color matching the original source.</p>
  
  <p>However, when I import this footage into a video editor, and then immediately export it using a lossless format... color-banding occurs.</p>
  
  <ul>
  <li>Input Footage: <a href="https://i.sstatic.net/crGHF.png" rel="nofollow noreferrer">https://i.sstatic.net/crGHF.png</a> </li>
  <li>Output Footage: <a href="https://i.sstatic.net/yHbUy.png" rel="nofollow noreferrer">https://i.sstatic.net/yHbUy.png</a></li>
  </ul>
  
  <p>I tried 3 different video editors (kdenlive, vsdc, shotcut). I tried five different lossless codecs (ffv1, h.264, huffyuv, utvideo, lossless jpeg). Nothing seems to work.</p>
  
  <p>Any advice or suggestions would be very much appreciated.</p>
  
  <hr>
  
  <p><strong>FFMPEG comparison between Input Source and VSDC Lossless JPEG Output (which gave best results, but not perfect...)</strong></p>
  
  <pre><code>ffmpeg -i input.mp4 -i output.avi
  ffmpeg version 4.2 Copyright (c) 2000-2019 the FFmpeg developers
    built with gcc 9.1.1 (GCC) 20190807
    configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libdav1d --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libmfx --enable-amf --enable-ffnvcodec --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth --enable-libopenmpt
    libavutil      56. 31.100 / 56. 31.100
    libavcodec     58. 54.100 / 58. 54.100
    libavformat    58. 29.100 / 58. 29.100
    libavdevice    58.  8.100 / 58.  8.100
    libavfilter     7. 57.100 /  7. 57.100
    libswscale      5.  5.100 /  5.  5.100
    libswresample   3.  5.100 /  3.  5.100
    libpostproc    55.  5.100 / 55.  5.100
  Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'input.mp4':
    Metadata:
      major_brand     : isom
      minor_version   : 512
      compatible_brands: isomiso2avc1mp41
      encoder         : Lavf58.29.100
    Duration: 00:00:11.98, start: 0.000000, bitrate: 425 kb/s
      Stream #0:0(und): Video: h264 (High 4:4:4 Predictive) (avc1 / 0x31637661), gbrp(tv, gbr/unknown/unknown), 1920x1440, 373 kb/s, 60 fps, 60 tbr, 15360 tbn, 120 tbc (default)
      Metadata:
        handler_name    : VideoHandler
      Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 41 kb/s (default)
      Metadata:
        handler_name    : SoundHandler
  Input #1, avi, from 'output.avi':
    Metadata:
      date            : 2019-08-17
      title           : input
      encoder         : msl
    Duration: 00:00:12.00, start: 0.000000, bitrate: 126738 kb/s
      Stream #1:0: Video: jpegls (MJLS / 0x534C4A4D), rgb24(bt470bg/unknown/unknown), 1920x1440, lossless, 126664 kb/s, 60 fps, 60 tbr, 60 tbn, 60 tbc
      Stream #1:1: Audio: mp3 (U[0][0][0] / 0x0055), 44100 Hz, stereo, fltp, 224 kb/s
  At least one output file must be specified
  </code></pre>
  
Tags: <video-editor><video-quality><export>
Title: Exported Lossless Video - Output File Was Lossy
UserDisplayName: Anon
ThreadText: # Exported Lossless Video - Output File Was Lossy
  
  (Asked by: username_0 on 2019-08-16)
  
  I recorded some video-game footage in 320x200 and then upscaled it to 1920x1440 using ffmpeg (nearest-neighbor, lossless libx264).
  
  Screenshots of the upscaled footage have pixel-perfect color matching the original source.
  
  However, when I import this footage into a video editor, and then immediately export it using a lossless format... color-banding occurs.
  
  * Input Footage: <https://i.sstatic.net/crGHF.png>
  * Output Footage: <https://i.sstatic.net/yHbUy.png>
  
  I tried 3 different video editors (kdenlive, vsdc, shotcut). I tried five different lossless codecs (ffv1, h.264, huffyuv, utvideo, lossless jpeg). Nothing seems to work.
  
  Any advice or suggestions would be very much appreciated.
  
  ---
  
  **FFMPEG comparison between Input Source and VSDC Lossless JPEG Output (which gave best results, but not perfect...)**
  
  ```
  ffmpeg -i input.mp4 -i output.avi
  ffmpeg version 4.2 Copyright (c) 2000-2019 the FFmpeg developers
    built with gcc 9.1.1 (GCC) 20190807
    configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libdav1d --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libmfx --enable-amf --enable-ffnvcodec --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth --enable-libopenmpt
    libavutil      56. 31.100 / 56. 31.100
    libavcodec     58. 54.100 / 58. 54.100
    libavformat    58. 29.100 / 58. 29.100
    libavdevice    58.  8.100 / 58.  8.100
    libavfilter     7. 57.100 /  7. 57.100
    libswscale      5.  5.100 /  5.  5.100
    libswresample   3.  5.100 /  3.  5.100
    libpostproc    55.  5.100 / 55.  5.100
  Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'input.mp4':
    Metadata:
      major_brand     : isom
      minor_version   : 512
      compatible_brands: isomiso2avc1mp41
      encoder         : Lavf58.29.100
    Duration: 00:00:11.98, start: 0.000000, bitrate: 425 kb/s
      Stream #0:0(und): Video: h264 (High 4:4:4 Predictive) (avc1 / 0x31637661), gbrp(tv, gbr/unknown/unknown), 1920x1440, 373 kb/s, 60 fps, 60 tbr, 15360 tbn, 120 tbc (default)
      Metadata:
        handler_name    : VideoHandler
      Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 41 kb/s (default)
      Metadata:
        handler_name    : SoundHandler
  Input #1, avi, from 'output.avi':
    Metadata:
      date            : 2019-08-17
      title           : input
      encoder         : msl
    Duration: 00:00:12.00, start: 0.000000, bitrate: 126738 kb/s
      Stream #1:0: Video: jpegls (MJLS / 0x534C4A4D), rgb24(bt470bg/unknown/unknown), 1920x1440, lossless, 126664 kb/s, 60 fps, 60 tbr, 60 tbn, 60 tbc
      Stream #1:1: Audio: mp3 (U[0][0][0] / 0x0055), 44100 Hz, stereo, fltp, 224 kb/s
  At least one output file must be specified
  
  ```
  
  **Tags:** video-editor, video-quality, export
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2020-05-30. Score: 1
  
  At least using Shotcut, you can get lossless output at minimum file size using the FFV1 codec.
  
  1. In the export window, choose the `lossless/FFV1` preset.
  2. Click the **Advanced** button at the bottom.
  3. Go to the **Codec** tab, and set the **GOP** to `250` frames.
  4. Go to the **Other** tab, delete everything there and type the following:
  
     ```
      coder=1
      context=1
      pix_fmt=bgr0
      mlt_image_format=rgb24
  
     ```
  
  Source: <https://forum.shotcut.org/t/lossless-annoyances/18344/2>
  
  ---
  
  ## Edit (June 2021)
  
  The newer versions of Shotcut have better options for lossless encoding with smaller output file size. Here are the steps:
  
  1. Click the **Settings** menu > **Video Mode** > **Custom** > **Add...**, then set **Colorspace** to `BT.709` and click **OK**.
  2. In the **Export** window, choose any preset and click the **Advanced** button at the bottom.
  3. In the **Codec** tab, set **Codec** to `libx264rgb`, set **Rate control** to `Quality-based VBR`, set **Quality** to `100%`, and set **GOP** to `250`.
  4. In the **Other** tab, delete everything and paste the following:
  
     ```
      pix_fmt=bgr24
      mlt_image_format=rgb24
      qp=0
  
     ```
  
  When you're done you can save these settings for later use; click the **+** button at the bottom of the **Presets** list and choose a name for your custom preset.
  
  
  ---
  
  