I took a video with my Android phone but failed to press the Stop button properly. So my phone ran out of disk memory and the Video App probably just cut off the file.
After copying the file (size 2.1 GB) to my ubuntu desktop I tried to run it with mplayer
. The output is:
MPlayer 1.2.1 (Debian), built with gcc-5.4.0 (C) 2000-2016 MPlayer Team
mplayer: could not connect to socket
mplayer: No such file or directory
Failed to open LIRC support. You will not be able to use your remote control.
Playing 20190215_141432.mp4.
libavformat version 56.40.101 (external)
libavformat file format detected.
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7f0685aced80]Protocol name not provided, cannot determine if input is local or a network protocol, buffers and access patterns cannot be configured optimally without knowing the protocol
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7f0685aced80]Could not find codec parameters for stream 0 (Video: h264 (avc1 / 0x31637661), none(tv, bt709), 1920x1080): unspecified pixel format
Consider increasing the value for the 'analyzeduration' and 'probesize' options
LAVF_header: av_find_stream_info() failed
[lavf] stream 0: video (h264), -vid 0
VIDEO: [H264] 1920x1080 24bpp 90000.000 fps 0.0 kbps ( 0.0 kbyte/s)
Clip info:
major_brand: mp42
minor_version: 0
compatible_brands: isommp42
creation_time: 2019-02-15 14:06:39
Load subtitles in ./
Failed to open VDPAU backend libvdpau_va_gl.so: cannot open shared object file: No such file or directory
[vdpau] Error when calling vdp_device_create_x11: 1
==========================================================================
Opening video decoder: [ffmpeg] FFmpeg's libavcodec codec family
libavcodec version 56.60.100 (external)
Selected video codec: [ffh264] vfm: ffmpeg (FFmpeg H.264)
==========================================================================
Audio: no sound
Starting playback...
V: 0.0 0/ 0 ??% ??% ??,?% 0 0
Exiting... (End of file)
Is there any way to fix this? Maybe there is just some meta-data which needs to be corrected.
I also tried this but output is the same:
mplayer -lavfdopts analyzeduration=120 20190215_141432.mp4
Then I tried to cut the video
ffmpeg -probesize 1000M -analyzeduration 1000M
-i 20190215_141432.mp4 -pix_fmt yuvj420p
-ss 00:00:00 -c copy -t 00:05:30 new.mp4
But the output is about the same:
ffmpeg version 2.8.15-0ubuntu0.16.04.1 Copyright (c) 2000-2018 the FFmpeg developers
built with gcc 5.4.0 (Ubuntu 5.4.0-6ubuntu1~16.04.10) 20160609
[...]
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x182d380] Could not find codec parameters for stream 0 (Video: h264 (avc1 / 0x31637661), none(tv, bt709), 1920x1080): unspecified pixel format
Consider increasing the value for the 'analyzeduration' and 'probesize' options
20190215_141432.mp4: could not find codec parameters
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '20190215_141432.mp4':
Metadata:
major_brand : mp42
minor_version : 0
compatible_brands: isommp42
creation_time : 2019-02-15 12:06:39
Duration: 00:19:49.40, bitrate: 10308 kb/s
Stream #0:0(eng): Video: h264 (avc1 / 0x31637661), none(tv, bt709), 1920x1080, SAR 1:1 DAR 16:9, 10.94 fps, 90k tbr, 90k tbn, 180k tbc (default)
Metadata:
rotate : 180
creation_time : 2019-02-15 12:06:39
handler_name : VideoHandle
Side data:
displaymatrix: rotation of -180.00 degrees
[...]
video:0kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
Output file is empty, nothing was encoded (check -ss / -t / -frames parameters if used)
Pls note that I specified the pix_fmt, probesize
and analyzeduration
but got as reply
unspecified pixel format. Consider increasing the value for the 'analyzeduration' and 'probesize' options
Btw: I tried pixel_format
also.
My final attemp, so far, has been to use untrunc
. The output is:
Repair: 20190215_141432.mp4
Failed to parse atoms in truncated file
Update on (edited) answer (by Fabby):
I tried this
ffmpeg -i 20190215_141432.mp4 -probesize 100M -analyzeduration 100M -map_metadata -1 -c:v libx264 -strict -2 -c:a libmp3lame -b:a 512K new.mkv
(and played around with values like 1024M
, 2G
, 4G
and placing of parameters (as suggested in here) but output is essentially:
[mov,mp4,m4a,3gp,3g2,mj2 @ 0xc0c4a0] Could not find codec parameters for stream 0 (Video: h264 (avc1 / 0x31637661), none(tv, bt709), 1920x1080): unspecified pixel format
Consider increasing the value for the 'analyzeduration' and 'probesize' options
20190215_141432.mp4: could not find codec parameters
[...]
Codec AVOption b (set bitrate (in bits/s)) specified for output file #0 (new.mkv) has not been used for any stream. The most likely reason is either wrong type (e.g. a video option with no video streams) or that it is a private option of some encoder which was not actually used for any stream.
[...]
[buffer @ 0xc137e0] Unable to parse option value "-1" as pixel format
Last message repeated 1 times
[buffer @ 0xc137e0] Error setting option pix_fmt to value -1.
[graph 0 input from stream 0:0 @ 0xc133e0] Error applying options to the filter.
Error opening filters!
I am going to lay this question to rest, now.
Reasons: It is dead simpe to cut videos, join videos - even roatate videos using
ffmpeg/mencoder
or other tools. Cutting, joining, rotating actions should (according to my understanding) re-arrange meta-data in the first place.I this case, meta-data is there and valid (such as duration, format, creation time...). So, why is repairing meta-data in this case that difficult? Extremely annoying is commands output, claiming that pixel format would not have been specified and so on....
After all. I thought repairing this video just needs a valuable hint or some magic canonical tool but after all, my life doesn't depend on it.
Sorry to say, but with .MP4 files you need both the header and the footer of the file to make it playable, so fully transcoding (and not just copying) might make it readable:
If that doesn't help, the contents are truly lost as the footer cannot be reconstructed from the data you've got.