I'm trying to convert Memoji from an iPhone/Mac into series of png with transparent background so I can create a sprite sheet. When press a spacebar I can clearly see it has a transparent background, however when run ffmpeg -i sprite/video.mov -r 24/1 sprite/output%03d.png
with ffmpeg it creates png with black background.
ffmpeg -i sprite/IMG_5386.mov -b:v 16M sprite/output%03d.png
ffmpeg version 4.4 Copyright (c) 2000-2021 the FFmpeg developers
built with Apple clang version 12.0.5 (clang-1205.0.22.9)
configuration: --prefix=/usr/local/Cellar/ffmpeg/4.4_2 --enable-shared --enable-pthreads --enable-version3 --cc=clang --host-cflags= --host-ldflags= --enable-ffplay --enable-gnutls --enable-gpl --enable-libaom --enable-libbluray --enable-libdav1d --enable-libmp3lame --enable-libopus --enable-librav1e --enable-librubberband --enable-libsnappy --enable-libsrt --enable-libtesseract --enable-libtheora --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libxvid --enable-lzma --enable-libfontconfig --enable-libfreetype --enable-frei0r --enable-libass --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libspeex --enable-libsoxr --enable-libzmq --enable-libzimg --disable-libjack --disable-indev=jack --enable-avresample --enable-videotoolbox
libavutil 56. 70.100 / 56. 70.100
libavcodec 58.134.100 / 58.134.100
libavformat 58. 76.100 / 58. 76.100
libavdevice 58. 13.100 / 58. 13.100
libavfilter 7.110.100 / 7.110.100
libavresample 4. 0. 0 / 4. 0. 0
libswscale 5. 9.100 / 5. 9.100
libswresample 3. 9.100 / 3. 9.100
libpostproc 55. 9.100 / 55. 9.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'sprite/IMG_5386.mov':
Metadata:
major_brand : qt
minor_version : 0
compatible_brands: qt
creation_time : 2021-10-13T09:06:52.000000Z
com.apple.quicktime.description: Memoji video, skin tone: Fair Skin Tone 3; hairstyle: Black, Short wavy bob with side parting; eyes: Brown;, facial hair: Black, Horseshoe moustache Short beard;, headgear: Denim, Baseball Cap
Duration: 00:00:02.98, start: 0.000000, bitrate: 2496 kb/s
Stream #0:0(und): Video: hevc (Main) (hvc1 / 0x31637668), yuv420p(tv, bt709), 640x480, 2114 kb/s, 56.74 fps, 60 tbr, 600 tbn, 600 tbc (default)
Metadata:
creation_time : 2021-10-13T09:06:52.000000Z
handler_name : Core Media Video
vendor_id : [0][0][0][0]
encoder : HEVC
Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, mono, fltp, 66 kb/s (default)
Metadata:
creation_time : 2021-10-13T09:06:52.000000Z
handler_name : Core Media Audio
vendor_id : [0][0][0][0]
Stream mapping:
Stream #0:0 -> #0:0 (hevc (native) -> png (native))
Press [q] to stop, [?] for help
Output #0, image2, to 'sprite/output%03d.png':
Metadata:
major_brand : qt
minor_version : 0
compatible_brands: qt
com.apple.quicktime.description: Memoji video, skin tone: Fair Skin Tone 3; hairstyle: Black, Short wavy bob with side parting; eyes: Brown;, facial hair: Black, Horseshoe moustache Short beard;, headgear: Denim, Baseball Cap
encoder : Lavf58.76.100
Stream #0:0(und): Video: png, rgb24(pc, bt709, progressive), 640x480, q=2-31, 16000 kb/s, 60 fps, 60 tbn (default)
Metadata:
creation_time : 2021-10-13T09:06:52.000000Z
handler_name : Core Media Video
vendor_id : [0][0][0][0]
encoder : Lavc58.134.100 png
frame= 179 fps=0.0 q=-0.0 Lsize=N/A time=00:00:02.98 bitrate=N/A speed=9.04x
video:13740kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
Right-click your transparent .mov
video on your Mac. Services -> Encode Selected Video Files -> set Apple ProRes -> tick Preserve Transparency -> Continue
. Then run your command ffmpeg -i sprite/video.mov -r 24/1 sprite/output%03d.png
. That will generate transparent pngs.