Reputation: 497
I have many large video files from an overseas trip. 90% of them are great, but there are a few I recorded on a dodgy SD card which are unable to play for some reason. They are all .MTS files.
In VLC, an error appears when trying to play them:
Unidentified codec:
VLC could not identify the audio or video codec
I don't know much about video files or codecs, but I am savvy enough to use ffmpeg, which I thought might be my best bet.
I attempted this on one of the files (call it 'input.MTS'):
ffmpeg -i input.MTS output.mp4
The result was this:
ffmpeg version N-82597-gd316b21 Copyright (c) 2000-2016 the FFmpeg developers
built with gcc 5.4.0 (GCC)
configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-dxva2 --enable-libmfx --enable-nvenc --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264 --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-libzimg --enable-lzma --enable-decklink --enable-zlib
libavutil 55. 40.100 / 55. 40.100
libavcodec 57. 66.106 / 57. 66.106
libavformat 57. 58.100 / 57. 58.100
libavdevice 57. 2.100 / 57. 2.100
libavfilter 6. 67.100 / 6. 67.100
libswscale 4. 3.101 / 4. 3.101
libswresample 2. 4.100 / 2. 4.100
libpostproc 54. 2.100 / 54. 2.100
[adp @ 0000000000026380] Format adp detected only with low score of 25, misdetection possible!
Input #0, adp, from 'input.MTS':
Duration: 00:05:38.69, start: 0.000000, bitrate: 438 kb/s
Stream #0:0: Audio: adpcm_dtk, 48000 Hz, stereo, s16p
Output #0, mp4, to 'output.mp4':
Metadata:
encoder : Lavf57.58.100
Stream #0:0: Audio: aac (LC) ([64][0][0][0] / 0x0040), 48000 Hz, stereo, fltp, 128 kb/s
Metadata:
encoder : Lavc57.66.106 aac
Stream mapping:
Stream #0:0 -> #0:0 (adpcm_dtk (native) -> aac (native))
Press [q] to stop, [?] for help
size= 312kB time=00:05:38.68 bitrate= 7.6kbits/s speed=33.7x
video:0kB audio:250kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 25.134468%
[aac @ 00000000025c5ba0] Qavg: 65531.879
The output.mp4 file now plays in VLC without error, and is 5 minutes and 38 seconds long. However, there is no audio or video.
Also, input.MTS is ~18 MB, and output.mp4 is ~0.313 MB.
What is the correct way to recover this video?
Upvotes: 1
Views: 3767
Reputation: 15926
What is the correct way to recover this video?
You cannot recover anything, from this file, because it does not contain any audio/video data.
Each and every single byte in the file has the maximum amount FF
as its hex value (or decimal 255
). See image below (showing some of) your file's bytes.
From this input I think FFmpeg has just guessed that your file must be some kind of PCM (uncompressed audio). The lack of a recognized format's header forces it to go a step further and assume your data as some ADPCM since that format does not always involve header data).
FFmpeg says : Stream #0:0: Audio: adpcm_dtk, 48000 Hz, stereo, s16p
VLC says : VLC could not identify the audio or video codec
As shown below there's nothing in file bytes to confirm actual format (is image? video? or audio?). Data could be PCM audio or could be just an all-white image (one white pixel = FF FF FF
).
Upvotes: 3
Reputation: 433
There are two reasons I suspect here. One is the ffmpeg command you are using not enough I think. Try below command once or look here.
ffmpeg -i input.mts -y -vcodec mpeg4 -acodec libfaac output.mp4
Second, I suspect VLC, because it not that stable. You can try playing it in mplayer or ffplay or any other player.
Upvotes: 1