专注收集记录技术开发学习笔记、技术难点、解决方案
网站信息搜索 >> 请输入关键词:
您当前的位置: 首页 > 多媒体/流媒体开发

264解码的时候 ,无法知道视频过来的信息,比如视频的尺寸,小弟我该如何避免

发布时间:2011-06-27 19:21:09 文章来源:www.iduyao.cn 采编人员:星星草
264解码的时候 ,无法知道视频过来的信息,比如视频的尺寸,我该如何处理
264解码的时候 ,无法知道视频过来的信息,比如视频的尺寸,我该如何处理。

已x264为基础,初始化时,似乎必须传视频的尺寸信息的。


------解决方案--------------------
264的标准码流通过264的码流分析库是可以分析出宽高的,帧率是没办法的,一般码流里面是没有这个信息的。
------解决方案--------------------
推荐你用MediaInfo的DLL,可以得到所有的文件信息,包括视频的高和宽等等,具体函数是MediaInfo_Get,Google一下就知道了:)希望有用
------解决方案--------------------
代码是这样子的:你只需要网上下载个MdeiaInfo.dll

#include "stdafx.h"
#include <windows.h>

typedef enum MediaInfo_stream_t
{
MediaInfo_Stream_General,
MediaInfo_Stream_Video,
MediaInfo_Stream_Audio,
MediaInfo_Stream_Text,
MediaInfo_Stream_Chapters,
MediaInfo_Stream_Image,
MediaInfo_Stream_Menu,
MediaInfo_Stream_Max
} MediaInfo_stream_C;

/** @brief Kinds of Info */
typedef enum MediaInfo_info_t
{
MediaInfo_Info_Name,
MediaInfo_Info_Text,
MediaInfo_Info_Measure,
MediaInfo_Info_Options,
MediaInfo_Info_Name_Text,
MediaInfo_Info_Measure_Text,
MediaInfo_Info_Info,
MediaInfo_Info_HowTo,
MediaInfo_Info_Max
} MediaInfo_info_C;

/** @brief Option if InfoKind = Info_Options */
typedef enum MediaInfo_infooptions_t
{
MediaInfo_InfoOption_ShowInInform,
MediaInfo_InfoOption_Reserved,
MediaInfo_InfoOption_ShowInSupported,
MediaInfo_InfoOption_TypeOfValue,
MediaInfo_InfoOption_Max
} MediaInfo_infooptions_C;

/** @brief File opening options */
typedef enum MediaInfo_fileoptions_t
{
MediaInfo_FileOption_Nothing =0x00,
MediaInfo_FileOption_NoRecursive =0x01,
MediaInfo_FileOption_CloseAll =0x02,
MediaInfo_FileOption_Max =0x04
} MediaInfo_fileoptions_C;

int _tmain(int argc, _TCHAR* argv[])
{
HINSTANCE hInstance = LoadLibrary(_T("MediaInfo.dll"));
if (hInstance == NULL)
printf("Failed at LoadLibrary\n");

typedef void* (WINAPI *FUNC_NEW)(void);
FUNC_NEW MediaInfo_New;
MediaInfo_New = (FUNC_NEW)GetProcAddress(hInstance, "MediaInfo_New");
if (MediaInfo_New == NULL)
printf ("Failed at MediaInfo_New\n");
HANDLE handle = (*MediaInfo_New)();

typedef size_t (WINAPI *FUNC_OPEN)(void*, const wchar_t*);
FUNC_OPEN MediaInfo_Open = (FUNC_OPEN)GetProcAddress(hInstance, "MediaInfo_Open");
if (MediaInfo_Open == NULL)
printf ("Failed at MediaInfo_Open\n");
(*MediaInfo_Open)(handle, _T("C:\\Documents and Settings\\gxu18\\My Documents\\My Videos\\Hot.Summer.Days.2010.CN.DVDRip.Xvid-XTM\\xtm-hsd.avi"));

typedef wchar_t* (WINAPI *FUNC_INFORM)(void*, size_t);
FUNC_INFORM MediaInfo_Inform = (FUNC_INFORM)GetProcAddress(hInstance, "MediaInfo_Inform");
if (MediaInfo_Inform == NULL)
printf ("Failed at MediaInfo_Inform\n");
wprintf(_T("%s\n"), (*MediaInfo_Inform)(handle, 0));

typedef wchar_t* (WINAPI *FUNC_GET)(void*, MediaInfo_stream_t, size_t, const wchar_t*, MediaInfo_info_C, MediaInfo_info_C);
FUNC_GET MediaInfo_Get = (FUNC_GET)GetProcAddress(hInstance, "MediaInfo_Get");
if (MediaInfo_Get == NULL)
printf ("Failed at MediaInfo_Open\n");
wprintf(_T("%s\n"), (*MediaInfo_Get)(handle, MediaInfo_Stream_Video, 0, _T("Width"), MediaInfo_Info_Text, MediaInfo_Info_Name));
wprintf(_T("%s\n"), (*MediaInfo_Get)(handle, MediaInfo_Stream_Video, 0, _T("Height"), MediaInfo_Info_Text, MediaInfo_Info_Name));

typedef void (WINAPI *FUNC_CLOSE)(void*);
FUNC_CLOSE MediaInfo_Close = (FUNC_CLOSE)GetProcAddress(hInstance, "MediaInfo_Close");
友情提示:
信息收集于互联网,如果您发现错误或造成侵权,请及时通知本站更正或删除,具体联系方式见页面底部联系我们,谢谢。

其他相似内容:

热门推荐: