Archive for the ‘编解码’ Category.

h264文件播放器,vlc播放h264文件

目前网上没有几款好用的h264裸流播放器,将h264流保存成文件后,需要用播放器查看h264码流图像,以前老版本的vlc是可以直接打开h264文件的,新版本不能直接打开,需要做一些设置也能打开了。

首先打开菜单工具-》首选项

1
Continue reading ‘h264文件播放器,vlc播放h264文件’ »

windows安装MinGW

MinGW(Minimalist GNU for Windows),又称mingw32,是将GCC编译器和GNU Binutils移植到Win32平台下的产物,包括一系列头文件(Win32API)、库和可执行文件。MinGW是从Cygwin(1.3.3版)基础上发展而来。下面介绍MinGW的安装。

首先下载MinGW,可在官方网站www.mingw.org上下载,或点击此处下载,下载完成后,双击安装,选择安装包mingw-developer-toolkit、mingw32-base、mingw32-gcc-g++、msys-base,如下图

1

然后打开Installation菜单中的Apply进行自动下载安装。安装完成后,进入到MinGW的msys目录中,运行msys.bat,这样就能在windows环境中编译一些linux的库了。

windows使用MinGW编译faac库

下载mingw并安装,然后下载faac库,版本为Version 1.28 bootstrapped TAR.BZ2 Package,下载后进行解压,运行MinGW,进入到faac-1.28目录中,此时如果直接configure编译,会提示

mpeg4ip_win32.h:70: error: `_TRUNCATE' was not declared in this scope
mpeg4ip_win32.h:70: error: `vsnprintf_s' was not declared in this scope
mpeg4ip_win32.h:70: warning: unused variable '_TRUNCATE'
mpeg4ip_win32.h:70: warning: unused variable 'vsnprintf_s'
In file included from mp4common.h:32,
                 from 3gp.cpp:28:
mp4util.h: In function `void Indent(FILE*, u_int8_t)':
mp4util.h:82: error: `fprintf_s' was not declared in this scope
mp4util.h:82: warning: unused variable 'fprintf_s'
make[3]: *** [3gp.o] Error 1
make[3]: Leaving directory `/d/faac-1.28/common/mp4v2'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/d/faac-1.28/common'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/d/faac-1.28'
make: *** [all] Error 2

Continue reading ‘windows使用MinGW编译faac库’ »

vs2005调用ffmpeg库执行av_register_all出错崩溃

今天下载了1.2版本的FFmpeg库,在官方网站有一个链接,可以下载到编译好的windows版本的库。下载下来后,写了一段程序,在main函数中执行到函数av_register_all(),直接崩溃,提示Unhandled exception at 0x00905a51 in main.exe: 0xC000001D: Illegal Instruction,工程是Release版本的,调用代码如下:

#include <stdio.h>

#include <libavformat/avformat.h>
#include <libavutil/dict.h>

int main (int argc, char **argv)
{
    AVFormatContext *fmt_ctx = NULL;
    AVDictionaryEntry *tag = NULL;
    int ret;

    if (argc != 2) {
        printf("usage: %s <input_file>\n"
               "example program to demonstrate the use of the libavformat metadata API.\n"
               "\n", argv[0]);
        return 1;
    }

    av_register_all();
    if ((ret = avformat_open_input(&fmt_ctx, argv[1], NULL, NULL)))
        return ret;

    while ((tag = av_dict_get(fmt_ctx->metadata, "", tag, AV_DICT_IGNORE_SUFFIX)))
        printf("%s=%s\n", tag->key, tag->value);

    avformat_close_input(&fmt_ctx);
    return 0;
}

Continue reading ‘vs2005调用ffmpeg库执行av_register_all出错崩溃’ »

使用SDL+FFMPEG将视频绑定到指定窗口显示颜色失真

在学习使用SDL+FFMPEG来制作简易播放器时,发现将图像显示到指定窗口上时,颜色会出现失真情况,设置窗口大小代码如下:

RECT wrect;
GetWindowRect((HWND)m_hwnd, &wrect);
m_nWidth = wrect.right - wrect.left;
m_nHeight = wrect.bottom - wrect.top;
m_surface = SDL_SetVideoMode(m_nWidth, m_nHeight, 0, 0);

Continue reading ‘使用SDL+FFMPEG将视频绑定到指定窗口显示颜色失真’ »