Repair defect video files

I have a DS1511+ which supports DLNA/UPnP and acts as a server. On the other side I have a blueray player Sony BDP-S480 as receiver. This setup enables me to watch movies from the Diskstation on the television. But sometimes it would start playing a movie but after a while it would just stop. I check some files and found out that they were defect. Here are some commands that can be used to fix them:

Checking a file file.avi. This does only check the file but does not fix any error

ffmpeg -v warning -i file.avi -f null -

Does check and repair the header of file infile.avi and writes the output to outfile.avi. This does not repair single frames

ffmpeg -i infile.avi -acodec copy -vcodec copy outfile.avi

Does encode the file input.avi using the x264 Video codec and writes the output to output.mp4. This does write both a valid header and valid frames

ffmpeg -i input.avi -vcodec libx264 -vprofile main output.mp4

Add new comment