Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/ssh/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
FFmpeg avcodec_查找_编码器问题_Ffmpeg - Fatal编程技术网

FFmpeg avcodec_查找_编码器问题

FFmpeg avcodec_查找_编码器问题,ffmpeg,Ffmpeg,我是ffmpeg的新手 我的问题是“avcodec\u find\u encoder(CODEC\u ID\u H264);”func总是返回null。 ffmpeg配置在我的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: --ena

我是ffmpeg的新手

我的问题是“avcodec\u find\u encoder(CODEC\u ID\u H264);”func总是返回null。

ffmpeg配置在我的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_编码器(CODEC_ID_H264);必须返回非空的内容。。。 请告诉我如何解决这个问题

ps)我在程序中调用avcodec_init()和av_register_all()

当我编译我的测试程序时,使用下面的

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

谢谢

在您配置之后,我发现h264不包含在ffmpeg的已启用编码器中,而包含在ffmpeg的已启用解码器中。也许这就是为什么“avcodec\u find\u编码器(CODEC\u ID\u H264)”不能工作的原因。它是有线的。

确保调用了以下两个函数

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

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

调用
avcodec\u register\u all()
为我解决了这个问题


在windows 7上使用msvc10,FFmpeg版本:2012-11-05 git-c995644

FFmpeg版本:2012-11-05 git-c995644启用的编码器:libx264,来自我的./configure-但仍然找不到编码器。