33 lines
819 B
C++
33 lines
819 B
C++
|
|
#include "mosh-me/avpipe.hpp"
|
|
#include <avcpp/av.h>
|
|
#include <avcpp/codeccontext.h>
|
|
#include <avcpp/formatcontext.h>
|
|
#include <avcpp/stream.h>
|
|
#include <spdlog/spdlog.h>
|
|
|
|
int main(int argc, char *argv[]) {
|
|
if (argc < 3) {
|
|
spdlog::error("Please invoke with {} <ifile> <ofile>", argv[0]);
|
|
}
|
|
|
|
av::init();
|
|
|
|
try {
|
|
auto pipe = mosh_me::VideoMuxer::link(std::filesystem::path(argv[2]))
|
|
<< mosh_me::DropIFrames::link()
|
|
<< mosh_me::MoshableVideoEncoder::link()
|
|
<< mosh_me::VideoDecoder::link()
|
|
<< mosh_me::VideoPacketSource::link(argv[1]);
|
|
|
|
pipe.propagateMeta();
|
|
|
|
if (auto result = pipe.pull(); !result.has_value()) {
|
|
spdlog::error("Pipe failed");
|
|
}
|
|
|
|
} catch (const av::Exception &e) {
|
|
spdlog::error("{}", e.what());
|
|
}
|
|
}
|