ponchio / untrunc

Restore a damaged (truncated) mp4, m4v, mov, 3gp video. Provided you have a similar not broken video.
GNU General Public License v2.0
1.63k stars 229 forks source link

error on compiling #22

Open roopa01 opened 9 years ago

roopa01 commented 9 years ago

i compiled this code but gives error "_CFDictionaryCreate", referenced from: _ff_vda_decoder_decode in libavcodec.a(vda.o) "_CFRelease", referenced from: _ff_vda_decoder_decode in libavcodec.a(vda.o i donot know what is the reason for this error

ponchio commented 9 years ago

I need some more information to guess where is the problem.

Operating system, libavcodec version, command line and the whole log of the errors....

On Wed, Mar 11, 2015 at 9:43 AM, roopa01 notifications@github.com wrote:

i compiled this code but gives error "_CFDictionaryCreate", referenced from: _ff_vda_decoder_decode in libavcodec.a(vda.o) "_CFRelease", referenced from: _ff_vda_decoder_decode in libavcodec.a(vda.o i donot know what is the reason for this error

— Reply to this email directly or view it on GitHub https://github.com/ponchio/untrunc/issues/22.

roopa01 commented 9 years ago

i am using snow leopard. Libavcodec version 0.8.16
i compiled it on terminal follow all information which is given on link but is gives error

Priyankur-Chauhans-Mac-Pro-2:untrunc-master root# g++ -o untrunc file.cpp main.cpp track.cpp atom.cpp mp4.cpp -I./libav-0.8.7 -L./libav-0.8.7/libavformat -lavformat -L./libav-0.8.7/libavcodec -lavcodec -L./libav-0.8.7/libavutil -lavutil -lpthread -lz track.cpp: In member function ‘void Track::parse(Atom, Atom)’: track.cpp:363: warning: ‘avcodec_open’ is deprecated (declared at ./libav-0.8.7/libavcodec/avcodec.h:4035) track.cpp:363: warning: ‘avcodec_open’ is deprecated (declared at ./libav-0.8.7/libavcodec/avcodec.h:4035) Undefined symbols: "_avcodec_decode_audio4", referenced from: Codec::getLength(unsigned char*, int)in ccpy7y0U.o "_avformat_find_stream_info", referenced from: Mp4::open(std::basic_string<char, std::char_traits, std::allocator >)in cctfGLJc.o ld: symbol(s) not found collect2: ld returned 1 exit status

Is it necessary to install ffmpeg before running these commonds . I tried many methods to build ffmpeg but in all cases it gives "_avcodec_decode_audio4", referenced from: this type of error means all functions which i am using from this library it gives error on all functions. thanks in advance

roopa01 commented 9 years ago

when i build this code using qmake -spec macx-g++ qmake -spec macx-xcode qmake &&make it gives the following output g++ -c -pipe -g -gdwarf-2 -arch i386 -Wall -W -I/usr/local/Qt4.6/mkspecs/macx-g++ -I. -I/usr/include -I. -o main.o main.cppg++ -c -pipe -g -gdwarf-2 -arch i386 -Wall -W -I/usr/local/Qt4.6/mkspecs/macx-g++ -I. -I/usr/include -I. -o atom.o atom.cpp g++ -c -pipe -g -gdwarf-2 -arch i386 -Wall -W -I/usr/local/Qt4.6/mkspecs/macx-g++ -I. -I/usr/include -I. -o mp4.o mp4.cpp mp4.cpp: In member function ‘void Mp4::repair(std::string)’: mp4.cpp:281: warning: unused variable ‘next’ g++ -c -pipe -g -gdwarf-2 -arch i386 -Wall -W -I/usr/local/Qt4.6/mkspecs/macx-g++ -I. -I/usr/include -I. -o file.o file.cpp g++ -c -pipe -g -gdwarf-2 -arch i386 -Wall -W -I/usr/local/Qt4.6/mkspecs/macx-g++ -I. -I/usr/include -I. -o track.o track.cpp track.cpp: In member function ‘void Codec::parse(Atom, std::vector<int, std::allocator >&, Atom)’: track.cpp:62: warning: comparison between signed and unsigned integer expressions track.cpp: At global scope: track.cpp:80: warning: unused parameter ‘maxlength’ track.cpp:295: warning: unused parameter ‘maxlength’ track.cpp: In member function ‘void Track::parse(Atom, Atom)’: track.cpp:351: warning: unused variable ‘audio’ track.cpp: In member function ‘void Track::fixTimes()’: track.cpp:436: warning: comparison between signed and unsigned integer expressions track.cpp:437: warning: comparison between signed and unsigned integer expressions g++ -headerpad_max_install_names -arch i386 -o untrunc main.o atom.o mp4.o file.o track.o -L/Library/Frameworks -lz Undefined symbols: "_avcodec_decodeaudio4", referenced from: Codec::getLength(unsigned char, int)in track.o "_avformat_alloc_context", referenced from: Mp4::open(std::basic_string<char, std::char_traits, std::allocator >)in mp4.o "_avcodec_finddecoder", referenced from: Track::parse(Atom, Atom_) in track.o "_av_initpacket", referenced from: Codec::getLength(unsigned char, int)in track.o "_avcodecopen", referenced from: Track::parse(Atom, Atom_) in track.o "_avfreep", referenced from: Codec::getLength(unsigned char, int)in track.o "_av_register_all", referenced from: Mp4::open(std::basic_string<char, std::char_traits, std::allocator >)in mp4.o "_av_dump_format", referenced from: Mp4::open(std::basic_string<char, std::char_traits, std::allocator >)in mp4.o "_avcodec_allocframe", referenced from: Codec::getLength(unsigned char, int)in track.o "_avformat_open_input", referenced from: Mp4::open(std::basic_string<char, std::char_traits, std::allocator >)in mp4.o "_avformat_find_stream_info", referenced from: Mp4::open(std::basic_string<char, std::char_traits, std::allocator >)in mp4.o ld: symbol(s) not found collect2: ld returned 1 exit status make: *\ [untrunc] Error 1 plz tell me what is the problem with this.

ponchio commented 9 years ago

FIrst of all you should update to the latest version (to get rid of the avcodec_open warning.

My first guess would be that the include library the compiler is using ./libav-0.8.7/libavcodec/avcodec.h (as we can see from the first error), might not match the library used for link. (maybe the libav-0.8.7 where not compiled? or the library file is in a different path?)

To test that, launch the g++ line with the option -v, at the end of the output you should be able to see exacly which files are used.

g++ -v -o untrunc file.cpp main.cpp track.cpp atom.cpp mp4.cpp -I./libav-0.8.7 -L./libav-0.8.7/libavformat -lavformat -L./libav-0.8.7/libavcodec -lavcodec -L./libav-0.8.7/libavutil -lavutil -lpthread -lz

Ciao,

Federico

On Thu, Mar 12, 2015 at 9:14 AM, roopa01 notifications@github.com wrote:

when i build this code using qmake -spec macx-g++ qmake -spec macx-xcode qmake &&make it gives the following output g++ -c -pipe -g -gdwarf-2 -arch i386 -Wall -W -I/usr/local/Qt4.6/mkspecs/macx-g++ -I. -I/usr/include -I. -o main.o main.cppg++ -c -pipe -g -gdwarf-2 -arch i386 -Wall -W -I/usr/local/Qt4.6/mkspecs/macx-g++ -I. -I/usr/include -I. -o atom.o atom.cpp g++ -c -pipe -g -gdwarf-2 -arch i386 -Wall -W -I/usr/local/Qt4.6/mkspecs/macx-g++ -I. -I/usr/include -I. -o mp4.o mp4.cpp mp4.cpp: In member function ‘void Mp4::repair(std::string)’: mp4.cpp:281: warning: unused variable ‘next’ g++ -c -pipe -g -gdwarf-2 -arch i386 -Wall -W -I/usr/local/Qt4.6/mkspecs/macx-g++ -I. -I/usr/include -I. -o file.o file.cpp g++ -c -pipe -g -gdwarf-2 -arch i386 -Wall -W -I/usr/local/Qt4.6/mkspecs/macx-g++ -I. -I/usr/include -I. -o track.o track.cpp track.cpp: In member function ‘void Codec::parse(Atom, std::vector >&, Atom)’: track.cpp:62: warning: comparison between signed and unsigned integer expressions track.cpp: At global scope: track.cpp:80: warning: unused parameter ‘maxlength’ track.cpp:295: warning: unused parameter ‘maxlength’ track.cpp: In member function ‘void Track::parse(Atom, Atom)’: track.cpp:351: warning: unused variable ‘audio’ track.cpp: In member function ‘void Track::fixTimes()’: track.cpp:436: warning: comparison between signed and unsigned integer expressions track.cpp:437: warning: comparison between signed and unsigned integer expressions g++ -headerpad_max_install_names -arch i386 -o untrunc main.o atom.o mp4.o file.o track.o -L/Library/Frameworks -lz Undefined symbols: "_avcodec_decode_audio4", referenced from: Codec::getLength(unsigned char

_, int)in track.o "_avformat_alloc_context", referenced from: Mp4::open(std::basic_string, std::allocator >)in mp4.o "_avcodec_finddecoder", referenced from: Track::parse(Atom, Atom

_) in track.o "_av_initpacket", referenced from: Codec::getLength(unsigned char, int)in track.o "_avcodecopen", referenced from: Track::parse(Atom, Atom_) in track.o "_av_freep", referenced from: Codec::getLength(unsigned char

_, int)in track.o "_av_register_all", referenced from: Mp4::open(std::basic_string, std::allocator >)in mp4.o "_av_dump_format", referenced from: Mp4::open(std::basic_string, std::allocator >)in mp4.o "_avcodec_allocframe", referenced from: Codec::getLength(unsigned char, int)in track.o "_avformat_open_input", referenced from: Mp4::open(std::basic_string, std::allocator >)in mp4.o "_avformat_find_stream_info", referenced from: Mp4::open(std::basic_string, std::allocator >)in mp4.o ld: symbol(s) not found collect2: ld returned 1 exit status make: *\ [untrunc] Error 1 plz tell me what is the problem with this.

— Reply to this email directly or view it on GitHub https://github.com/ponchio/untrunc/issues/22#issuecomment-78438923.

roopa01 commented 9 years ago

i want to use ffmpeg version 2.3.6 on 64 bit mac , snow leopard. i dont know how to complie this. I used this http://hunterford.me/compiling-ffmpeg-on-mac-os-x/ but faac,lame,libogg,pkg-config,libvorbis,libtheora,yasm,libvpx,last_x264,xvidcore-1.3.2 version are not comptiable for this ffmpeg version . kindly tell me which version would be correct for compilation of ffmpeg 2.3.6.

ponchio commented 9 years ago

Ciao, I have no idea how to compile ffmpeg on the mac, sorry.

To compile untrunc you need only the libav libraries. (i have tested successfully with 0.8.7, 0.8.16, 9.17, 10.5, while with 11.2 is not compiling at the moment.

Sorry, I am afraid google is your only option....

Federico

On Fri, Mar 13, 2015 at 7:48 AM, roopa01 notifications@github.com wrote:

i want to use ffmpeg version 2.3.6 on 64 bit mac , snow leopard. i dont know how to complie this. I used this http://hunterford.me/compiling-ffmpeg-on-mac-os-x/ but faac,lame,libogg,pkg-config,libvorbis,libtheora,yasm,libvpx,last_x264,xvidcore-1.3.2 version are not comptiable for this ffmpeg version . kindly tell me which version would be correct for compilation of ffmpeg 2.3.6.

— Reply to this email directly or view it on GitHub https://github.com/ponchio/untrunc/issues/22#issuecomment-78836550.

roopa01 commented 9 years ago

how to make uninstall ffmpeg and its all dependent dylib files from snow leopard.

ponchio commented 9 years ago

what?

karona75 commented 9 years ago

if you have built it from source, cd to the make file directory and run sudo make uninstall.

bgerstle commented 8 years ago

I was able to compile untrunc with the following setup:

by doing the following:

Granted, I haven't really run untrunc on anything meaningful yet, but this thought this might help the next person.

bgerstle commented 8 years ago

Sorry, I forgot to mention some other modifications:

#ifndef __UNTRUNC_ENDIAN_H__
#define __UNTRUNC_ENDIAN_H__ 1

/** compatibility header for endian.h
 * This is a simple compatibility shim to convert
 * BSD/Linux endian macros to the Mac OS X equivalents.
 * It is public domain.
 * */

#ifndef __APPLE__
    #warning "This header file (endian.h) is MacOS X specific.\n"
#endif  /* __APPLE__ */

#include <libkern/OSByteOrder.h>

#define htobe16(x) OSSwapHostToBigInt16(x)
#define htole16(x) OSSwapHostToLittleInt16(x)
#define be16toh(x) OSSwapBigToHostInt16(x)
#define le16toh(x) OSSwapLittleToHostInt16(x)

#define htobe32(x) OSSwapHostToBigInt32(x)
#define htole32(x) OSSwapHostToLittleInt32(x)
#define be32toh(x) OSSwapBigToHostInt32(x)
#define le32toh(x) OSSwapLittleToHostInt32(x)

#define htobe64(x) OSSwapHostToBigInt64(x)
#define htole64(x) OSSwapHostToLittleInt64(x)
#define be64toh(x) OSSwapBigToHostInt64(x)
#define le64toh(x) OSSwapLittleToHostInt64(x)

#endif  /* __UNTRUNC_ENDIAN_H__ */

I replaced all the old endian includes by running: sed -i'' -e 's:\<endian\.h\>:"endian.h":g' *.cpp