Comments (4)
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.
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.
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.
You should try the dockerized build which was recently merged into master.
from untrunc.
Related Issues (20)
- Feature request: Support for motion data recovery from the text track HOT 2
- macOS12.6 Monterey build error Apple clang version 14.0.0 (clang-1400.0.29.202)
- [MAC OS MONTEREY 12.6.1] zsh: permission denied: ./untrunc
- i cant recover this file using untrunc-gui, here is the whole message but at the final the file result is also corrupted.
- Opus support Request. HOT 2
- recovers only 12% of truncated file HOT 1
- Recovered only 1s of the a 180s video HOT 1
- Assertion `end - begin == length' failed HOT 1
- Two audio streams are being combined into one HOT 11
- Created Recorver file, but that file has no data. HOT 1
- mathops.h:125: Error: operand type mismatch for `shr' HOT 6
- how do I uninstall? I don't see any support on that in the Installation info HOT 1
- No codec found? HOT 1
- Two Tracks Get Combined To Create Distorted Audio HOT 2
- Building on macOS produces error HOT 2
- No codec found!
- Additional macOS steps I had to run HOT 1
- Repaired video "too long" and won't play HOT 6
- install instructions out of date
- Cannot restore footage with AAC-ELD stream HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from untrunc.