I have an app which records mp4. Some videos are fine and some corrupt. But even the corrupt ones are huge in size which I conclude have data.However, I have tried ffmpg, avconv and media info. I am pasting media info from both working and corr ones. How do I recover the corrupt video ?
Possible solution: I found this webpage (look at the Incomplete files - or not finalised section). I am guessing this is one of the issues that while recording my phone would have died ? Anyway to recover this ? If you notice in the ffmpeg output only for corrupt video that the video stream is not detected.I do not know how to do this on ubuntu.
http://www.cnwrecovery.com/html/3gp_recovery.html
Corrupt:
mediainfo cor.mp4
General
Complete name : cor.mp4
File size : 2.91 MiB
Working:
mediainfo ../wo1.mp4
General
Complete name : ../wo1.mp4
Format : MPEG-4
Format profile : Base Media
Codec ID : isom
File size : 150 KiB
Duration : 334ms
Overall bit rate : 3 689 Kbps
Encoded date : UTC 2016-01-12 18:31:21
Tagged date : UTC 2016-01-12 18:31:21
Video
ID : 1
Format : AVC
Format/Info : Advanced Video Codec
Format profile : [email protected]
Format settings, CABAC : No
Format settings, ReFrames : 1 frame
Codec ID : avc1
Codec ID/Info : Advanced Video Coding
Duration : 334ms
Bit rate : 3 659 Kbps
Width : 720 pixels
Height : 480 pixels
Display aspect ratio : 3:2
Rotation : 90°
Frame rate mode : Variable
Frame rate : 29.970 fps
Minimum frame rate : 28.911 fps
Maximum frame rate : 31.110 fps
Standard : NTSC
Color space : YUV
Chroma subsampling : 4:2:0
Bit depth : 8 bits
Scan type : Progressive
Bits/(Pixel*Frame) : 0.353
Stream size : 149 KiB (99%)
Title : VideoHandle
Language : English
Encoded date : UTC 2016-01-12 18:31:21
Tagged date : UTC 2016-01-12 18:31:21
Audio
ID : 2
Format : AAC
Format/Info : Advanced Audio Codec
Format profile : LC
Codec ID : 40
Duration : 320ms
Source duration : 597ms
Source_Duration_FirstFrame : 277ms
Bit rate mode : Constant
Bit rate : 4 125 bps
Nominal bit rate : 128 Kbps
Channel(s) : 2 channels
Channel positions : Front: L R
Sampling rate : 48.0 KHz
Compression mode : Lossy
Stream size : 165 Bytes (0%)
Source stream size : 165 Bytes (0%)
Title : SoundHandle
Language : English
Encoded date : UTC 2016-01-12 18:31:21
Tagged date : UTC 2016-01-12 18:31:21
mdhd_Duration : 320
Working ffmpeg:
ffmpeg -i ../wo1.mp4
ffmpeg version 2.5.10-0ubuntu0.15.04.1 Copyright (c) 2000-2016 the FFmpeg developers
built with gcc 4.9.2 (Ubuntu 4.9.2-10ubuntu13)
configuration: --prefix=/usr --extra-version=0ubuntu0.15.04.1 --build-suffix=-ffmpeg --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --shlibdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --enable-gpl --enable-shared --disable-stripping --enable-avresample --enable-avisynth --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-libschroedinger --enable-libshine --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libwavpack --enable-libwebp --enable-libxvid --enable-opengl --enable-x11grab --enable-libdc1394 --enable-libiec61883 --enable-libzvbi --enable-libzmq --enable-frei0r --enable-libvpx --enable-libx264 --enable-libsoxr --enable-gnutls --enable-openal --enable-libopencv --enable-librtmp --enable-libx265
libavutil 54. 15.100 / 54. 15.100
libavcodec 56. 13.100 / 56. 13.100
libavformat 56. 15.102 / 56. 15.102
libavdevice 56. 3.100 / 56. 3.100
libavfilter 5. 2.103 / 5. 2.103
libavresample 2. 1. 0 / 2. 1. 0
libswscale 3. 1.101 / 3. 1.101
libswresample 1. 1.100 / 1. 1.100
libpostproc 53. 3.100 / 53. 3.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '../wo1.mp4':
Metadata:
major_brand : isom
minor_version : 0
compatible_brands: isom3gp4
creation_time : 2016-01-12 18:31:21
Duration: 00:00:00.33, start: 0.000000, bitrate: 3688 kb/s
Stream #0:0(eng): Video: h264 (Baseline) (avc1 / 0x31637661), yuv420p, 720x480, 3658 kb/s, 29.97 fps, 29.97 tbr, 90k tbn, 180k tbc (default)
Metadata:
rotate : 90
creation_time : 2016-01-12 18:31:21
handler_name : VideoHandle
Side data:
displaymatrix: rotation of -90.00 degrees
Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 2 kb/s (default)
Metadata:
creation_time : 2016-01-12 18:31:21
handler_name : SoundHandle
At least one output file must be specified
Corrupt ffmpeg
ffmpeg -i cor.mp4
ffmpeg version 2.5.10-0ubuntu0.15.04.1 Copyright (c) 2000-2016 the FFmpeg developers
built with gcc 4.9.2 (Ubuntu 4.9.2-10ubuntu13)
configuration: --prefix=/usr --extra-version=0ubuntu0.15.04.1 --build-suffix=-ffmpeg --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --shlibdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --enable-gpl --enable-shared --disable-stripping --enable-avresample --enable-avisynth --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-libschroedinger --enable-libshine --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libwavpack --enable-libwebp --enable-libxvid --enable-opengl --enable-x11grab --enable-libdc1394 --enable-libiec61883 --enable-libzvbi --enable-libzmq --enable-frei0r --enable-libvpx --enable-libx264 --enable-libsoxr --enable-gnutls --enable-openal --enable-libopencv --enable-librtmp --enable-libx265
libavutil 54. 15.100 / 54. 15.100
libavcodec 56. 13.100 / 56. 13.100
libavformat 56. 15.102 / 56. 15.102
libavdevice 56. 3.100 / 56. 3.100
libavfilter 5. 2.103 / 5. 2.103
libavresample 2. 1. 0 / 2. 1. 0
libswscale 3. 1.101 / 3. 1.101
libswresample 1. 1.100 / 1. 1.100
libpostproc 53. 3.100 / 53. 3.100
[adp @ 0x16967e0] Format adp detected only with low score of 25, misdetection possible!
Input #0, adp, from 'cor.mp4':
Duration: 00:00:55.61, start: 0.000000, bitrate: 438 kb/s
Stream #0:0: Audio: adpcm_dtk, 48000 Hz, stereo, s16p
At least one output file must be specified
Update I will put my progress here as this thread can potentially help someone else also
201604270700: ffmpeg is not able to get the video stream from corrupt file figuring out right codec -- look at links
ffmpeg -i cor.mp4 -vcodec copy -an -bsf:v h264_mp4toannexb -loglevel 56 test1.h264
ffmpeg version 2.5.10-0ubuntu0.15.04.1 Copyright (c) 2000-2016 the FFmpeg developers
built with gcc 4.9.2 (Ubuntu 4.9.2-10ubuntu13)
configuration: --prefix=/usr --extra-version=0ubuntu0.15.04.1 --build-suffix=-ffmpeg --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --shlibdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --enable-gpl --enable-shared --disable-stripping --enable-avresample --enable-avisynth --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-libschroedinger --enable-libshine --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libwavpack --enable-libwebp --enable-libxvid --enable-opengl --enable-x11grab --enable-libdc1394 --enable-libiec61883 --enable-libzvbi --enable-libzmq --enable-frei0r --enable-libvpx --enable-libx264 --enable-libsoxr --enable-gnutls --enable-openal --enable-libopencv --enable-librtmp --enable-libx265
libavutil 54. 15.100 / 54. 15.100
libavcodec 56. 13.100 / 56. 13.100
libavformat 56. 15.102 / 56. 15.102
libavdevice 56. 3.100 / 56. 3.100
libavfilter 5. 2.103 / 5. 2.103
libavresample 2. 1. 0 / 2. 1. 0
libswscale 3. 1.101 / 3. 1.101
libswresample 1. 1.100 / 1. 1.100
libpostproc 53. 3.100 / 53. 3.100
Splitting the commandline.
Reading option '-i' ... matched as input file with argument 'cor.mp4'.
Reading option '-vcodec' ... matched as option 'vcodec' (force video codec ('copy' to copy stream)) with argument 'copy'.
Reading option '-an' ... matched as option 'an' (disable audio) with argument '1'.
Reading option '-bsf:v' ... matched as option 'bsf' (A comma-separated list of bitstream filters) with argument 'h264_mp4toannexb'.
Reading option '-loglevel' ... matched as option 'loglevel' (set logging level) with argument '56'.
Reading option 'test1.h264' ... matched as output file.
Finished splitting the commandline.
Parsing a group of options: global .
Applying option loglevel (set logging level) with argument 56.
Successfully parsed a group of options.
Parsing a group of options: input file cor.mp4.
Successfully parsed a group of options.
Opening an input file: cor.mp4.
[adp @ 0x2672d60] Format adp detected only with low score of 25, misdetection possible!
[adp @ 0x2672d60] Before avformat_find_stream_info() pos: 0 bytes read:1048576 seeks:0
[adp @ 0x2672d60] All info found
[adp @ 0x2672d60] After avformat_find_stream_info() pos: 51200 bytes read:1048576 seeks:0 frames:50
Input #0, adp, from 'cor.mp4':
Duration: 00:00:55.61, start: 0.000000, bitrate: 438 kb/s
Stream #0:0, 50, 1/48000: Audio: adpcm_dtk, 48000 Hz, stereo, s16p
Successfully opened the file.
Parsing a group of options: output file test1.h264.
Applying option vcodec (force video codec ('copy' to copy stream)) with argument copy.
Applying option an (disable audio) with argument 1.
Applying option bsf:v (A comma-separated list of bitstream filters) with argument h264_mp4toannexb.
Successfully parsed a group of options.
Opening an output file: test1.h264.
File 'test1.h264' already exists. Overwrite ? [y/N] y
Successfully opened the file.
Output #0, h264, to 'test1.h264':
Output file #0 does not contain any stream
[AVIOContext @ 0x2673da0] Statistics: 0 seeks, 0 writeouts
[AVIOContext @ 0x2672320] Statistics: 1048576 bytes read, 0 seeks