avcpp
avcpp copied to clipboard
How to use api2-decode-encode-video
I am trying to build a tool to convert a bunch of png's into a video. I figured the best place to start was the example api2-decode-encode-video.cpp but I don't understand how to use the example. I compiled it using homebrew ffmpeg 4.0.2 on MacOS and then run with:
./api2-decode-encode-video input.png out.mkv
The line above always crashes when initiating the VideoEncoderContext
with an error:
libc++abi.dylib: terminating with uncaught exception of type av::Exception: Codec context invalid media type
I tried other output names but get the same error. How am I supposed to use this example?
Seems that codecpar
using required new way for creation streams and codec contexts :-\ In current way codecpar
keeps uninitialized, as result - media_type is UNKNOWN and exception is thrown.
Heh, currently I have no time for correct fix. Quick WA is replace line:
#define USE_CODECPAR (LIBAVFORMAT_VERSION_MAJOR >= 58)
to
#define USE_CODECPAR (0)
at the https://github.com/h4tr3d/avcpp/blob/master/src/avutils.h
WA was committed: https://github.com/h4tr3d/avcpp/commit/20b296b7c6d7bded8dd222f6e7efa838fe0c3eb4