profile
viewpoint

Ask questionsCannot compile, using ffmpeg from sources

Hello, I'm using Ubuntu 18.04, did a clean install in a virtual machine. I downloaded libvpx from sources, compiled and installed without any problems. Then I downloaded ffmpeg source (from git, from git clone https://git.ffmpeg.org/ffmpeg.git ffmpeg), and compiled it (passing --enable-libvpx to it), make compiled without any issues, and did a make install.

When I try to make the 0_hello_world.c, make gives me the following error: (you can check the output with a better looking text at https://pastebin.com/wPKY99ue )

mkdir build gcc -g -Wall -o build/hello_world -lavformat -lavcodec -lswscale -lavutil -lz 0_hello_world.c
&& ./build/hello_world small_bunny_1080p_60fps.mp4` 0_hello_world.c: In function ‘main’: 0_hello_world.c:35:3: warning: ‘av_register_all’ is deprecated [-Wdeprecated-declarations] av_register_all(); ^~~~~~~~~~~~~~~ In file included from 0_hello_world.c:15:0: /usr/local/include/libavformat/avformat.h:2033:6: note: declared here void av_register_all(void); ^~~~~~~~~~~~~~~ /tmp/ccbsfyh8.o: In function 'av_make_error_string': /usr/local/include/libavutil/error.h:111: undefined reference to 'av_strerror' /tmp/ccbsfyh8.o: In function 'main': /home/xultz/libav/ffmpeg-libav-tutorial/0_hello_world.c:35: undefined reference to 'av_register_all' /home/xultz/libav/ffmpeg-libav-tutorial/0_hello_world.c:40: undefined reference to 'avformat_alloc_context' /home/xultz/libav/ffmpeg-libav-tutorial/0_hello_world.c:54: undefined reference to 'avformat_open_input' /home/xultz/libav/ffmpeg-libav-tutorial/0_hello_world.c:73: undefined reference to 'avformat_find_stream_info' /home/xultz/libav/ffmpeg-libav-tutorial/0_hello_world.c:103: undefined reference to 'avcodec_find_decoder' /home/xultz/libav/ffmpeg-libav-tutorial/0_hello_world.c:125: undefined reference to 'avcodec_alloc_context3' /home/xultz/libav/ffmpeg-libav-tutorial/0_hello_world.c:134: undefined reference to 'avcodec_parameters_to_context' /home/xultz/libav/ffmpeg-libav-tutorial/0_hello_world.c:142: undefined reference to 'avcodec_open2' /home/xultz/libav/ffmpeg-libav-tutorial/0_hello_world.c:149: undefined reference to 'av_frame_alloc' /home/xultz/libav/ffmpeg-libav-tutorial/0_hello_world.c:156: undefined reference to 'av_packet_alloc' /home/xultz/libav/ffmpeg-libav-tutorial/0_hello_world.c:180: undefined reference to 'av_packet_unref' /home/xultz/libav/ffmpeg-libav-tutorial/0_hello_world.c:168: undefined reference to 'av_read_frame' /home/xultz/libav/ffmpeg-libav-tutorial/0_hello_world.c:185: undefined reference to 'avformat_close_input' /home/xultz/libav/ffmpeg-libav-tutorial/0_hello_world.c:186: undefined reference to 'avformat_free_context' /home/xultz/libav/ffmpeg-libav-tutorial/0_hello_world.c:187: undefined reference to 'av_packet_free' /home/xultz/libav/ffmpeg-libav-tutorial/0_hello_world.c:188: undefined reference to 'av_frame_free' /home/xultz/libav/ffmpeg-libav-tutorial/0_hello_world.c:189: undefined reference to 'avcodec_free_context' /tmp/ccbsfyh8.o: In function 'decode_packet': /home/xultz/libav/ffmpeg-libav-tutorial/0_hello_world.c:207: undefined reference to 'avcodec_send_packet' /home/xultz/libav/ffmpeg-libav-tutorial/0_hello_world.c:218: undefined reference to 'avcodec_receive_frame' /home/xultz/libav/ffmpeg-libav-tutorial/0_hello_world.c:230: undefined reference to 'av_get_picture_type_char' /home/xultz/libav/ffmpeg-libav-tutorial/0_hello_world.c:242: undefined reference to 'av_frame_unref' collect2: error: ld returned 1 exit status Makefile:4: recipe for target 'hello_world' failed make: *** [hello_world] Error 1

I took a look at pkg-config outputs from --libs and --cflags for some libs (lib libavformat, libavutil, etc) and I changed the gcc line on the Makefile to the following, but I couldn't see any changes on the make output: gcc -g -Wall -I/usr/local/include -o build/hello_world -L/usr/local/lib -lavformat -lavcodec -lswscale -lavutil -lz -lvpx -lm -lswresample -pthread 0_hello_world.c

What else can I do in order to compile the code?

Thank you in advance for any help!

leandromoreira/ffmpeg-libav-tutorial

Answer questions vandanachadha

For me, the following worked: gcc -g -Wall -L/home/vandana/ffmpeg/ /home/vandana/ipdecoder/ffmpeg_custom/transcoding.c /home/vandana/ipdecoder/ffmpeg_custom/video_debugging.c -lavformat -lavcodec -lx264 -lavdevice -lavfilter -lavutil -lswscale -lswresample -lm -lz -lpthread -o /home/vandana/ipdecoder/ffmpeg_custom/build/transcoding

useful!

Related questions

No questions were found.
source:https://uonfu.com/
Github User Rank List