I have a program that I wrote which takes all the frames and writes them as photos and then takes the photos and turns them back into a video. this solves problems whereby a video has the content but the structure of the file is bad.
this is perl. you need the avconv program to use this.
use constant REBUILD_FORMAT => "png";
use constant REBUILD_TMP_DIR => "/tmp/rebuild/";
sub rebuild
{
# my $outfile = Avconv::rebuild($infile);
my ($infile) = @_;
mkdir REBUILD_TMP_DIR, 0777;
my $file_type = $infile;
$file_type =~ s/^.*\.(\w{2,5})$/$1/;
$file_type =~ tr/A-Z/a-z/;
my $prefix = "test-$$";
my $outfile_tmp = REBUILD_TMP_DIR . $prefix . "-%05d." . REBUILD_FORMAT;
my $outfile = REBUILD_TMP_DIR . "outfile-$$.$file_type";
warn " - building temp files for '$infile'\n";
system "avconv -y -loglevel quiet -i '$infile' -frames 100000 -qscale:v 1 '$outfile_tmp'";
warn " - rebuilding video for '$infile'\n";
system "avconv -y -loglevel quiet -framerate 30 -f image2 -i ${\REBUILD_TMP_DIR}$prefix-%05d.${\REBUILD_FORMAT} -c mjpeg -b 65536k '$outfile'";
delete_cache($prefix);
warn join("\t", $outfile, -s $outfile, (-s $outfile / -s $infile), "\n");
return $outfile;
}