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.62k stars 230 forks source link

Unable to run after using Docker to compile (Ubuntu 16.04) #139

Open RustyToad opened 6 years ago

RustyToad commented 6 years ago

I've spent several hours trying to build on Ubuntu 16.04. I've followed the instructions in #78 , but could not build libav. I replaced libav-0.8.7 with libav-12.2 and it compiled. I then tried to compile untrunc but it failed with the following:

In file included from mp4.cpp:30:0:
./libav-12.2/libavformat/avformat.h:712:21: note: declared here
     AVCodecContext *codec;
                     ^
./libav-12.2/libavcodec/libavcodec.a(opusdec.o): In function `opus_decode_subpacket':
/home/andrew/Documents/untrunc/untrunc-master/libav-12.2/libavcodec/opusdec.c:382: undefined reference to `avresample_is_open'
./libav-12.2/libavcodec/libavcodec.a(opusdec.o): In function `opus_decode_frame':
/home/andrew/Documents/untrunc/untrunc-master/libav-12.2/libavcodec/opusdec.c:221: undefined reference to `avresample_is_open'
./libav-12.2/libavcodec/libavcodec.a(opusdec.o): In function `opus_init_resample':
/home/andrew/Documents/untrunc/untrunc-master/libav-12.2/libavcodec/opusdec.c:163: undefined reference to `avresample_open'
/home/andrew/Documents/untrunc/untrunc-master/libav-12.2/libavcodec/opusdec.c:169: undefined reference to `avresample_convert'
./libav-12.2/libavcodec/libavcodec.a(opusdec.o): In function `opus_decode_frame':
/home/andrew/Documents/untrunc/untrunc-master/libav-12.2/libavcodec/opusdec.c:236: undefined reference to `avresample_convert'
./libav-12.2/libavcodec/libavcodec.a(opusdec.o): In function `opus_flush_resample':
/home/andrew/Documents/untrunc/untrunc-master/libav-12.2/libavcodec/opusdec.c:118: undefined reference to `avresample_convert'
./libav-12.2/libavcodec/libavcodec.a(opusdec.o): In function `opus_decode_subpacket':
/home/andrew/Documents/untrunc/untrunc-master/libav-12.2/libavcodec/opusdec.c:414: undefined reference to `avresample_close'
./libav-12.2/libavcodec/libavcodec.a(opusdec.o): In function `opus_decode_flush':
/home/andrew/Documents/untrunc/untrunc-master/libav-12.2/libavcodec/opusdec.c:616: undefined reference to `avresample_close'
./libav-12.2/libavcodec/libavcodec.a(opusdec.o): In function `opus_decode_close':
/home/andrew/Documents/untrunc/untrunc-master/libav-12.2/libavcodec/opusdec.c:640: undefined reference to `avresample_free'
./libav-12.2/libavcodec/libavcodec.a(opusdec.o): In function `opus_decode_init':
/home/andrew/Documents/untrunc/untrunc-master/libav-12.2/libavcodec/opusdec.c:704: undefined reference to `avresample_alloc_context'
./libav-12.2/libavutil/libavutil.a(hwcontext_vdpau.o): In function `vdpau_device_create':
/home/andrew/Documents/untrunc/untrunc-master/libav-12.2/libavutil/hwcontext_vdpau.c:431: undefined reference to `XOpenDisplay'
/home/andrew/Documents/untrunc/untrunc-master/libav-12.2/libavutil/hwcontext_vdpau.c:437: undefined reference to `XDisplayString'
/home/andrew/Documents/untrunc/untrunc-master/libav-12.2/libavutil/hwcontext_vdpau.c:439: undefined reference to `XDefaultScreen'
/home/andrew/Documents/untrunc/untrunc-master/libav-12.2/libavutil/hwcontext_vdpau.c:439: undefined reference to `vdp_device_create_x11'
/home/andrew/Documents/untrunc/untrunc-master/libav-12.2/libavutil/hwcontext_vdpau.c:433: undefined reference to `XDisplayName'
./libav-12.2/libavutil/libavutil.a(hwcontext_vdpau.o): In function `vdpau_device_free':
/home/andrew/Documents/untrunc/untrunc-master/libav-12.2/libavutil/hwcontext_vdpau.c:410: undefined reference to `XCloseDisplay'
collect2: error: ld returned 1 exit status

I tried the build script from #130 and it made good progress - downloaded and compiled libav-12.3 but couldn't compile untrunc:

Building Untrunc (extra-libs: vdpau X11 m z -pthread).
----------------------------------------------------------------------------
g++: error: *.cpp: No such file or directory
----------------------------------------------------------------------------
build.sh: Error: Failed to build Untrunc with library 'libav-12.3'.

I then tried Docker, at which I'm a complete beginner. I got it to run with the command sudo docker build untrunc-master

...but then what? To be honest I don't know what I expected docker to do, but I thought I'd be left with a binary or perhaps a .deb file.

I found the docker image with:

sudo docker image ls
REPOSITORY                    TAG                 IMAGE ID            CREATED             SIZE
<none>                        <none>              d7c8fefb4c81        54 minutes ago      992 MB

I have tried to run it, but I don't know the syntax to do so. Two attempts:

sudo docker run -i -t d7c8fefb4c81 [path]/goodfile.mp4 [path]badfile.mp4
Reading: [path]/goodfile.mp4
Could not open file: [path]/goodfile.mp4

sudo docker run -i -t d7c8fefb4c81 untrunc [path]/goodfile.mp4 [path]badfile.mp4
Reading: untrunc
Could not read at position

I'm pretty much lost at this point, and can't find any more instructions in the repository, the pull requests, the issues or on google. Can anyone give me any pointers?

(of, if you are feeling really generous, throw me a copy of the compiled binary for Ubuntu 16.04?)

jeroentrappers commented 5 years ago

you need to mount your local folder into the container as described in the readme.

docker run -v ~/Desktop/:/files untrunc /files/filea.MP4 /files/fileb.MP4

HareshKarnan commented 5 years ago

having the same issue. can someone help ?

anthwlock commented 5 years ago

Maybe you want to try this fork.

victorlandeira commented 5 years ago

faced the same issue. solved with docker build -t untrunc ./ from the terminal being inside the master unziped folder

rubo77 commented 3 years ago

I had to use sudo on all docker commands on my Ubuntu 20.04.

And I explained it a bit better here, how to mount the folder with the broken and the working file into the docker container:

https://github.com/rubo77/untrunc/blob/1bea10622cf76745f5fa6bcb63e415c2d2f8325f/README.md#docker-container