Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

FFmpeg avcodec_find_encoder problem

Tags:

ffmpeg

I'm newbie in ffmpeg.

my problem is "avcodec_find_encoder(CODEC_ID_H264);" func always returning null.

ffmpeg configure is below on my ubuntu system.

./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

as you can see, configuration contains --enable-libx264

so I think avcodec_find_encoder(CODEC_ID_H264); have to return something not null... please let me know how to solve this problem?

ps) I call avcodec_init() and av_register_all() in my program.

when I compile my test program, using below

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

thanks

like image 558
net Avatar asked Jan 17 '11 01:01

net


2 Answers

calling avcodec_register_all() solved it for me.

using msvc10 over windows 7 with FFmpeg version: 2012-11-05 git-c995644

like image 136
marksman171 Avatar answered Nov 01 '22 22:11

marksman171


After your configure, I find that h264 is not contained in the the enabled encoders of ffmpeg, while it is contained in the enabled decoders of ffmpeg. Maybe that's the reason why "avcodec_find_encoder(CODEC_ID_H264)" does not work. It's wired.

like image 1
max Avatar answered Nov 01 '22 22:11

max