I used a python script to edit the metadata of a mp4 file binary data:
...the video would NOT play, but if do just (replace a word with the same word):Code:data = data.replace(b'someword',b'newword')
...the video DID play, which leads me to believe there is some king of checksum thing going on. I don't know anything about video encoding so I hope somebody could explain what's going on and maybe how to fix it. Please note, I have to use python so plase don't recommend any installed software.Code:data.replace(b'someword',b'someword')
Thanks.
+ Reply to Thread
Results 1 to 14 of 14
Thread
-
-
what words did you replace? maybe you inadvertently replaced critical data ?
-
I know it is not critical data, it's in the cmt (comment right?) and it's in a sentence about the video.
also, I'm testing with replacing just one word, such as: "wonderful"
One thing I should note is the this comment does not show up in the metadata section when I check the video using several methods: including right click->properties (win7) ,MP4Explorer, and MP4Info.exeLast edited by vodpod; 27th Jan 2012 at 19:15.
-
One thing I should note is the this comment does not show up in the metadata section when I check the video using several methods: including right click->properties (win7) ,MP4Explorer, and MP4Info.exe
It should show up somewhere with a hex editor
I know it is not critical data, it's in the cmt (comment right?) and it's in a sentence about the video.
If you provided information on what "someword" was, that might be a better clue -
@poisondeathray it does show up in MediaInfo and I wanted to replace the word "language" or all of the comment. Why would this cause the whole video to be corrupted?:
Code:General Complete name : E:\Videos\sep48106.mp4 Format : MPEG-4 Format profile : Base Media / Version 2 Codec ID : mp42 File size : 73.7 MiB Duration : 4mn 38s Overall bit rate mode : Variable Overall bit rate : 2 223 Kbps Encoded date : UTC 2011-12-14 19:34:49 Tagged date : UTC 2011-12-14 19:34:49 Writing library : Apple QuickTime Copyright : ©2011 All Rights Reserved Comment : on language and thought Video ID : 1 Format : AVC Format/Info : Advanced Video Codec Format profile : Main@L3.1 Format settings, CABAC : No Format settings, ReFrames : 6 frames Codec ID : avc1 Codec ID/Info : Advanced Video Coding Duration : 4mn 38s Source duration : 4mn 38s Bit rate mode : Variable Bit rate : 1 998 Kbps Maximum bit rate : 2 180 Kbps Width : 1 280 pixels Height : 720 pixels Display aspect ratio : 16:9 Original display aspect ratio : 16:9 Frame rate mode : Constant Frame rate : 23.976 fps Standard : Component Color space : YUV Chroma subsampling : 4:2:0 Bit depth : 8 bits Scan type : Progressive Bits/(Pixel*Frame) : 0.090 Stream size : 66.3 MiB (90%) Source stream size : 69.3 MiB Language : English Encoded date : UTC 2011-12-14 19:34:49 Tagged date : UTC 2011-12-14 19:34:49 Audio ID : 2 Format : AAC Format/Info : Advanced Audio Codec Format profile : LC Codec ID : 40 Duration : 4mn 38s Bit rate mode : Variable Bit rate : 128 Kbps Maximum bit rate : 135 Kbps Channel(s) : 2 channels Channel positions : Front: L R Sampling rate : 44.1 KHz Compression mode : Lossy Stream size : 4.24 MiB (6%) Language : English Encoded date : UTC 2011-12-14 19:34:49 Tagged date : UTC 2011-12-14 19:34:49
-
You can rule out if that is the cause (or not) by searching the string you used earlier with a hex editor (a search or find & replace function)
e.g. if you replaced "apple" and it actually shows up in 2 places... chances are that's what caused the problem
But If your script only replaced 1 entry, it shouldn't cause video to be corrupted. To prove this you can manually edit the video with a hex editor, and I bet it will still play -
@poisondeathray, I just tried that and clearly something is preventing any changes to the metadata (probably somekind of copyright protection feature?)
I used a hex editor to change the word "language" to "lang" saved it, tried to play the video, would not play. I changed the "lang" back to "language", saved, and it played. Also tried changing "Apple", won't play -
Could these ones be DRM protected?
Did you use the same #spaces/characters ?
I just tried, and it worked ok on some random mp4 from Apple movie trailer
I replaced "Warner" with "PDR "
Code:Format : MPEG-4 Format profile : Base Media / Version 2 Codec ID : mp42 File size : 3.87 MiB Duration : 9s 468ms Overall bit rate : 3 426 Kbps Encoded date : UTC 2012-01-28 01:59:24 Tagged date : UTC 2012-01-28 01:59:24 Copyright : © 2008 PDR Bros. Pictures. All Rights Reserved
-
You can access those metadata comments with quicktime pro, they are called "annotations"
The comment line is actually stripped when I remux with yamb (mp4box) in the examples I have (but they were originally MOV from apple, and not DRM protected - just movie trailers)
Sorry - I don't know enough about DRM.. except that it sucks :0 -
Is there a tool to check for DRM?
Ad I'm sure it doesn't involve just changing the headers of videos..
And why do insist doing a python hack for this? lol
Perhaps doing more research on the mp4 data structures might help you...
http://developer.apple.com/library/mac/#documentation/QuickTime/QTFF/QTFFChap3/qtff3.h...0939-CH205-SW1
Well if you are comfortable working with 'atoms' and objects stored in network byte order (big-endian format), more power to you.Last edited by teodz1984; 27th Jan 2012 at 23:39.
-
That's the key point which I think teodz1984 has missed.
If just doing a dumb binary replacement, the offsets of everything else in the file will be wrong if you change the number of characters. To maintain internal consistency if changing the length, you would need to use software that understood the file structure.
I just tried, and it worked ok on some random mp4 from Apple movie trailer
I replaced "Warner" with "PDR "
Code:Copyright : © 2008 PDR Bros. Pictures. All Rights Reserved
-
Last edited by vodpod; 29th Jan 2012 at 00:19.
Similar Threads
-
Edit metadata?
By w1n78 in forum Video ConversionReplies: 4Last Post: 16th Jan 2013, 12:08 -
Metadata edit and fetch - TV series videos?
By setu4993 in forum EditingReplies: 0Last Post: 23rd Feb 2012, 07:26 -
Metadata for MP4 in WMP
By tommiy in forum Video ConversionReplies: 0Last Post: 6th Nov 2010, 16:48 -
How to edit mp4 files and play them on my PS3?
By FlipUser in forum Video ConversionReplies: 3Last Post: 21st Oct 2009, 17:25 -
Edit MP4 frame size metadata
By tb582 in forum Video ConversionReplies: 1Last Post: 24th Jun 2009, 22:13