<div dir="ltr">This is my code: (i got it from the internet, and modified it)<br>------------------------<br><br>#ifndef INT64_C<br>#define INT64_C(c) (c ## LL)<br>#define UINT64_C(c) (c ## ULL)<br>#endif<br><br><br>#ifdef __cplusplus<br>
extern "C"<br>{<br>#include "libavdevice/avdevice.h"<br>#include "libavformat/avformat.h"<br>#include "libavcodec/avcodec.h"<br>#include "libavutil/avutil.h"<br><br><br><br>
}<br>#endif<br><br><br>#include <stdlib.h><br><br><br><br><br>///TODO: Decode the packets into frames and find their frame type (I, B, P)<br>int main(int argc, char **argv)<br>{<br>/// indexs and loop<br>int video_index, audio_index, i, picture;<br>
char *filename = "bunny.mp4";<br>AVFrame *frame = avcodec_alloc_frame();<br><br>/// avcodec_ and avdevice_ must also be called or else the program will error<br>avcodec_register_all();<br>avdevice_register_all();<br>
av_register_all();<br><br>AVFormatContext *ic;<br>AVPacket pkt1, *pkt = &pkt1; /// Gives pkt a dummy value so it's not NULL<br>AVCodecContext *enc = NULL; /// Holds a single stream (codec)<br>AVCodec *codec;<br><br>
/// open the file<br>if(av_open_input_file(&ic, filename, NULL, 0, NULL) < 0)<br>return -1;<br><br>/// get the information on the streams<br>if(av_find_stream_info(ic) < 0)<br>return -1;<br>picture=0;<br>/// find the index for video and audio<br>
for(i = 0; i < ic->nb_streams; i++) {<br>enc = ic->streams[i]->codec;<br>switch(enc->codec_type) {<br>case AVMEDIA_TYPE_AUDIO:<br>audio_index = i;<br>break;<br>case AVMEDIA_TYPE_VIDEO:<br>video_index = i;<br>
break;<br>default:<br>break;<br>}<br>}<br><br>/// Shows information about the file<br>dump_format(ic, 0, filename, 0);<br><br>/// read ALLL frames and get their types<br>/// decoding --> encoding section<br>codec = avcodec_find_decoder(ic->streams[video_index]->codec->codec_id);<br>
enc = avcodec_alloc_context();<br>if (!codec ||<br>avcodec_open(enc, codec) < 0)<br>return -1;<br>i = 0; /// counts the frames encountered<br>while (1) {<br>if(av_read_frame(ic, pkt) < 0)<br>break;<br><br>if(pkt->stream_index == video_index) {<br>
avcodec_decode_video2(enc, frame, &picture, pkt);<br>if(picture) {<br>switch(frame->pict_type) {<br>case FF_I_TYPE:<br>printf("I frame\n");<br>break;<br>case FF_B_TYPE:<br>printf("B frame\n");<br>
break;<br>case FF_P_TYPE:<br>printf("P frame\n");<br>break;<br>default:<br>printf("Unknown frame\n");<br>}<br>i++;<br>}<br>}<br><br>av_free_packet( pkt);<br>}<br>printf("Number of frames: %d\n", i);<br>
printf("Video stream index: %d\nAudio stream index: %d\n", video_index, audio_index);<br><br>return 0;<br>}<br><br><br>This is what I am getting as exceptions:<br>----------------------------------------------------------<br>
<br>/usr/local/lib/libavdevice.a(alsa-audio-dec.o): In function `audio_read_packet':<br>/home/mounir/Downloads/ffmpeg/libavdevice/alsa-audio-dec.c:108: undefined reference to `snd_pcm_readi'<br>/home/mounir/Downloads/ffmpeg/libavdevice/alsa-audio-dec.c:125: undefined reference to `snd_pcm_delay'<br>
/home/mounir/Downloads/ffmpeg/libavdevice/alsa-audio-dec.c:115: undefined reference to `snd_strerror'<br>/usr/local/lib/libavdevice.a(alsa-audio-dec.o): In function `audio_read_header':<br>/home/mounir/Downloads/ffmpeg/libavdevice/alsa-audio-dec.c:93: undefined reference to `snd_pcm_close'<br>
/usr/local/lib/libavdevice.a(alsa-audio-enc.o): In function `audio_get_output_timestamp':<br>/home/mounir/Downloads/ffmpeg/libavdevice/alsa-audio-enc.c:112: undefined reference to `snd_pcm_delay'<br>/usr/local/lib/libavdevice.a(alsa-audio-enc.o): In function `audio_write_packet':<br>
/home/mounir/Downloads/ffmpeg/libavdevice/alsa-audio-enc.c:88: undefined reference to `snd_pcm_writei'<br>/home/mounir/Downloads/ffmpeg/libavdevice/alsa-audio-enc.c:95: undefined reference to `snd_strerror'<br>/usr/local/lib/libavdevice.a(alsa-audio-enc.o): In function `audio_write_header':<br>
/home/mounir/Downloads/ffmpeg/libavdevice/alsa-audio-enc.c:69: undefined reference to `snd_pcm_close'<br>/usr/local/lib/libavdevice.a(lavfi.o): In function `lavfi_read_packet':<br>/home/mounir/Downloads/ffmpeg/libavdevice/lavfi.c:239: undefined reference to `av_buffersink_get_buffer_ref'<br>
/home/mounir/Downloads/ffmpeg/libavdevice/lavfi.c:253: undefined reference to `av_buffersink_get_buffer_ref'<br>/home/mounir/Downloads/ffmpeg/libavdevice/lavfi.c:268: undefined reference to `avfilter_unref_buffer'<br>
/usr/local/lib/libavdevice.a(lavfi.o): In function `lavfi_read_close':<br>/home/mounir/Downloads/ffmpeg/libavdevice/lavfi.c:73: undefined reference to `avfilter_graph_free'<br>/usr/local/lib/libavdevice.a(lavfi.o): In function `lavfi_read_header':<br>
/home/mounir/Downloads/ffmpeg/libavdevice/lavfi.c:89: undefined reference to `avfilter_register_all'<br>/home/mounir/Downloads/ffmpeg/libavdevice/lavfi.c:91: undefined reference to `avfilter_get_by_name'<br>/home/mounir/Downloads/ffmpeg/libavdevice/lavfi.c:101: undefined reference to `avfilter_graph_alloc'<br>
/home/mounir/Downloads/ffmpeg/libavdevice/lavfi.c:104: undefined reference to `avfilter_graph_parse'<br>/home/mounir/Downloads/ffmpeg/libavdevice/lavfi.c:176: undefined reference to `av_buffersink_params_alloc'<br>
/home/mounir/Downloads/ffmpeg/libavdevice/lavfi.c:183: undefined reference to `avfilter_graph_create_filter'<br>/home/mounir/Downloads/ffmpeg/libavdevice/lavfi.c:192: undefined reference to `avfilter_link'<br>/home/mounir/Downloads/ffmpeg/libavdevice/lavfi.c:197: undefined reference to `avfilter_graph_config'<br>
/home/mounir/Downloads/ffmpeg/libavdevice/lavfi.c:218: undefined reference to `avfilter_inout_free'<br>/home/mounir/Downloads/ffmpeg/libavdevice/lavfi.c:219: undefined reference to `avfilter_inout_free'<br>/usr/local/lib/libavdevice.a(alsa-audio-common.o): In function `ff_alsa_xrun_recover':<br>
/home/mounir/Downloads/ffmpeg/libavdevice/alsa-audio-common.c:334: undefined reference to `snd_pcm_prepare'<br>/home/mounir/Downloads/ffmpeg/libavdevice/alsa-audio-common.c:336: undefined reference to `snd_strerror'<br>
/usr/local/lib/libavdevice.a(alsa-audio-common.o): In function `ff_alsa_open':<br>/home/mounir/Downloads/ffmpeg/libavdevice/alsa-audio-common.c:213: undefined reference to `snd_pcm_open'<br>/home/mounir/Downloads/ffmpeg/libavdevice/alsa-audio-common.c:215: undefined reference to `snd_strerror'<br>
/home/mounir/Downloads/ffmpeg/libavdevice/alsa-audio-common.c:220: undefined reference to `snd_pcm_hw_params_malloc'<br>/home/mounir/Downloads/ffmpeg/libavdevice/alsa-audio-common.c:222: undefined reference to `snd_strerror'<br>
/home/mounir/Downloads/ffmpeg/libavdevice/alsa-audio-common.c:227: undefined reference to `snd_pcm_hw_params_any'<br>/home/mounir/Downloads/ffmpeg/libavdevice/alsa-audio-common.c:229: undefined reference to `snd_strerror'<br>
/home/mounir/Downloads/ffmpeg/libavdevice/alsa-audio-common.c:234: undefined reference to `snd_pcm_hw_params_set_access'<br>/home/mounir/Downloads/ffmpeg/libavdevice/alsa-audio-common.c:236: undefined reference to `snd_strerror'<br>
/home/mounir/Downloads/ffmpeg/libavdevice/alsa-audio-common.c:241: undefined reference to `snd_pcm_hw_params_set_format'<br>/home/mounir/Downloads/ffmpeg/libavdevice/alsa-audio-common.c:243: undefined reference to `snd_strerror'<br>
/home/mounir/Downloads/ffmpeg/libavdevice/alsa-audio-common.c:248: undefined reference to `snd_pcm_hw_params_set_rate_near'<br>/home/mounir/Downloads/ffmpeg/libavdevice/alsa-audio-common.c:250: undefined reference to `snd_strerror'<br>
/home/mounir/Downloads/ffmpeg/libavdevice/alsa-audio-common.c:255: undefined reference to `snd_pcm_hw_params_set_channels'<br>/home/mounir/Downloads/ffmpeg/libavdevice/alsa-audio-common.c:257: undefined reference to `snd_strerror'<br>
/home/mounir/Downloads/ffmpeg/libavdevice/alsa-audio-common.c:262: undefined reference to `snd_pcm_hw_params_get_buffer_size_max'<br>/home/mounir/Downloads/ffmpeg/libavdevice/alsa-audio-common.c:265: undefined reference to `snd_pcm_hw_params_set_buffer_size_near'<br>
/home/mounir/Downloads/ffmpeg/libavdevice/alsa-audio-common.c:267: undefined reference to `snd_strerror'<br>/home/mounir/Downloads/ffmpeg/libavdevice/alsa-audio-common.c:272: undefined reference to `snd_pcm_hw_params_get_period_size_min'<br>
/home/mounir/Downloads/ffmpeg/libavdevice/alsa-audio-common.c:275: undefined reference to `snd_pcm_hw_params_set_period_size_near'<br>/home/mounir/Downloads/ffmpeg/libavdevice/alsa-audio-common.c:277: undefined reference to `snd_strerror'<br>
/home/mounir/Downloads/ffmpeg/libavdevice/alsa-audio-common.c:283: undefined reference to `snd_pcm_hw_params'<br>/home/mounir/Downloads/ffmpeg/libavdevice/alsa-audio-common.c:285: undefined reference to `snd_strerror'<br>
/home/mounir/Downloads/ffmpeg/libavdevice/alsa-audio-common.c:290: undefined reference to `snd_pcm_hw_params_free'<br>/home/mounir/Downloads/ffmpeg/libavdevice/alsa-audio-common.c:311: undefined reference to `snd_pcm_hw_params_free'<br>
/home/mounir/Downloads/ffmpeg/libavdevice/alsa-audio-common.c:313: undefined reference to `snd_pcm_close'<br>/usr/local/lib/libavdevice.a(alsa-audio-common.o): In function `ff_alsa_close':<br>/home/mounir/Downloads/ffmpeg/libavdevice/alsa-audio-common.c:323: undefined reference to `snd_pcm_close'<br>
/usr/local/lib/libavcodec.a(cscd.o): In function `decode_frame':<br>/home/mounir/Downloads/ffmpeg/libavcodec/cscd.c:171: undefined reference to `uncompress'<br>/usr/local/lib/libavcodec.a(dxa.o): In function `decode_frame':<br>
/home/mounir/Downloads/ffmpeg/libavcodec/dxa.c:236: undefined reference to `uncompress'<br>/usr/local/lib/libavcodec.a(flashsv.o): In function `flashsv_decode_block':<br>/home/mounir/Downloads/ffmpeg/libavcodec/flashsv.c:165: undefined reference to `inflateReset'<br>
/usr/local/lib/libavcodec.a(flashsv.o): In function `flashsv2_prime':<br>/home/mounir/Downloads/ffmpeg/libavcodec/flashsv.c:138: undefined reference to `inflate'<br>/home/mounir/Downloads/ffmpeg/libavcodec/flashsv.c:140: undefined reference to `deflateInit_'<br>
/home/mounir/Downloads/ffmpeg/libavcodec/flashsv.c:145: undefined reference to `deflate'<br>/home/mounir/Downloads/ffmpeg/libavcodec/flashsv.c:146: undefined reference to `deflateEnd'<br>/home/mounir/Downloads/ffmpeg/libavcodec/flashsv.c:148: undefined reference to `inflateReset'<br>
/home/mounir/Downloads/ffmpeg/libavcodec/flashsv.c:154: undefined reference to `inflate'<br>/usr/local/lib/libavcodec.a(flashsv.o): In function `flashsv_decode_block':<br>/home/mounir/Downloads/ffmpeg/libavcodec/flashsv.c:177: undefined reference to `inflate'<br>
/home/mounir/Downloads/ffmpeg/libavcodec/flashsv.c:180: undefined reference to `inflateSync'<br>/home/mounir/Downloads/ffmpeg/libavcodec/flashsv.c:181: undefined reference to `inflate'<br>/usr/local/lib/libavcodec.a(flashsv.o): In function `calc_deflate_block_size':<br>
/home/mounir/Downloads/ffmpeg/libavcodec/flashsv.c:222: undefined reference to `deflateInit_'<br>/home/mounir/Downloads/ffmpeg/libavcodec/flashsv.c:224: undefined reference to `deflateBound'<br>/home/mounir/Downloads/ffmpeg/libavcodec/flashsv.c:225: undefined reference to `deflateEnd'<br>
/usr/local/lib/libavcodec.a(flashsv.o): In function `flashsv_decode_end':<br>/home/mounir/Downloads/ffmpeg/libavcodec/flashsv.c:443: undefined reference to `inflateEnd'<br>/usr/local/lib/libavcodec.a(flashsv.o): In function `flashsv_decode_init':<br>
/home/mounir/Downloads/ffmpeg/libavcodec/flashsv.c:112: undefined reference to `inflateInit_'<br>/usr/local/lib/libavcodec.a(flashsv2enc.o): In function `encode_zlib':<br>/home/mounir/Downloads/ffmpeg/libavcodec/flashsv2enc.c:337: undefined reference to `compress2'<br>
/usr/local/lib/libavcodec.a(flashsv2enc.o): In function `encode_zlibprime':<br>/home/mounir/Downloads/ffmpeg/libavcodec/flashsv2enc.c:349: undefined reference to `deflateInit_'<br>/home/mounir/Downloads/ffmpeg/libavcodec/flashsv2enc.c:358: undefined reference to `deflate'<br>
/home/mounir/Downloads/ffmpeg/libavcodec/flashsv2enc.c:367: undefined reference to `deflate'<br>/home/mounir/Downloads/ffmpeg/libavcodec/flashsv2enc.c:368: undefined reference to `deflateEnd'<br>/usr/local/lib/libavcodec.a(flashsvenc.o): In function `encode_bitstream':<br>
/home/mounir/Downloads/ffmpeg/libavcodec/flashsvenc.c:169: undefined reference to `compress2'<br>/usr/local/lib/libavcodec.a(flashsvenc.o): In function `flashsv_encode_end':<br>/home/mounir/Downloads/ffmpeg/libavcodec/flashsvenc.c:269: undefined reference to `deflateEnd'<br>
/usr/local/lib/libavcodec.a(lcldec.o): In function `zlib_decomp':<br>/home/mounir/Downloads/ffmpeg/libavcodec/lcldec.c:131: undefined reference to `inflateReset'<br>/home/mounir/Downloads/ffmpeg/libavcodec/lcldec.c:140: undefined reference to `inflate'<br>
/home/mounir/Downloads/ffmpeg/libavcodec/lcldec.c:131: undefined reference to `inflateReset'<br>/home/mounir/Downloads/ffmpeg/libavcodec/lcldec.c:140: undefined reference to `inflate'<br>/home/mounir/Downloads/ffmpeg/libavcodec/lcldec.c:131: undefined reference to `inflateReset'<br>
/home/mounir/Downloads/ffmpeg/libavcodec/lcldec.c:140: undefined reference to `inflate'<br>/usr/local/lib/libavcodec.a(lcldec.o): In function `decode_end':<br>/home/mounir/Downloads/ffmpeg/libavcodec/lcldec.c:606: undefined reference to `inflateEnd'<br>
/usr/local/lib/libavcodec.a(lcldec.o): In function `decode_init':<br>/home/mounir/Downloads/ffmpeg/libavcodec/lcldec.c:580: undefined reference to `inflateInit_'<br>/usr/local/lib/libavcodec.a(lclenc.o): In function `encode_frame':<br>
/home/mounir/Downloads/ffmpeg/libavcodec/lclenc.c:87: undefined reference to `deflateReset'<br>/home/mounir/Downloads/ffmpeg/libavcodec/lclenc.c:98: undefined reference to `deflate'<br>/home/mounir/Downloads/ffmpeg/libavcodec/lclenc.c:104: undefined reference to `deflate'<br>
/usr/local/lib/libavcodec.a(lclenc.o): In function `encode_end':<br>/home/mounir/Downloads/ffmpeg/libavcodec/lclenc.c:168: undefined reference to `deflateEnd'<br>/usr/local/lib/libavcodec.a(lclenc.o): In function `encode_init':<br>
/home/mounir/Downloads/ffmpeg/libavcodec/lclenc.c:149: undefined reference to `deflateInit_'<br>/usr/local/lib/libavcodec.a(pngdec.o): In function `decode_frame':<br>/home/mounir/Downloads/ffmpeg/libavcodec/pngdec.c:431: undefined reference to `inflateInit_'<br>
/home/mounir/Downloads/ffmpeg/libavcodec/pngdec.c:658: undefined reference to `inflateEnd'<br>/usr/local/lib/libavcodec.a(pngdec.o): In function `png_decode_idat':<br>/home/mounir/Downloads/ffmpeg/libavcodec/pngdec.c:383: undefined reference to `inflate'<br>
/usr/local/lib/libavcodec.a(pngenc.o): In function `encode_frame':<br>/home/mounir/Downloads/ffmpeg/libavcodec/pngenc.c:287: undefined reference to `deflateInit2_'<br>/usr/local/lib/libavcodec.a(pngenc.o): In function `png_write_chunk':<br>
/home/mounir/Downloads/ffmpeg/libavcodec/pngenc.c:199: undefined reference to `crc32'<br>/home/mounir/Downloads/ffmpeg/libavcodec/pngenc.c:201: undefined reference to `crc32'<br>/home/mounir/Downloads/ffmpeg/libavcodec/pngenc.c:204: undefined reference to `crc32'<br>
/usr/local/lib/libavcodec.a(pngenc.o): In function `png_write_row':<br>/home/mounir/Downloads/ffmpeg/libavcodec/pngenc.c:219: undefined reference to `deflate'<br>/usr/local/lib/libavcodec.a(pngenc.o): In function `png_write_chunk':<br>
/home/mounir/Downloads/ffmpeg/libavcodec/pngenc.c:199: undefined reference to `crc32'<br>/home/mounir/Downloads/ffmpeg/libavcodec/pngenc.c:201: undefined reference to `crc32'<br>/home/mounir/Downloads/ffmpeg/libavcodec/pngenc.c:204: undefined reference to `crc32'<br>
/usr/local/lib/libavcodec.a(pngenc.o): In function `encode_frame':<br>/home/mounir/Downloads/ffmpeg/libavcodec/pngenc.c:418: undefined reference to `deflateEnd'<br>/home/mounir/Downloads/ffmpeg/libavcodec/pngenc.c:396: undefined reference to `deflate'<br>
/usr/local/lib/libavcodec.a(pngenc.o): In function `png_write_chunk':<br>/home/mounir/Downloads/ffmpeg/libavcodec/pngenc.c:199: undefined reference to `crc32'<br>/home/mounir/Downloads/ffmpeg/libavcodec/pngenc.c:201: undefined reference to `crc32'<br>
/home/mounir/Downloads/ffmpeg/libavcodec/pngenc.c:204: undefined reference to `crc32'<br>/home/mounir/Downloads/ffmpeg/libavcodec/pngenc.c:199: undefined reference to `crc32'<br>/home/mounir/Downloads/ffmpeg/libavcodec/pngenc.c:201: undefined reference to `crc32'<br>
/usr/local/lib/libavcodec.a(pngenc.o): In function `png_write_row':<br>/home/mounir/Downloads/ffmpeg/libavcodec/pngenc.c:219: undefined reference to `deflate'<br>/usr/local/lib/libavcodec.a(pngenc.o): In function `png_write_chunk':<br>
/home/mounir/Downloads/ffmpeg/libavcodec/pngenc.c:199: undefined reference to `crc32'<br>/home/mounir/Downloads/ffmpeg/libavcodec/pngenc.c:201: undefined reference to `crc32'<br>/home/mounir/Downloads/ffmpeg/libavcodec/pngenc.c:204: undefined reference to `crc32'<br>
/home/mounir/Downloads/ffmpeg/libavcodec/pngenc.c:199: undefined reference to `crc32'<br>/home/mounir/Downloads/ffmpeg/libavcodec/pngenc.c:201: undefined reference to `crc32'<br>/usr/local/lib/libavcodec.a(pngenc.o):/home/mounir/Downloads/ffmpeg/libavcodec/pngenc.c:204: more undefined references to `crc32' follow<br>
/usr/local/lib/libavcodec.a(svq3.o): In function `svq3_decode_init':<br>/home/mounir/Downloads/ffmpeg/libavcodec/svq3.c:906: undefined reference to `uncompress'<br>/usr/local/lib/libavcodec.a(tiff.o): In function `tiff_uncompress':<br>
/home/mounir/Downloads/ffmpeg/libavcodec/tiff.c:98: undefined reference to `inflate'<br>/home/mounir/Downloads/ffmpeg/libavcodec/tiff.c:99: undefined reference to `inflateEnd'<br>/home/mounir/Downloads/ffmpeg/libavcodec/tiff.c:93: undefined reference to `inflateInit_'<br>
/usr/local/lib/libavcodec.a(tscc.o): In function `decode_frame':<br>/home/mounir/Downloads/ffmpeg/libavcodec/tscc.c:91: undefined reference to `inflateReset'<br>/home/mounir/Downloads/ffmpeg/libavcodec/tscc.c:100: undefined reference to `inflate'<br>
/usr/local/lib/libavcodec.a(tscc.o): In function `decode_end':<br>/home/mounir/Downloads/ffmpeg/libavcodec/tscc.c:197: undefined reference to `inflateEnd'<br>/usr/local/lib/libavcodec.a(tscc.o): In function `decode_init':<br>
/home/mounir/Downloads/ffmpeg/libavcodec/tscc.c:173: undefined reference to `inflateInit_'<br>/usr/local/lib/libavcodec.a(zmbv.o): In function `decode_frame':<br>/home/mounir/Downloads/ffmpeg/libavcodec/zmbv.c:498: undefined reference to `inflate'<br>
/home/mounir/Downloads/ffmpeg/libavcodec/zmbv.c:472: undefined reference to `inflateReset'<br>/usr/local/lib/libavcodec.a(zmbv.o): In function `decode_end':<br>/home/mounir/Downloads/ffmpeg/libavcodec/zmbv.c:647: undefined reference to `inflateEnd'<br>
/usr/local/lib/libavcodec.a(zmbv.o): In function `decode_init':<br>/home/mounir/Downloads/ffmpeg/libavcodec/zmbv.c:623: undefined reference to `inflateInit_'<br>/usr/local/lib/libavcodec.a(zmbvenc.o): In function `encode_frame':<br>
/home/mounir/Downloads/ffmpeg/libavcodec/zmbvenc.c:144: undefined reference to `deflateReset'<br>/home/mounir/Downloads/ffmpeg/libavcodec/zmbvenc.c:233: undefined reference to `deflate'<br>/usr/local/lib/libavcodec.a(zmbvenc.o): In function `encode_end':<br>
/home/mounir/Downloads/ffmpeg/libavcodec/zmbvenc.c:320: undefined reference to `deflateEnd'<br>/usr/local/lib/libavcodec.a(zmbvenc.o): In function `encode_init':<br>/home/mounir/Downloads/ffmpeg/libavcodec/zmbvenc.c:297: undefined reference to `deflateInit_'<br>
/usr/local/lib/libavdevice.a(jack_audio.o): In function `process_callback':<br>/home/mounir/Downloads/ffmpeg/libavdevice/jack_audio.c:72: undefined reference to `jack_frames_since_cycle_start'<br>/home/mounir/Downloads/ffmpeg/libavdevice/jack_audio.c:93: undefined reference to `jack_port_get_total_latency'<br>
/home/mounir/Downloads/ffmpeg/libavdevice/jack_audio.c:94: undefined reference to `jack_port_get_buffer'<br>/home/mounir/Downloads/ffmpeg/libavdevice/jack_audio.c:104: undefined reference to `sem_post'<br>/usr/local/lib/libavdevice.a(jack_audio.o): In function `audio_read_packet':<br>
/home/mounir/Downloads/ffmpeg/libavdevice/jack_audio.c:262: undefined reference to `jack_activate'<br>/home/mounir/Downloads/ffmpeg/libavdevice/jack_audio.c:275: undefined reference to `sem_timedwait'<br>/usr/local/lib/libavdevice.a(jack_audio.o): In function `start_jack':<br>
/home/mounir/Downloads/ffmpeg/libavdevice/jack_audio.c:149: undefined reference to `jack_client_open'<br>/home/mounir/Downloads/ffmpeg/libavdevice/jack_audio.c:155: undefined reference to `sem_init'<br>/home/mounir/Downloads/ffmpeg/libavdevice/jack_audio.c:157: undefined reference to `jack_get_sample_rate'<br>
/home/mounir/Downloads/ffmpeg/libavdevice/jack_audio.c:159: undefined reference to `jack_get_buffer_size'<br>/home/mounir/Downloads/ffmpeg/libavdevice/jack_audio.c:165: undefined reference to `jack_port_register'<br>
/home/mounir/Downloads/ffmpeg/libavdevice/jack_audio.c:177: undefined reference to `jack_set_process_callback'<br>/home/mounir/Downloads/ffmpeg/libavdevice/jack_audio.c:179: undefined reference to `jack_set_xrun_callback'<br>
/home/mounir/Downloads/ffmpeg/libavdevice/jack_audio.c:171: undefined reference to `jack_client_close'<br>/home/mounir/Downloads/ffmpeg/libavdevice/jack_audio.c:191: undefined reference to `jack_client_close'<br>/usr/local/lib/libavdevice.a(jack_audio.o): In function `stop_jack':<br>
/home/mounir/Downloads/ffmpeg/libavdevice/jack_audio.c:213: undefined reference to `jack_deactivate'<br>/home/mounir/Downloads/ffmpeg/libavdevice/jack_audio.c:214: undefined reference to `jack_client_close'<br>/home/mounir/Downloads/ffmpeg/libavdevice/jack_audio.c:216: undefined reference to `sem_destroy'<br>
/home/mounir/Downloads/ffmpeg/libavdevice/jack_audio.c:214: undefined reference to `jack_client_close'<br>/home/mounir/Downloads/ffmpeg/libavdevice/jack_audio.c:216: undefined reference to `sem_destroy'<br>/home/mounir/Downloads/ffmpeg/libavdevice/jack_audio.c:213: undefined reference to `jack_deactivate'<br>
/usr/local/lib/libavdevice.a(sdl.o): In function `sdl_write_trailer':<br>/home/mounir/Downloads/ffmpeg/libavdevice/sdl.c:64: undefined reference to `SDL_FreeYUVOverlay'<br>/home/mounir/Downloads/ffmpeg/libavdevice/sdl.c:68: undefined reference to `SDL_Quit'<br>
/usr/local/lib/libavdevice.a(sdl.o): In function `sdl_write_packet':<br>/home/mounir/Downloads/ffmpeg/libavdevice/sdl.c:188: undefined reference to `SDL_MapRGB'<br>/home/mounir/Downloads/ffmpeg/libavdevice/sdl.c:188: undefined reference to `SDL_FillRect'<br>
/home/mounir/Downloads/ffmpeg/libavdevice/sdl.c:190: undefined reference to `SDL_LockYUVOverlay'<br>/home/mounir/Downloads/ffmpeg/libavdevice/sdl.c:195: undefined reference to `SDL_DisplayYUVOverlay'<br>/home/mounir/Downloads/ffmpeg/libavdevice/sdl.c:196: undefined reference to `SDL_UnlockYUVOverlay'<br>
/home/mounir/Downloads/ffmpeg/libavdevice/sdl.c:198: undefined reference to `SDL_UpdateRect'<br>/usr/local/lib/libavdevice.a(sdl.o): In function `sdl_write_header':<br>/home/mounir/Downloads/ffmpeg/libavdevice/sdl.c:86: undefined reference to `SDL_WasInit'<br>
/home/mounir/Downloads/ffmpeg/libavdevice/sdl.c:94: undefined reference to `SDL_Init'<br>/home/mounir/Downloads/ffmpeg/libavdevice/sdl.c:149: undefined reference to `SDL_WM_SetCaption'<br>/home/mounir/Downloads/ffmpeg/libavdevice/sdl.c:150: undefined reference to `SDL_SetVideoMode'<br>
/home/mounir/Downloads/ffmpeg/libavdevice/sdl.c:158: undefined reference to `SDL_CreateYUVOverlay'<br>/usr/local/lib/libavdevice.a(sdl.o): In function `sdl_write_trailer':<br>/home/mounir/Downloads/ffmpeg/libavdevice/sdl.c:64: undefined reference to `SDL_FreeYUVOverlay'<br>
/home/mounir/Downloads/ffmpeg/libavdevice/sdl.c:68: undefined reference to `SDL_Quit'<br>/usr/local/lib/libavdevice.a(sdl.o): In function `sdl_write_header':<br>/home/mounir/Downloads/ffmpeg/libavdevice/sdl.c:95: undefined reference to `SDL_GetError'<br>
/home/mounir/Downloads/ffmpeg/libavdevice/sdl.c:153: undefined reference to `SDL_GetError'<br>/usr/local/lib/libavformat.a(matroskadec.o): In function `matroska_decode_buffer':<br>/home/mounir/Downloads/ffmpeg/libavformat/matroskadec.c:993: undefined reference to `inflateInit_'<br>
/home/mounir/Downloads/ffmpeg/libavformat/matroskadec.c:1003: undefined reference to `inflate'<br>/home/mounir/Downloads/ffmpeg/libavformat/matroskadec.c:1008: undefined reference to `inflateEnd'<br>/home/mounir/Downloads/ffmpeg/libavformat/matroskadec.c:1008: undefined reference to `inflateEnd'<br>
/usr/local/lib/libavformat.a(mov.o): In function `mov_read_cmov':<br>/home/mounir/Downloads/ffmpeg/libavformat/mov.c:2180: undefined reference to `uncompress'<br>/usr/local/lib/libavformat.a(udp.o): In function `udp_open':<br>
/home/mounir/Downloads/ffmpeg/libavformat/udp.c:519: undefined reference to `pthread_create'<br>/usr/local/lib/libavcodec.a(pthread.o): In function `frame_thread_free':<br>/home/mounir/Downloads/ffmpeg/libavcodec/pthread.c:645: undefined reference to `pthread_join'<br>
/usr/local/lib/libavcodec.a(pthread.o): In function `thread_free':<br>/home/mounir/Downloads/ffmpeg/libavcodec/pthread.c:179: undefined reference to `pthread_join'<br>/usr/local/lib/libavcodec.a(pthread.o): In function `frame_thread_init':<br>
/home/mounir/Downloads/ffmpeg/libavcodec/pthread.c:732: undefined reference to `pthread_create'<br>/usr/local/lib/libavcodec.a(pthread.o): In function `thread_init':<br>/home/mounir/Downloads/ffmpeg/libavcodec/pthread.c:256: undefined reference to `pthread_create'<br>
/usr/local/lib/libavcodec.a(tiffenc.o): In function `encode_strip':<br>/home/mounir/Downloads/ffmpeg/libavcodec/tiffenc.c:163: undefined reference to `compress'<br>/usr/local/lib/libavcodec.a(vaapi.o): In function `commit_slices':<br>
/home/mounir/Downloads/ffmpeg/libavcodec/vaapi.c:97: undefined reference to `vaCreateBuffer'<br>/home/mounir/Downloads/ffmpeg/libavcodec/vaapi.c:106: undefined reference to `vaCreateBuffer'<br>/usr/local/lib/libavcodec.a(vaapi.o): In function `alloc_buffer':<br>
/home/mounir/Downloads/ffmpeg/libavcodec/vaapi.c:125: undefined reference to `vaCreateBuffer'<br>/home/mounir/Downloads/ffmpeg/libavcodec/vaapi.c:127: undefined reference to `vaMapBuffer'<br>/home/mounir/Downloads/ffmpeg/libavcodec/vaapi.c:125: undefined reference to `vaCreateBuffer'<br>
/home/mounir/Downloads/ffmpeg/libavcodec/vaapi.c:127: undefined reference to `vaMapBuffer'<br>/home/mounir/Downloads/ffmpeg/libavcodec/vaapi.c:125: undefined reference to `vaCreateBuffer'<br>/home/mounir/Downloads/ffmpeg/libavcodec/vaapi.c:127: undefined reference to `vaMapBuffer'<br>
/usr/local/lib/libavcodec.a(vaapi.o): In function `destroy_buffers':<br>/home/mounir/Downloads/ffmpeg/libavcodec/vaapi.c:37: undefined reference to `vaDestroyBuffer'<br>/home/mounir/Downloads/ffmpeg/libavcodec/vaapi.c:37: undefined reference to `vaDestroyBuffer'<br>
/home/mounir/Downloads/ffmpeg/libavcodec/vaapi.c:37: undefined reference to `vaDestroyBuffer'<br>/home/mounir/Downloads/ffmpeg/libavcodec/vaapi.c:37: undefined reference to `vaDestroyBuffer'<br>/usr/local/lib/libavcodec.a(vaapi.o): In function `render_picture':<br>
/home/mounir/Downloads/ffmpeg/libavcodec/vaapi.c:48: undefined reference to `vaUnmapBuffer'<br>/home/mounir/Downloads/ffmpeg/libavcodec/vaapi.c:61: undefined reference to `vaBeginPicture'<br>/home/mounir/Downloads/ffmpeg/libavcodec/vaapi.c:52: undefined reference to `vaUnmapBuffer'<br>
/home/mounir/Downloads/ffmpeg/libavcodec/vaapi.c:57: undefined reference to `vaUnmapBuffer'<br>/home/mounir/Downloads/ffmpeg/libavcodec/vaapi.c:65: undefined reference to `vaRenderPicture'<br>/home/mounir/Downloads/ffmpeg/libavcodec/vaapi.c:69: undefined reference to `vaRenderPicture'<br>
/home/mounir/Downloads/ffmpeg/libavcodec/vaapi.c:74: undefined reference to `vaEndPicture'<br>collect2: ld returned 1 exit status<br>make[2]: *** [dist/Debug/GNU-Linux-x86/decoderapp] Error 1<br>make[1]: *** [.build-conf] Error 2<br>
make: *** [.build-impl] Error 2<br><br><br><br>Is it a problem in the directory from where i am getting the .a libs?? Where should I get them from if it is the case ?<br><br><br><div class="gmail_quote">On Sat, Oct 1, 2011 at 11:40 PM, jan hölscher <span dir="ltr"><<a href="mailto:jan.hoelscher@codergrid.de">jan.hoelscher@codergrid.de</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><p>Okt, could you give us  an example of which function name could not be resolved?</p>
<div class="gmail_quote">Am 01.10.2011 22:28 schrieb "mounir younes" <<a href="mailto:mounir.younes@gmail.com" target="_blank">mounir.younes@gmail.com</a>>:<div><div></div><div class="h5"><br type="attribution">
> i am using netbeans and in the libraries tab there is a linker command where<br>
> i am adding the libs i stated in the thread before. Netbeans is catching the<br>> libs (giving them a lib icon otherwise it would've given them a "blank"<br>> icon) but I am always getting the "undefined reference to <functionName>"<br>

> (when using ffmpeg functions). I would really appreciate it if someone can<br>> write a really really really small tutorial that shows how to build ur first<br>> ffmpeg program (using the latest ffmpeg) and run it. That would help a lot<br>

> of people other than me for a lot of people are having this problem and some<br>> others after updating ffmpeg.<br>> <br>> On Thu, Sep 29, 2011 at 1:39 AM, jan hölscher <<a href="mailto:jan.hoelscher@codergrid.de" target="_blank">jan.hoelscher@codergrid.de</a>>wrote:<br>

> <br>>> before we can discuss further, please provide the complete command line to<br>>> the linker and error from it.<br>>><br>>><br>>><br>>> 2011/9/29 mounir younes <<a href="mailto:mounir.younes@gmail.com" target="_blank">mounir.younes@gmail.com</a>><br>

>><br>>>> Yes I did that ! But still having the problem after building.<br>>>><br>>>><br>>>> On Wed, Sep 28, 2011 at 7:53 PM, jan hölscher <<a href="mailto:jan.hoelscher@codergrid.de" target="_blank">jan.hoelscher@codergrid.de</a><br>

>>> > wrote:<br>>>><br>>>>> did you surround your libav header includes with :<br>>>>><br>>>>> #ifdef __cplusplus<br>>>>> extern "C" {<br>>>>> #endif<br>

>>>> #include <libavformat/avformat.h><br>>>>> #include <libavcodec/avcodec.h><br>>>>> #include <libavcodec/opt.h><br>>>>> #include <libavutil/avutil.h><br>

>>>> #include <libswscale/swscale.h><br>>>>> #include <libavutil/fifo.h><br>>>>> #include <libavutil/rational.h><br>>>>> #ifdef __cplusplus<br>>>>> }<br>

>>>> #endif<br>>>>><br>>>>><br>>>>> 2011/9/28 mounir younes <<a href="mailto:mounir.younes@gmail.com" target="_blank">mounir.younes@gmail.com</a>><br>>>>><br>
>>>>> I gave the names without the linker prefix. I keep getting the<br>
>>>>> "undefined reference to" error and cannot solve it.<br>>>>>><br>>>>>> On Sat, Sep 24, 2011 at 10:43 PM, Alex Cohn <<a href="mailto:alexcohn@netvision.net.il" target="_blank">alexcohn@netvision.net.il</a>>wrote:<br>

>>>>><br>>>>>>> In your list of libs, "-l" is obviously doubled. Try to give the names<br>>>>>>> to the linker without the prefix.<br>>>>>>>  On Sep 24, 2011 7:58 AM, "mounir younes" <<a href="mailto:mounir.younes@gmail.com" target="_blank">mounir.younes@gmail.com</a>><br>

>>>>>> wrote:<br>>>>>>> > Hello, I am new to ffmpeg and I am getting compiling errors while<br>>>>>>> compiling<br>>>>>>> > c++ code with ffmpeg libraries. It seems that a lot of people are<br>

>>>>>> getting<br>>>>>>> > this with the new ffmpeg but I couldn't find a solution that I could<br>>>>>>> > understand.<br>>>>>>> ><br>
>>>>>> > I found a link that says that this<br>
>>>>>> ><br>>>>>>> > CXXFLAGS=-D__STDC_CONSTANT_MACROS ./configure<br>>>>>>> > (<a href="http://code.google.com/p/ffmpegsource/issues/detail?id=11" target="_blank">http://code.google.com/p/ffmpegsource/issues/detail?id=11</a>)<br>

>>>>>> ><br>>>>>>> ><br>>>>>>> > solves it but unfortunately I tried it but nothing happened and I<br>>>>>>> don't know<br>>>>>>> > what to do ! I am adding the file headers which are being<br>

>>>>>> automatically<br>>>>>>> > detected by netbeans so the libraries are already found. I tried<br>>>>>>> adding<br>>>>>>> > these -lavdevice -lavformat -lavcodec -lavutil -lswscale -lbz2 to the<br>

>>>>>> > linker as well<br>>>>>>> ><br>>>>>>> > (<br>>>>>>> ><br>>>>>>> <a href="http://libav-users.943685.n4.nabble.com/QT-and-FFmpeg-undefined-reference-to-av-free-and-more-td946811.html" target="_blank">http://libav-users.943685.n4.nabble.com/QT-and-FFmpeg-undefined-reference-to-av-free-and-more-td946811.html</a><br>

>>>>>> > )<br>>>>>>> ><br>>>>>>> > when adding them netbeans knew them and gave them proper library<br>>>>>>> icons (thus<br>>>>>>> > it recognized that these libraries are present otherwise it would've<br>

>>>>>> > replaced them with a white icon with question mark). But, when<br>>>>>>> compiling I<br>>>>>>> > get this<br>>>>>>> ><br>>>>>>> > /usr/bin/ld: cannot find -l-lavdevice<br>

>>>>>> > /usr/bin/ld: cannot find -l-lavformat<br>>>>>>> > /usr/bin/ld: cannot find -l-lavcodec<br>>>>>>> > /usr/bin/ld: cannot find -l-lavutil<br>>>>>>> > /usr/bin/ld: cannot find -l-lswscale<br>

>>>>>> > /usr/bin/ld: cannot find -l-lbz2<br>>>>>>> ><br>>>>>>> > And this is really killing me. I have been trying to solve this for<br>>>>>>> days.<br>

>>>>>> ><br>>>>>>> > Thank you in advance.<br>>>>>>><br>>>>>>> _______________________________________________<br>>>>>>> Libav-user mailing list<br>

>>>>>> <a href="mailto:Libav-user@ffmpeg.org" target="_blank">Libav-user@ffmpeg.org</a><br>>>>>>> <a href="http://ffmpeg.org/mailman/listinfo/libav-user" target="_blank">http://ffmpeg.org/mailman/listinfo/libav-user</a><br>

>>>>>><br>>>>>>><br>>>>>><br>>>>>> _______________________________________________<br>>>>>> Libav-user mailing list<br>>>>>> <a href="mailto:Libav-user@ffmpeg.org" target="_blank">Libav-user@ffmpeg.org</a><br>

>>>>> <a href="http://ffmpeg.org/mailman/listinfo/libav-user" target="_blank">http://ffmpeg.org/mailman/listinfo/libav-user</a><br>>>>>><br>>>>>><br>>>>><br>>>>> _______________________________________________<br>

>>>> Libav-user mailing list<br>>>>> <a href="mailto:Libav-user@ffmpeg.org" target="_blank">Libav-user@ffmpeg.org</a><br>>>>> <a href="http://ffmpeg.org/mailman/listinfo/libav-user" target="_blank">http://ffmpeg.org/mailman/listinfo/libav-user</a><br>

>>>><br>>>>><br>>>><br>>>> _______________________________________________<br>>>> Libav-user mailing list<br>>>> <a href="mailto:Libav-user@ffmpeg.org" target="_blank">Libav-user@ffmpeg.org</a><br>

>>> <a href="http://ffmpeg.org/mailman/listinfo/libav-user" target="_blank">http://ffmpeg.org/mailman/listinfo/libav-user</a><br>>>><br>>>><br>>><br>>> _______________________________________________<br>

>> Libav-user mailing list<br>>> <a href="mailto:Libav-user@ffmpeg.org" target="_blank">Libav-user@ffmpeg.org</a><br>>> <a href="http://ffmpeg.org/mailman/listinfo/libav-user" target="_blank">http://ffmpeg.org/mailman/listinfo/libav-user</a><br>

>><br>>><br></div></div></div>
<br>_______________________________________________<br>
Libav-user mailing list<br>
<a href="mailto:Libav-user@ffmpeg.org">Libav-user@ffmpeg.org</a><br>
<a href="http://ffmpeg.org/mailman/listinfo/libav-user" target="_blank">http://ffmpeg.org/mailman/listinfo/libav-user</a><br>
<br></blockquote></div><br></div>