Reputation: 23
I am trying to overlaying two videos using FFmpeg in c++. So I followed the FFmpeg page and followed this command in terminal.
$ ffmpeg -i Right.mov -i Left.mov -filter_complex "[0:v][1:v] overlay=0:0" -c:a copy output.mov
I can implement this functionality through the terminal, but I am trying to achieve this functionality through codding.
typedef struct {
AVFormatContext *fmt_ctx;
int stream_idx;
AVRational time_base;
AVStream *video_stream;
AVCodecContext *codec_ctx;
AVCodecContext *pCodecCtxOrig;
AVCodec *decoder;
AVPacket *packet;
AVFrame *av_frame;
AVFrame *gl_frame;
AVFrame *out_frame;
AVStream *pStream;
struct SwsContext *conv_ctx;
also, I show some example code, but I am not sure about it
https://ffmpeg.org/doxygen/2.1/doc_2examples_2filtering_video_8c-example.html
and https://code5.cn/so/c%2B%2B/2601062
AVFilterContext *buffersink_ctx;
AVFilterContext *buffersrc_ctx;
AVFilterGraph *filter_graph;
how can I implement this functionality in my code?
Upvotes: 0
Views: 369
Reputation: 2516
A long time ago I wrote a program that used ffmpeg to decode videos and display them as OpenGL textures. You can download the code from my home page Please be warned that this code is over ten years old and hasn't been maintained, so I cannot say that it still works. But nobody seems to have a better answer for you, so I hope this helps at least get you started.
Upvotes: 1