2013-10-02 3 views
2

안녕하세요. 저는 Cffmpeg 라이브러리를 사용하여 비디오를 인코딩하려고합니다.libavformat/ffmpeg c 프로그램 "적합하지 않은 입력 형식"

[NULL @ 0x7ff574006600] Requested output format 'mp4' is not a suitable output format

내가 내는 FFmpeg은 간단한

ffmpeg -i test.mov test.mp4

같이 x264 플래그로 컴파일 것을 알고 : 나는 형식 컨텍스트를 만들려고 할 때 어떤 이유로, 나는에 오류가

이 정상적으로 작동합니다. 나는 또한 생성 된 pch 파일과 libav 라이브러리의 모든 것들을 링크하고있다. 다음은 오류의 내가 잡 해요와 전체 작업 예제 :

#include <libavformat/avformat.h> 
#include <libavcodec/avcodec.h> 
#include <libavutil/avutil.h> 
#include <libswscale/swscale.h> 
#include <libavutil/opt.h> 
#include <libswscale/swscale.h> 
#include <libavutil/imgutils.h> 

#include <stdio.h> 

int main() { 

    AVFormatContext * output = NULL; 

    // now lets initialize the actual format element 
    if (avformat_alloc_output_context2(&output, NULL, "mp4", "test.mp4") < 0) { 

     printf("%s", "INVALID"); 
    } 

    return 0; 

} 

답변

2

당신은

av_register_all(); 

전에 출력 컨텍스트를 할당에 전화를해야합니다.