简体   繁体   English

使用libvlc_video_set_format_callbacks逐帧转码视频

[英]using libvlc_video_set_format_callbacks to transcode videos frame by frame

I am trying to write a small program in C++ that transcodes a video frame by frame, and I am using the functions libvlc_video_set_callbacks and libvlc_video_set_format_callbacks to achieve this. 我试图用C ++编写一个小程序,逐帧对视频进行转码,并且我正在使用函数libvlc_video_set_callbacks和libvlc_video_set_format_callbacks来实现此目的。

The first function works fine, but I am not sure how to implement libvlc_video_set_format_callbacks. 第一个功能工作正常,但我不确定如何实现libvlc_video_set_format_callbacks。

I tried it this way to start with but it gives me an argument error for 'setup': 我从开始就尝试过这种方法,但是它给我'setup'的参数错误:

int setup(void* pUserData, char *chroma, unsigned int *width, unsigned int *height, unsigned int *pitches, unsigned int *lines)
    {
        (void) pUserData;
        return 1;
    }

libvlc_video_set_format_callbacks(mp, setup, cleanup);

Next thing is that I don't really know how to set the right video format properties. 接下来的事情是我真的不知道如何设置正确的视频格式属性。

Can you please help me with this setup-function or at least point me to an example that shows how to implement it, as I didn't find one? 您能帮我这个设置功能吗,或者至少可以向我指出一个示例,该示例演示了如何实现它,因为我没有找到一个? As you can imagine, I am not a very experienced programmer so please be patient with me ;) Thanks in advance 您可以想象,我不是一个非常有经验的程序员,所以请耐心等待;)预先感谢

liblv_video_set_format_callbacks second argument is of type libvlc_video_format_cb , which is the following typedef: liblv_video_set_format_callbacks第二个参数的类型为libvlc_video_format_cb ,其类型为以下typedef:

typedef unsigned(* libvlc_video_format_cb)(void **opaque, char *chroma, unsigned *width, unsigned *height, unsigned *pitches, unsigned *lines);

We can see two differences with your setup function: 我们可以看到您的setup功能有两个区别:

  • The type of the first argument should be void** . 第一个参数的类型应该为void** Yours is void* . 您的是void*
  • The return type should be unsigned . 返回类型应为unsigned Yours is int . 你的是int

I don't know either about video format properties. 我也不了解视频格式属性。 Thus, I will not able to give you any pointers for that. 因此,我将无法为您提供任何指示。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM