9
누구든지 비디오를 Google의 새로운 WebM 비디오 형식으로 변환하기위한 (프로토 타입) C# API에 대해 알고 있습니까?webm 비디오 변환 용 API
누구든지 비디오를 Google의 새로운 WebM 비디오 형식으로 변환하기위한 (프로토 타입) C# API에 대해 알고 있습니까?webm 비디오 변환 용 API
빠른 google 검색 결과 : 아니요. 그러나 example encoder은 P/Invoke를 사용하여 C#으로 쉽게 변환 할 수 있어야합니다. Encoder Algorithm Interface은 상당히 관리가 용이합니다. 그리고 다른 모든 것이 실패하면 항상 C++/CLI가 있습니다. 누가 코드 플렉스 프로젝트를 시작합니까? :-)
업데이트 : 현재로서는 해킹 된 기본 프로토 타입 .NET API가 있습니다. 여기 요 :
#include "vpx_codec.h"
#define VPX_CODEC_DISABLE_COMPAT 1
#include "vpx_encoder.h"
#include "vp8cx.h"
#define vp8iface (&vpx_codec_vp8_cx_algo)
using namespace System;
namespace WebM
{
namespace VP8
{
namespace Native
{
public ref class VP8Codec
{
private:
vpx_codec_ctx_t* ctx;
VP8Codec(vpx_codec_ctx_t* ctx)
{
this->ctx = ctx;
}
public:
~VP8Codec()
{
vpx_codec_destroy(ctx);
delete ctx;
}
property String^ LastError
{
String^ get()
{
return gcnew String(vpx_codec_error(ctx));
}
}
property String^ LastErrorDetail
{
String^ get()
{
return gcnew String(vpx_codec_error_detail(ctx));
}
}
int Encode()
{
// TODO: do actual encoding
return
vpx_codec_encode(ctx, NULL, 0, 1, 0, VPX_DL_REALTIME);
}
static VP8Codec^ CreateEncoder() // TODO: add 'config' argument
{
vpx_codec_ctx_t* ctx;
vpx_codec_enc_cfg_t cfg;
if(vpx_codec_enc_config_default(vp8iface, &cfg, 0))
{
return nullptr; // TODO: throw exception
}
ctx = new vpx_codec_ctx_t;
if (vpx_codec_enc_init(ctx, vp8iface, &cfg, 0))
{
delete ctx;
return nullptr; // TODO: throw exception
}
return gcnew VP8Codec(ctx);
}
static property int Version
{
int get()
{
return vpx_codec_version();
}
}
static property String^ VersionString
{
String^ get()
{
return gcnew String(vpx_codec_version_str());
}
}
static property String^ BuildConfig
{
String^ get()
{
return gcnew String(vpx_codec_build_config());
}
}
static String^ GetErrorDescription(int errorCode)
{
return gcnew String(
vpx_codec_err_to_string((vpx_codec_err_t)errorCode));
}
static property String^ IfaceName
{
String^ get()
{
return gcnew String(vpx_codec_iface_name(vp8iface));
}
}
};
}
}
}
당신은 libvpx Windows build에서 vpxmtd.lib와 링크 할 수 있어야한다. 나는 한 가지 경고를 없앨 수 없었지만, 지금까지는 효과가있는 것으로 보인다. 내 C++/CLI는 약간 녹슬었지만 코드에 메모리 누수가있을 수 있습니다.
테스트 프로그램 : 매우 도움이
namespace WebM.VP8
{
using System;
using WebM.VP8.Native;
public class Program
{
public static void Main()
{
using (var encoder = VP8Codec.CreateEncoder())
{
Console.WriteLine(encoder.Encode());
}
}
}
}
. 고마워. –
안녕하세요! .lib 참조를 프로젝트에 어떻게 추가 했습니까? vs2010에서 참조를 추가하려고하면 .lib 패키지를 사용하지 않습니다. s –
아무도 집에 없습니까? :) –