PyAV
PyAV copied to clipboard
Unable to add codec "vp8"/"vp9" for the add_stream for the output container
IMPORTANT: Be sure to replace all template sections {{ like this }} or your issue may be discarded.
Build report:
Unable to add codec "vp8"/"vp9" for the add_stream for the output container
Getting error "av.codec.codec.UnknownCodecError: libvpx" in below line of code:
self.container = av.open("test.webm", mode="w") self.stream = self.container.add_stream("libvpx", rate=round(frame_rate))
I tried with "vp8"/"vp9" as well but it still showing same error.
When i change the codec to "h264" =>
self.stream = self.container.add_stream("h264", rate=round(frame_rate)),
it's start working, But i need to write webm file.
I also checked av.codecs_available and its shows "vp8" and "vp9" in the available codecs list
Versions
- OS: {{ e.g. macOS 12.1 }} ffmpeg version details: ffmpeg version 5.0.1 Copyright (c) 2000-2022 the FFmpeg developers built with Apple clang version 13.1.6 (clang-1316.0.21.2) configuration: --prefix=/opt/homebrew/Cellar/ffmpeg/5.0.1 --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-librist --enable-librubberband --enable-libsnappy --enable-libsrt --enable-libtesseract --enable-libtheora --enable-libvidstab --enable-libvmaf --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-videotoolbox --enable-neon
PyAV version details - 9.0.2
PyAV releases < 10.0 do not support ffmpeg 5, so you're probably using the binary wheel and not linking against your ffmpeg 5.0.1 system ffmpeg. The binary distribution of PyAV v9.0.2 did not include libvpx. Try v9.2.0
@uvjustin, Its start working on mac with ffmpeg 4..42 and PyAV 9.2.0 but on ubuntu 20 its still not able to locate libvpx. Would you please help me to make it work on ubuntu.
@uvjustin , will you please help me with thread_count option in pyav, here is my sample code: self.container = av.open(path, mode="w") self.stream = self.container.add_stream("h264", rate=round(frame_rate)) self.stream.pix_fmt = "yuv420p" self.stream.thread_count = 4 self.stream.thread_type = 3 self.stream.bit_rate = bit_rate
I am adding the data frame to video by calling below lines
frame = av.VideoFrame.from_ndarray(src, format="rgba") self.container.mux(self.stream.encode(frame))
Where src is numpy array. But i cant see any speed up in the encoding even after adding thread_count to 4.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.