2011-01-17 16 views
4

私はffmpegの初心者です。FFmpeg avcodec_find_encoderの問題

私の問題は「avcodec_find_encoder(CODEC_ID_H264);」です。 funcは常にnullを返します。

ffmpeg configureは私のubuntuシステムの下にあります。

./ffmpeg 
FFmpeg version SVN-r26306, Copyright (c) 2000-2011 the FFmpeg developers 
    built on Jan 11 2011 10:34:49 with gcc 4.4.5 
    configuration: --enable-gpl --enable-version3 --enable-nonfree --enable-postproc --enable-libfaac --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxvid --enable-x11grab 
    libavutil  50.36. 0/50.36. 0 
    libavcore  0.16. 0/0.16. 0 
    libavcodec 52.108. 0/52.108. 0 
    libavformat 52.92. 0/52.92. 0 
    libavdevice 52. 2. 3/52. 2. 3 
    libavfilter 1.72. 0/1.72. 0 
    libswscale  0.12. 0/0.12. 0 
    libpostproc 51. 2. 0/51. 2. 0 

、設定が--enable-libx264

が含まれているあなたが見ることができるように、私はavcodec_find_encoder(CODEC_ID_H264)だと思います。ヌルではない何かを返す必要があります... 私はこの問題を解決する方法を教えてください?

ps)私のプログラムでavcodec_init()とav_register_all()を呼び出します。

私は私のテストプログラムをコンパイルし、自分の設定した後

gcc -o test test.c -lavutil -lavformat -lavcodec -lx264 -lz -lm 

おかげ

答えて

1

の下に使用して、私はそれが中に含まれている間H264は、ffmpegのの有効エンコーダに含まれていないことがわかりますffmpegのデコーダを有効にします。おそらくそれが "avcodec_find_encoder(CODEC_ID_H264)"が機能しない理由です。それは有線です。

+0

有効エンコーダ: libx264 私は./configureからだ - とエンコーダがまだ見つかっていません。 –

0

次の2つの関数が呼び出されたことを確認してください。

/* must be called before using avcodec lib */ 
    avcodec_init(); 

    /* register all the codecs */ 
    avcodec_register_all(); 
9

avcodec_register_all()が私のために解決しました。 FFmpegのバージョンを使用してWindows 7を超える

使用してmsvc10:2012年11月5日のgit-c995644

+0

FFmpegバージョン:2012-11-05 git-c995644 – marksman171

関連する問題