FFmpeg transfer from bad media

Questions involving a Windows version of FFmpeg.
Post Reply
thesavo
Posts: 1
Joined: Sun Dec 31, 2017 5:08 pm

FFmpeg transfer from bad media

Post by thesavo » Sun Dec 31, 2017 5:13 pm

I have an SDcard that has two videos recorded from an old phone. The media is bad and I have already run SpinRite and chkdsk, to fix the errors. The files still fail to copy completely.

I can play some portion of the files in VLC player. It plays about as far as File copy and TeraCopy before the copy job fails.
They and MP4 files. I would like to use ffmpeg to transfer the portion of the video that will play out. is

Code: Select all

-i
the best parameter?

Code: Select all

ffmpeg -i H:\badfile.mp4 e:\portion.mp4
Here is the output from mediainfo if that helps

Code: Select all

Complete name                            : H:\DCIM\badfile.mp4
Format                                   : MPEG-4
Format profile                           : Base Media
Codec ID                                 : isom (isom/3gp4)
File size                                : 422 MiB
Duration                                 : 3 min 46 s
Overall bit rate                         : 15.6 Mb/s
Video
ID                                       : 1
Format                                   : AVC
Format/Info                              : Advanced Video Codec
Format profile                           : [email protected]
Format settings                          : CABAC / 1 Ref Frames
Format settings, CABAC                   : Yes
Format settings, RefFrames               : 1 frame
Format settings, GOP                     : M=1, N=61
Codec ID                                 : avc1
Codec ID/Info                            : Advanced Video Coding
Duration                                 : 3 min 45 s
Bit rate                                 : 15.5 Mb/s
Width                                    : 1 920 pixels
Height                                   : 1 080 pixels
Display aspect ratio                     : 16:9
Frame rate mode                          : Variable
Frame rate                               : 19.469 FPS
Minimum frame rate                       : 14.085 FPS
Maximum frame rate                       : 30.303 FPS
Color space                              : YUV
Chroma subsampling                       : 4:2:0
Bit depth                                : 8 bits
Scan type                                : Progressive
Bits/(Pixel*Frame)                       : 0.385
Stream size                              : 418 MiB (99%)
Title                                    : VideoHandle
Language                                 : English
Encoded date                             : UTC 2013-09-17 13:18:06
Tagged date                              : UTC 2013-09-17 13:18:06
mdhd_Duration                            : 225892

Audio
ID                                       : 2
Format                                   : AAC
Format/Info                              : Advanced Audio Codec
Format profile                           : LC
Codec ID                                 : mp4a-40-2
Duration                                 : 3 min 46 s
Bit rate mode                            : Constant
Bit rate                                 : 128 kb/s
Nominal bit rate                         : 96.0 kb/s
Channel(s)                               : 2 channels
Channel positions                        : Front: L R
Sampling rate                            : 44.1 kHz
Frame rate                               : 43.066 FPS (1024 SPF)
Compression mode                         : Lossy
Stream size                              : 3.46 MiB (1%)
Title                                    : SoundHandle
Language                                 : English
Encoded date                             : UTC 2013-09-17 13:18:06
Tagged date                              : UTC 2013-09-17 13:18:06

pandy
Posts: 255
Joined: Mon Feb 24, 2014 1:46 pm

Re: FFmpeg transfer from bad media

Post by pandy » Mon Jan 01, 2018 11:58 pm

You can try options like:

Code: Select all

-err_detect ignore_err -ec guess_mvs+deblock+favor_inter -ignore_unknown

ColinRon
Posts: 1
Joined: Fri Dec 22, 2017 11:20 am

Re: FFmpeg transfer from bad media

Post by ColinRon » Sat Jan 06, 2018 12:52 pm

thesaevo wrote:
Sun Dec 31, 2017 5:13 pm
I have an SDcard that has two videos recorded from an old phone. The phenq reviews are cool. and I have already run SpinRite and chkdsk, to fix the errors. The files still fail to copy completely.
Same problem here. I have some damaged files by the looks of it. What you suggested didn't help unfortunately, Pandy. Any other ideas?
Last edited by ColinRon on Tue Sep 03, 2019 9:11 am, edited 2 times in total.

navilor
Posts: 51
Joined: Thu May 12, 2011 5:19 pm

Re: FFmpeg transfer from bad media

Post by navilor » Sun Jan 07, 2018 9:24 pm

Demux the video then demux the audio to see if one or both are broken.

Code: Select all

ffmpeg -i H:\badfile.mp4 -vcodec copy -an e:\video.mp4
ffmpeg -i H:\badfile.mp4 -vn -acodec copy e:\audio.mp4
In a perfect world this is merely a PTS/DTS corruption issue and you can put everything back together.

Code: Select all

ffmpeg -i e:\video.mp4 -i e:\audio.mp4 -codec copy -f mp4 -y out.mp4
When muxing the content back together ensure that the duration values for both the audio and video within about five percent of each other. If not then the video may stop playing back early.

pandy
Posts: 255
Joined: Mon Feb 24, 2014 1:46 pm

Re: FFmpeg transfer from bad media

Post by pandy » Mon Jan 08, 2018 12:56 pm

You can try something like this but perhaps it will be better to recode video and audio so stream will be free from errors (but content corrupted anyway):

Code: Select all

ffmpeg -err_detect ignore_err -ec guess_mvs+deblock+favor_inter -ignore_unknown -i "%1" -codec copy -f mp4 -y "%~n1_fix.mp4"

Post Reply
'