Giter VIP home page Giter VIP logo

Comments (4)

jcul avatar jcul commented on May 26, 2024

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.

from untrunc.

ragesoss avatar ragesoss commented on May 26, 2024

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.

from untrunc.

alejandro-colomar avatar alejandro-colomar commented on May 26, 2024

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;
                     ^~~~~

from untrunc.

brandon-dacrib avatar brandon-dacrib commented on May 26, 2024

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

from untrunc.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.