Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error while compiling it on Linux Arch #3

Closed
SimonSimCity opened this issue Sep 27, 2013 · 4 comments
Closed

Error while compiling it on Linux Arch #3

SimonSimCity opened this issue Sep 27, 2013 · 4 comments
Assignees

Comments

@SimonSimCity
Copy link

Hi,

Today I tried to compile this script on Linux Arch and got the following error:

[root@aristoteles untrunc-master]# g++ -o untrunc file.cpp main.cpp track.cpp atom.cpp mp4.cpp -L/usr/local/lib -lavformat -lavcodec -lavutil
track.cpp: In member function ‘void Track::parse(Atom*, Atom*)’:
track.cpp:211:47: error: ‘avcodec_open’ was not declared in this scope
     if(avcodec_open(codec.context, codec.codec)<0)
                                               ^

Is there a dependency missing? Should not, as I have ffmpeg installed, what also requires the libs you included for ubuntu.

@ghost ghost assigned ponchio Sep 30, 2013
@jcul
Copy link

jcul commented Nov 19, 2013

You need to tell the compiler where to look for the includes and libraries.

On arch linux, it's /usr/lib and /usr/include. However, this didn't work for me, as I think in the latest version of libavcodec the deprecated function avcodec_open has been removed.

g++ -o untrunc file.cpp main.cpp track.cpp atom.cpp mp4.cpp -I/usr/include -L/usr/lib -lavformat -lavcodec -lavutil

I had to change it to use the ones that seem to be provided with ffmpeg-compat.

So install ffmpeg-compat, and then the following should work (or at least it did for me).

g++ -o untrunc file.cpp main.cpp track.cpp atom.cpp mp4.cpp -I/usr/include/ffmpeg-compat -L/usr/lib/ffmpeg-compat -lavformat -lavcodec -lavutil

Unfortunately untrunc wasn't able to fix my friend's mp4. It got it playing with just audio and no video.

@ragesoss
Copy link

ragesoss commented Feb 5, 2014

Any tips on getting around the avcodec_open problem on Debian?

UPDATE: Nevermind, I looked at some of the other issues and am now trying thye manual installation of libav.

@alejandro-colomar
Copy link

Did you manage to install on Debian?

I am getting these errors:

# g++ -o untrunc file.cpp main.cpp track.cpp atom.cpp mp4.cpp -L/usr/local/lib -lavformat -lavcodec -lavutil
track.cpp:30:0: warning: "__STDC_LIMIT_MACROS" redefined
 #define __STDC_LIMIT_MACROS 1

In file included from /usr/include/c++/6/cstdint:41:0,
                 from /usr/include/c++/6/bits/char_traits.h:420,
                 from /usr/include/c++/6/string:40,
                 from track.h:25,
                 from track.cpp:21:
/usr/lib/gcc/x86_64-linux-gnu/6/include/stdint.h:5:0: note: this is the location of the previous definition
 #  define __STDC_LIMIT_MACROS

track.cpp:31:0: warning: "__STDC_CONSTANT_MACROS" redefined
 #define __STDC_CONSTANT_MACROS 1

In file included from /usr/include/c++/6/cstdint:41:0,
                 from /usr/include/c++/6/bits/char_traits.h:420,
                 from /usr/include/c++/6/string:40,
                 from track.h:25,
                 from track.cpp:21:
/usr/lib/gcc/x86_64-linux-gnu/6/include/stdint.h:7:0: note: this is the location of the previous definition
 #  define __STDC_CONSTANT_MACROS

track.cpp: In member function ‘int Codec::getLength(unsigned char*, int)’:
track.cpp:204:40: error: ‘avcodec_alloc_frame’ was not declared in this scope
   AVFrame *frame = avcodec_alloc_frame();
                                        ^
track.cpp:213:18: warning: ‘int avcodec_decode_audio4(AVCodecContext*, AVFrame*, int*, const AVPacket*)’ is deprecated [-Wdeprecated-declarations]
   int consumed = avcodec_decode_audio4(context, frame, &got_frame, &avp);
                  ^~~~~~~~~~~~~~~~~~~~~
In file included from track.cpp:40:0:
/usr/include/x86_64-linux-gnu/libavcodec/avcodec.h:4704:5: note: declared here
 int avcodec_decode_audio4(AVCodecContext *avctx, AVFrame *frame,
     ^~~~~~~~~~~~~~~~~~~~~
track.cpp:213:72: warning: ‘int avcodec_decode_audio4(AVCodecContext*, AVFrame*, int*, const AVPacket*)’ is deprecated [-Wdeprecated-declarations]
   int consumed = avcodec_decode_audio4(context, frame, &got_frame, &avp);
                                                                        ^
In file included from track.cpp:40:0:
/usr/include/x86_64-linux-gnu/libavcodec/avcodec.h:4704:5: note: declared here
 int avcodec_decode_audio4(AVCodecContext *avctx, AVFrame *frame,
     ^~~~~~~~~~~~~~~~~~~~~
track.cpp: In member function ‘void Track::parse(Atom*, Atom*)’:
track.cpp:391:59: warning: ‘AVCodecContext::codec_name’ is deprecated [-Wdeprecated-declarations]
   throw string("Could not open codec: ") + codec.context->codec_name;
                                                           ^~~~~~~~~~
In file included from track.cpp:40:0:
/usr/include/x86_64-linux-gnu/libavcodec/avcodec.h:1664:35: note: declared here
     char             codec_name[32];
                                   ^
track.cpp:391:59: warning: ‘AVCodecContext::codec_name’ is deprecated [-Wdeprecated-declarations]
   throw string("Could not open codec: ") + codec.context->codec_name;
                                                           ^~~~~~~~~~
In file included from track.cpp:40:0:
/usr/include/x86_64-linux-gnu/libavcodec/avcodec.h:1664:35: note: declared here
     char             codec_name[32];
                                   ^
track.cpp:391:59: warning: ‘AVCodecContext::codec_name’ is deprecated [-Wdeprecated-declarations]
   throw string("Could not open codec: ") + codec.context->codec_name;
                                                           ^~~~~~~~~~
In file included from track.cpp:40:0:
/usr/include/x86_64-linux-gnu/libavcodec/avcodec.h:1664:35: note: declared here
     char             codec_name[32];
                                   ^
mp4.cpp:25:0: warning: "__STDC_LIMIT_MACROS" redefined
 #define __STDC_LIMIT_MACROS 1

In file included from /usr/include/c++/6/cstdint:41:0,
                 from /usr/include/c++/6/bits/char_traits.h:420,
                 from /usr/include/c++/6/string:40,
                 from mp4.cpp:22:
/usr/lib/gcc/x86_64-linux-gnu/6/include/stdint.h:5:0: note: this is the location of the previous definition
 #  define __STDC_LIMIT_MACROS

mp4.cpp:26:0: warning: "__STDC_CONSTANT_MACROS" redefined
 #define __STDC_CONSTANT_MACROS 1

In file included from /usr/include/c++/6/cstdint:41:0,
                 from /usr/include/c++/6/bits/char_traits.h:420,
                 from /usr/include/c++/6/string:40,
                 from mp4.cpp:22:
/usr/lib/gcc/x86_64-linux-gnu/6/include/stdint.h:7:0: note: this is the location of the previous definition
 #  define __STDC_CONSTANT_MACROS

mp4.cpp: In member function ‘void Mp4::parseTracks()’:
mp4.cpp:278:46: warning: ‘AVStream::codec’ is deprecated [-Wdeprecated-declarations]
   track.codec.context = context->streams[i]->codec;
                                              ^~~~~
In file included from mp4.cpp:30:0:
/usr/include/x86_64-linux-gnu/libavformat/avformat.h:880:21: note: declared here
     AVCodecContext *codec;
                     ^~~~~
mp4.cpp:278:46: warning: ‘AVStream::codec’ is deprecated [-Wdeprecated-declarations]
   track.codec.context = context->streams[i]->codec;
                                              ^~~~~
In file included from mp4.cpp:30:0:
/usr/include/x86_64-linux-gnu/libavformat/avformat.h:880:21: note: declared here
     AVCodecContext *codec;
                     ^~~~~
mp4.cpp:278:46: warning: ‘AVStream::codec’ is deprecated [-Wdeprecated-declarations]
   track.codec.context = context->streams[i]->codec;
                                              ^~~~~
In file included from mp4.cpp:30:0:
/usr/include/x86_64-linux-gnu/libavformat/avformat.h:880:21: note: declared here
     AVCodecContext *codec;
                     ^~~~~

@brandon-dacrib
Copy link
Collaborator

You should try the dockerized build which was recently merged into master.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants