Skip to main content
added 35 characters in body
Source Link

@sparrowt Your current instructions did not work on my recent Ubuntu 16.10 installation. I got the following error while compilining untrunc:

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();

As explained in the untrunc repository, you might need to download libav separately rather than using the version in the Ubuntu repository. The following code worked for me:

sudo apt-get install unzip yasm g++ zlib1g-dev libbz2-dev
cd /tmp/
wget https://github.com/ponchio/untrunc/archive/master.zip
unzip master.zip
cd untrunc-master
wget http://libav.org/releases/libav-0.812.72.tar.xz
tar xvf libav-0.812.72.tar.xz
cd libav-0.812.72
./configure
make
cd ..
g++ -o untrunc file.cpp main.cpp track.cpp atom.cpp mp4.cpp -I./libav-0.812.72 -L./libav-0.812.72/libavformat -lavformat -L./libav-0.812.72/libavcodec -lavcodec -L./libav-012.82/libavresample -lavresample -L.7/libav-12.2/libavutil -lavutil -lpthread -lz -lbz2
./untrunc /path/to/working-video.mp4 /path/to/broken-video.mp4

This created a file called broken-video_fixed.mp4 that worked for me. Thank you so much for initiating this thread.

@sparrowt Your current instructions did not work on my recent Ubuntu 16.10 installation. I got the following error while compilining untrunc:

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();

As explained in the untrunc repository, you might need to download libav separately rather than using the version in the Ubuntu repository. The following code worked for me:

sudo apt-get install unzip yasm g++
cd /tmp/
wget https://github.com/ponchio/untrunc/archive/master.zip
unzip master.zip
cd untrunc-master
wget http://libav.org/releases/libav-0.8.7.tar.xz
tar xvf libav-0.8.7.tar.xz
cd libav-0.8.7
./configure
make
cd ..
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
./untrunc /path/to/working-video.mp4 /path/to/broken-video.mp4

This created a file called broken-video_fixed.mp4 that worked for me. Thank you so much for initiating this thread.

@sparrowt Your current instructions did not work on my recent Ubuntu 16.10 installation. I got the following error while compilining untrunc:

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();

As explained in the untrunc repository, you might need to download libav separately rather than using the version in the Ubuntu repository. The following code worked for me:

sudo apt-get install unzip yasm g++ zlib1g-dev libbz2-dev
cd /tmp/
wget https://github.com/ponchio/untrunc/archive/master.zip
unzip master.zip
cd untrunc-master
wget http://libav.org/releases/libav-12.2.tar.xz
tar xvf libav-12.2.tar.xz
cd libav-12.2
./configure
make
cd ..
g++ -o untrunc file.cpp main.cpp track.cpp atom.cpp mp4.cpp -I./libav-12.2 -L./libav-12.2/libavformat -lavformat -L./libav-12.2/libavcodec -lavcodec -L./libav-12.2/libavresample -lavresample -L./libav-12.2/libavutil -lavutil -lpthread -lz -lbz2
./untrunc /path/to/working-video.mp4 /path/to/broken-video.mp4

This created a file called broken-video_fixed.mp4 that worked for me. Thank you so much for initiating this thread.

Source Link

@sparrowt Your current instructions did not work on my recent Ubuntu 16.10 installation. I got the following error while compilining untrunc:

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();

As explained in the untrunc repository, you might need to download libav separately rather than using the version in the Ubuntu repository. The following code worked for me:

sudo apt-get install unzip yasm g++
cd /tmp/
wget https://github.com/ponchio/untrunc/archive/master.zip
unzip master.zip
cd untrunc-master
wget http://libav.org/releases/libav-0.8.7.tar.xz
tar xvf libav-0.8.7.tar.xz
cd libav-0.8.7
./configure
make
cd ..
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
./untrunc /path/to/working-video.mp4 /path/to/broken-video.mp4

This created a file called broken-video_fixed.mp4 that worked for me. Thank you so much for initiating this thread.