Open niccuv opened 5 years ago
I think this issue should be fixed by one of the recent commits. I wasn't able to reproduce it locally.
Can double-check and close the ticket if this now works for you?
One thing to keep in mind here, is that using mp4edit
to insert a new atom, you need to pass a file with a complete atom, including the (type,size) header, not just the payload. I'm asking this, because in your example you're inserting GPSinfo.txt
, and the .txt
extension leads me to think that this is a text file, not an actual atom with a header. But since the file isn't attached here, I can't check that.
mp4edit.exe --insert generates corrupted atom
With the version 1.5.1-627 of mp4edit.exe, the result file has a corrupted atom. Version 1.5.1-624 works fine.
I use mp4edit.exe to insert an atom in a mp4 file: mp4edit.exe --insert moov/udta:GPSinfo.txt:0 "MOV_0232.mp4" "Sortiegps.mp4" with GPSinfo.txt the following file: ©xyz Ç+38.7130-009.1291/
The result file "SortiegpsOK.mp4" is unreadable and a dump stops before the end the file:
[ftyp] size=8+24 major_brand = mp42 minor_version = 200 compatible_brand = isom compatible_brand = iso2 compatible_brand = avc1 compatible_brand = mp41 [free] size=8+0 [moov] size=8+20183 [mvhd] size=12+96 timescale = 1000 duration = 20286 duration(ms) = 20286 [iods] size=12+12 [InitialObjectDescriptor] size=5+7 id = 1 include inline profile level flag = 0 OD profile level = ff scene profile level = ff audio profile level = fe visual profile level = fe graphics profile level = ff [trak] size=8+11819 [tkhd] size=12+80, flags=3 enabled = 1 id = 1 duration = 20286 width = 640.000000 height = 360.000000 [edts] size=8+28 [elst] size=12+16 entry count = 1 entry/segment duration = 20286 entry/media time = 6061 entry/media rate = 1 [mdia] size=8+11683 [mdhd] size=12+20 timescale = 90000 duration = 1825700 duration(ms) = 20285 language = und [hdlr] size=12+33 handler_type = vide handler_name = VideoHandler [minf] size=8+11598 [vmhd] size=12+8, flags=1 graphics_mode = 0 op_color = 0000,0000,0000 [dinf] size=8+28 [dref] size=12+16 [url ] size=12+0, flags=1 location = [local to file] [stbl] size=8+11534 [stsd] size=12+142 entry-count = 1 [avc1] size=8+130 data_reference_index = 1 width = 640 height = 360 compressor = [avcC] size=8+44 Configuration Version = 1 Profile = Main Profile Compatibility = 40 Level = 40 NALU Length Size = 4 Sequence Parameter = [67 4d 40 28 ec a0 50 17 fc b8 0b 50 10 10 14 00 00 03 00 04 00 0a fc 80 3c 60 c6 58] Picture Parameter = [68 eb e7 2c 80] [stts] size=12+1772 entry_count = 221 [stss] size=12+24 entry_count = 5 [ctts] size=12+4668 entry_count = 583 [stsc] size=12+16 entry_count = 1 [stsz] size=12+2416 sample_size = 0 sample_count = 602 [stco] size=12+2412 entry_count = 602 [trak] size=8+8075 [tkhd] size=12+80, flags=3 enabled = 1 id = 2 duration = 20224 width = 0.000000 height = 0.000000 [edts] size=8+28 [elst] size=12+16 entry count = 1 entry/segment duration = 20202 entry/media time = 1024 entry/media rate = 1 [mdia] size=8+7917 [mdhd] size=12+20 timescale = 48000 duration = 970752 duration(ms) = 20224 language = eng [hdlr] size=12+27 handler_type = soun handler_name = Stereo [minf] size=8+7838 [smhd] size=12+4 balance = 0 [dinf] size=8+28 [dref] size=12+16 [url ] size=12+0, flags=1 location = [local to file] [stbl] size=8+7778 [stsd] size=12+94 entry-count = 1 [mp4a] size=8+82 data_reference_index = 1 channel_count = 2 sample_size = 16 sample_rate = 48000 [esds] size=12+42 [ESDescriptor] size=5+37 es_id = 2 stream_priority = 0 [DecoderConfig] size=5+23 stream_type = 5 object_type = 64 up_stream = 0 buffer_size = 0 max_bitrate = 0 avg_bitrate = 0 DecoderSpecificInfo = 11 90 56 e5 00 [Descriptor:06] size=5+1 [stts] size=12+12 entry_count = 1 [stsc] size=12+16 entry_count = 1 [stsz] size=12+3800 sample_size = 0 sample_count = 948 [stco] size=12+3796 entry_count = 948 [udta] size=8+14 [name] size=8+6 [udta] size=8+133 [meta] size=12+91 [hdlr] size=12+21 handler_type = mdir handler_name =
The dump of the original file:
[ftyp] size=8+24 major_brand = mp42 minor_version = 200 compatible_brand = isom compatible_brand = iso2 compatible_brand = avc1 compatible_brand = mp41 [free] size=8+0 [mdat] size=8+1817672 [moov] size=8+20153 [mvhd] size=12+96 timescale = 1000 duration = 20286 duration(ms) = 20286 [iods] size=12+12 [InitialObjectDescriptor] size=5+7 id = 1 include inline profile level flag = 0 OD profile level = ff scene profile level = ff audio profile level = fe visual profile level = fe graphics profile level = ff [trak] size=8+11819 [tkhd] size=12+80, flags=3 enabled = 1 id = 1 duration = 20286 width = 640.000000 height = 360.000000 [edts] size=8+28 [elst] size=12+16 entry count = 1 entry/segment duration = 20286 entry/media time = 6061 entry/media rate = 1 [mdia] size=8+11683 [mdhd] size=12+20 timescale = 90000 duration = 1825700 duration(ms) = 20285 language = und [hdlr] size=12+33 handler_type = vide handler_name = VideoHandler [minf] size=8+11598 [vmhd] size=12+8, flags=1 graphics_mode = 0 op_color = 0000,0000,0000 [dinf] size=8+28 [dref] size=12+16 [url ] size=12+0, flags=1 location = [local to file] [stbl] size=8+11534 [stsd] size=12+142 entry-count = 1 [avc1] size=8+130 data_reference_index = 1 width = 640 height = 360 compressor = [avcC] size=8+44 Configuration Version = 1 Profile = Main Profile Compatibility = 40 Level = 40 NALU Length Size = 4 Sequence Parameter = [67 4d 40 28 ec a0 50 17 fc b8 0b 50 10 10 14 00 00 03 00 04 00 0a fc 80 3c 60 c6 58] Picture Parameter = [68 eb e7 2c 80] [stts] size=12+1772 entry_count = 221 [stss] size=12+24 entry_count = 5 [ctts] size=12+4668 entry_count = 583 [stsc] size=12+16 entry_count = 1 [stsz] size=12+2416 sample_size = 0 sample_count = 602 [stco] size=12+2412 entry_count = 602 [trak] size=8+8075 [tkhd] size=12+80, flags=3 enabled = 1 id = 2 duration = 20224 width = 0.000000 height = 0.000000 [edts] size=8+28 [elst] size=12+16 entry count = 1 entry/segment duration = 20202 entry/media time = 1024 entry/media rate = 1 [mdia] size=8+7917 [mdhd] size=12+20 timescale = 48000 duration = 970752 duration(ms) = 20224 language = eng [hdlr] size=12+27 handler_type = soun handler_name = Stereo [minf] size=8+7838 [smhd] size=12+4 balance = 0 [dinf] size=8+28 [dref] size=12+16 [url ] size=12+0, flags=1 location = [local to file] [stbl] size=8+7778 [stsd] size=12+94 entry-count = 1 [mp4a] size=8+82 data_reference_index = 1 channel_count = 2 sample_size = 16 sample_rate = 48000 [esds] size=12+42 [ESDescriptor] size=5+37 es_id = 2 stream_priority = 0 [DecoderConfig] size=5+23 stream_type = 5 object_type = 64 up_stream = 0 buffer_size = 0 max_bitrate = 0 avg_bitrate = 0 DecoderSpecificInfo = 11 90 56 e5 00 [Descriptor:06] size=5+1 [stts] size=12+12 entry_count = 1 [stsc] size=12+16 entry_count = 1 [stsz] size=12+3800 sample_size = 0 sample_count = 948 [stco] size=12+3796 entry_count = 948 [udta] size=8+14 [name] size=8+6 [udta] size=8+103 [meta] size=12+91 [hdlr] size=12+21 handler_type = mdir handler_name = [ilst] size=8+50 [.too] size=8+42 [data] size=8+34 type = 1 lang = 0 value = HandBrake 1.0.7 2017040900
Comparing the two binary files shows that an extra byte with value 0x00 is inserted in the atom [hdlr] with length 0x21. There are on the right 5 bytes for the length of atom [ilst] Left: Original file Right: Edited file