movrepair
movrepair copied to clipboard
stsz.table: argument out of range
$ python3 movrepair.py ../working.mp4 --repair ../../file000083.mp4
Output file: ../../file000083-fixed.mp4
Broken file's mdat size adjusted from 828.4MiB to 828.4MiB
Adjusting "mvhd" duration from 4.664s to 316.65s.
Adjusting "mdhd" duration from 4.6572708333333335s to 316.19360416666666s.
Adjusting "mdhd" duration from 4.664022222222222s to 316.6519777777778s.
Adjusting sample count from 1 to 67
Adjusting sample count from 214 to 14528
Extending b'mp4a' chunk offset table
Extending b'mp4a' sample size table
stsz count: 14596
Adjusting sample count from 1 to 67
Adjusting sample count from 15 to 1018
Adjusting sample count from 1 to 67
Adjusting sample count from 14 to 950
Adjusting sample count from 1 to 67
Adjusting sample count from 15 to 1018
Adjusting sample count from 1 to 67
Adjusting sample count from 13 to 882
Adjusting sample count from 1 to 67
Adjusting sample count from 2 to 135
Adjusting sample count from 2 to 135
Adjusting sample count from 2 to 135
Adjusting sample count from 2 to 135
Adjusting sample count from 2 to 135
Adjusting sample count from 2 to 135
Adjusting sample count from 2 to 135
Adjusting sample count from 2 to 135
Adjusting sample count from 3 to 203
Adjusting sample count from 1 to 67
Adjusting sample count from 13 to 882
Adjusting sample count from 1 to 67
Adjusting sample count from 2 to 135
Adjusting sample count from 2 to 135
Adjusting sample count from 2 to 135
Adjusting sample count from 2 to 135
Adjusting sample count from 2 to 135
Adjusting sample count from 2 to 135
Adjusting sample count from 2 to 135
Adjusting sample count from 1 to 67
Adjusting sample count from 6 to 407
Adjusting sample count from 2 to 135
Adjusting sample count from 3 to 203
Adjusting sample count from 1 to 67
Adjusting sample count from 12 to 814
Adjusting sample count from 1 to 67
Adjusting sample count from 3 to 203
Extending b'avc1' chunk offset table
Extending b'avc1' sample size table
stsz count: 9437
Traceback (most recent call last):
File "repair/movrepair/movutils.py", line 146, in pack_into_stream
fp.write(self.fmt.pack(*value))
struct.error: argument out of range
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "movrepair.py", line 279, in <module>
sys.exit(main())
File "movrepair.py", line 269, in main
return repair_file(reference, broken, output, do_fix_metadata=not args.no_fix_metadata)
File "movrepair.py", line 227, in repair_file
fix_metadata(scale_factor, reference_atoms[b'moov'])
File "movrepair.py", line 169, in fix_metadata
stsz_atom.data = stsz.pack()
File "repair/movrepair/movutils.py", line 346, in pack
self.pack_into_stream(fp)
File "repair/movrepair/movutils.py", line 342, in pack_into_stream
field.pack_into_stream(type(self), fp, value)
File "repair/movrepair/movutils.py", line 179, in pack_into_stream
super(ListField, self).pack_into_stream(struct_type, fp, value)
File "repair/movrepair/movutils.py", line 149, in pack_into_stream
struct_type.__name__, self.name, e))
movutils.PackError: field stsz.table: argument out of range
Hey @Xeoncross , can you fetch the latest version from the master
branch and try again? It will fail again but with some more output that should help to understand why this happens.
Note that the changes that the script does to the video file are not in any way guaranteed to help, it's a poor-man's attempt to fixing the metadata in the file. It's likely that it's not going to work for your broken video file.
Thanks, I tried again and this is the new output
python3 movrepair.py ../working.mp4 --repair ../../file000083.mp4
Output file: ../../file000083-fixed.mp4
Broken file's mdat size adjusted from 828.4MiB to 828.4MiB
Scale factor to fix metadata: 67.89246900626615
Adjusting "mvhd" duration from 4.664s to 316.65s.
Adjusting "mdhd" duration from 4.6572708333333335s to 316.19360416666666s.
Adjusting "mdhd" duration from 4.664022222222222s to 316.6519777777778s.
Adjusting sample count from 1 to 67
Adjusting sample count from 214 to 14528
Extending b'mp4a' chunk offset table
Traceback (most recent call last):
File "movrepair.py", line 277, in <module>
sys.exit(main())
File "movrepair.py", line 267, in main
return repair_file(reference, broken, output, do_fix_metadata=not args.no_fix_metadata)
File "movrepair.py", line 225, in repair_file
fix_metadata(scale_factor, reference_atoms[b'moov'])
File "movrepair.py", line 161, in fix_metadata
.format(data_format, repn))
IndexError: tuple index out of range
Woops, I made a mistake in the code (didn't have a MOV file at hand so I winged it). Can you please try again?