0

I want export every frame like original source, in webm video is alpha/transparent video track, and if I try export with my base command will export with black background.

ffmpeg \
-hide_banner \
-loglevel error\
-stats \
-i ${DIRECTORY_CONVERT_VIDEO_TO_FRAMES}${videofile} \
-vf "scale=${new_width}:${new_height}" \
"${DIRECTORY_CONVERTED_FRAMES}"%04d.png

I added -c:v png, -q:v 0 and format=rgba but still same effect.

ffmpeg \
    -hide_banner \
    -loglevel error \
    -stats \
    -i video/ok.webm \
    -vf "scale=${new_width}:${new_height},format=rgba" \
    -c:v png \
    -q:v 0 \
    "${DIRECTORY_CONVERTED_FRAMES}"%04d.png

Please help me. And I forgot, video metadata:

ffprobe -show\_streams video/ok.webm

ffprobe version n6.1.1 Copyright (c) 2007-2023 the FFmpeg developers

built with gcc 13.2.1 (GCC) 20230801

configuration: --prefix=/usr --disable-debug --disable-static --disable-strippi

ng --enable-amf --enable-avisynth --enable-cuda-llvm --enable-lto --enable-fontconfig --enable-frei0r --enable-gmp --enable-gnutls --enable-gpl --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libdav1d --enable-libdrm --enable-libfreetype --enable-libfribidi --enable-libgsm --enable-libharfbuzz --enable-libiec61883 --enable-libjack --enable-libjxl --enable-libmodplug --enable-libmp3lame --enable-libopencore\_amrnb --enable-libopencore\_amrwb --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libplacebo --enable-libpulse --enable-librav1e --enable-librsvg --enable-librubberband --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libsvtav1 --enable-libtheora --enable-libv4l2 --enable-libvidstab --enable-libvmaf --enable-libvorbis --enable-libvpl --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxcb --enable-libxml2 --enable-libxvid --enable-libzimg --enable-nvdec --enable-nvenc --enable-opencl --enable-opengl --enable-shared --enable-vapoursynth --enable-version3 --enable-vulkan               libavutil      58. 29.100 / 58. 29.100

libavcodec     60. 31.102 / 60. 31.102

libavformat    60. 16.100 / 60. 16.100

libavdevice    60.  3.100 / 60.  3.100

libavfilter     9. 12.100 /  9. 12.100

libswscale      7.  5.100 /  7.  5.100

libswresample   4. 12.100 /  4. 12.100

libpostproc    57.  3.100 / 57.  3.100

Input #0, matroska,webm, from 'video/ok.webm':

Metadata:

ENCODER         : Lavf60.16.100

Duration: 00:00:05.00, start: 0.000000, bitrate: 2580 kb/s

Stream #0:0: Video: vp9 (Profile 0), yuv420p(tv, progressive), 600x1040, SAR 1:

1 DAR 15:26, 30 fps, 30 tbr, 1k tbn                                                  Metadata:

alpha\_mode      : 1

ENCODER         : Lavc60.31.102 libvpx-vp9

DURATION        : 00:00:05.000000000

\[STREAM\]

index=0

codec\_name=vp9

codec\_long\_name=Google VP9

profile=Profile 0

codec\_type=video

codec\_tag\_string=\[0\]\[0\]\[0\]\[0\]

codec\_tag=0x0000

width=600

height=1040

coded\_width=600

coded\_height=1040

closed\_captions=0

film\_grain=0

has\_b\_frames=0

sample\_aspect\_ratio=1:1

display\_aspect\_ratio=15:26

pix\_fmt=yuv420p

level=-99

color\_range=tv

color\_space=unknown

color\_transfer=unknown

color\_primaries=unknown

chroma\_location=unspecified

field\_order=progressive

refs=1

id=N/A

r\_frame\_rate=30/1

avg\_frame\_rate=30/1

time\_base=1/1000

start\_pts=0

start\_time=0.000000

duration\_ts=N/A

duration=N/A

bit\_rate=N/A

max\_bit\_rate=N/A

bits\_per\_raw\_sample=N/A

nb\_frames=N/A

nb\_read\_frames=N/A

nb\_read\_packets=N/A

DISPOSITION:default=0

DISPOSITION:dub=0

DISPOSITION:original=0

DISPOSITION:comment=0

DISPOSITION:lyrics=0

DISPOSITION:karaoke=0

DISPOSITION:forced=0

DISPOSITION:hearing\_impaired=0

DISPOSITION:visual\_impaired=0

DISPOSITION:clean\_effects=0

DISPOSITION:attached\_pic=0

DISPOSITION:timed\_thumbnails=0

DISPOSITION:non\_diegetic=0

DISPOSITION:captions=0

DISPOSITION:descriptions=0

DISPOSITION:metadata=0

DISPOSITION:dependent=0

DISPOSITION:still\_image=0

TAG:alpha\_mode=1

TAG:ENCODER=Lavc60.31.102 libvpx-vp9

TAG:DURATION=00:00:05.000000000

\[/STREAM\]
1
  • is possible make some bash script to detect automatic that alpha channel, to extract frames? Commented May 14 at 6:35

1 Answer 1

1

To decode alpha, you need to force the vpx decoders.

For VP9, set ffmpeg -c:v libvpx-vp9 -i video/ok.webm ...

3
  • OMG, Yes thanks! Works, i too tried before ai but ai dont help me. Thanks again! Commented May 7 at 19:39
  • is possible make some bash script to detect automatic that alpha channel, to extract frames? @gyan Commented May 14 at 6:35
  • Indirectly. Run ffprobe -of compact=p=0:nk=1 -select_streams v -show_entries packet_side_data_list -read_intervals %+#1 -v 0 test.webm. If it returns Matroska BlockAdditional then alpha is present.
    – Gyan
    Commented May 14 at 7:44

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .