title: AVI compression with ffmpeg while maintaining alpha channel, to use in Adobe Premiere
body: <p>I am a novice when it comes to handling video conversion/encoding in general, but have spent a few days trying to figure out if ffmpeg, or any other method out there, is able to compress an .avi that has rgb+a. I have been able to get a few files that appear to work when played in VLC, but they wont load into Adobe Premiere to verify that alpha was maintained, and I assume it is a codec issue and/or a pixel format issue, but so far I haven't been able to pinpoint it.</p>
  <p>Also, I'm not sure if it's advisable to compress an .avi at all with alpha since it could lead to quality  issues from compression. Some loss of quality is ok if it means reducing file size.</p>
  <p>My goal is to convert an avi file to a smaller video file, that isn't multiple GB in size. Currently I have ~8 sec transparent lower thirds file that is about 2GB in size. Simply adjusting bitrate has not done it, as that seems to wipe out the alpha channel and I end up with RGB with a white background. I have tried using a PNG codec, with various different pixel formats. This yielded files that would open in VLC, but not Adobe Premiere. I suspect that this has something to do with the codec, though as to what it is, I have no idea.</p>
  <p>Right now, this seems like it may just not be possible. Here are some examples of what I have tried:</p>
  <p><code> ffmpeg -i &quot;input.avi&quot; -map 0 -c:v png -c:a copy &quot;Compressed.avi&quot;</code></p>
  <p>--this just creates a file that opens in vlc, but not premiere</p>
  <p><code>ffmpeg.exe -i &quot;input.avi&quot; -vcodec png -b:v 64k -pix_fmt rgb32 &quot;Compressed.avi&quot;</code></p>
  <p>--this does the same thing as above, I tried every pixel format on this <a href="https://ffmpeg.org/pipermail/ffmpeg-devel/2007-May/035617.html" rel="nofollow noreferrer">list</a> with no success.</p>
  <p><code>ffmpeg.exe -i &quot;input.avi&quot; -b:v 64k -pix_fmt bgr32 &quot;Compressed.avi&quot;</code></p>
  <p>--this just results in an avi with a white background, kills alpha.</p>
  <p>That is the closest I have come. The bitrate value is likely arbitrary, as I have also tried with and without bitrate modification. I don't know if there is a way to get Premiere to recognize the files that did open in VLC with the PNG codec, or if there is something I am missing, OR if this is just entirely impossible. The output doesn't need to be .avi either, so long as it will open in Premiere.</p>
  <p>--
  Edit: Requested in the comments, output from ffmpeg -i input.avi</p>
  <pre><code>ffmpeg version 4.3.1-2020-11-19-essentials_build-www.gyan.dev Copyright (c) 2000-2020 the FFmpeg developers
    built with gcc 10.2.0 (Rev5, Built by MSYS2 project)
    configuration: --enable-gpl --enable-version3 --enable-static --disable-w32threads --disable-autodetect --enable-fontconfig --enable-iconv --enable-gnutls --enable-libxml2 --enable-gmp --enable-lzma --enable-zlib --enable-libsrt --enable-libssh --enable-libzmq --enable-avisynth --enable-sdl2 --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxvid --enable-libaom --enable-libopenjpeg --enable-libvpx --enable-libass --enable-libfreetype --enable-libfribidi --enable-libvidstab --enable-libvmaf --enable-libzimg --enable-amf --enable-cuda-llvm --enable-cuvid --enable-ffnvcodec --enable-nvdec --enable-nvenc --enable-d3d11va --enable-dxva2 --enable-libmfx --enable-libgme --enable-libopenmpt --enable-libopencore-amrwb --enable-libmp3lame --enable-libtheora --enable-libvo-amrwbenc --enable-libgsm --enable-libopencore-amrnb --enable-libopus --enable-libspeex --enable-libvorbis --enable-librubberband
    libavutil      56. 51.100 / 56. 51.100
    libavcodec     58. 91.100 / 58. 91.100
    libavformat    58. 45.100 / 58. 45.100
    libavdevice    58. 10.100 / 58. 10.100
    libavfilter     7. 85.100 /  7. 85.100
    libswscale      5.  7.100 /  5.  7.100
    libswresample   3.  7.100 /  3.  7.100
    libpostproc    55.  7.100 / 55.  7.100
  Input #0, avi, from 'input.avi':
    Metadata:
      date            : 2020-12-09T20:27:57.080928
    Duration: 00:00:10.00, start: 0.000000, bitrate: 1990700 kb/s
      Stream #0:0: Video: rawvideo, bgra, 1920x1080, 1997313 kb/s, 30 fps, 30 tbr, 30 tbn, 30 tbc
  At least one output file must be specified
  </code></pre>
  <p>-- Edit 2:
  Tried this from the comment and it results in a .mov with preserved alpha but it picks up the white pixel values from text drop shadows, resulting in an outer glow effect instead:</p>
  <p><code>ffmpeg -i &quot;input.avi&quot; -map 0 -pix_fmt rgba -c:v png -c:a copy &quot;compressed.mov&quot;</code></p>
  <p>I also tried the following, and I get dropped frames in addition to similar transparency issues in the drop shadow:</p>
  <p><code>ffmpeg -i &quot;input.avi&quot; -map 0 -pix_fmt rgba -c:v qtrle -c:a copy &quot;compressed.mov&quot;</code></p>