+ Reply to Thread
Results 1 to 14 of 14
Thread
  1. Member
    Join Date: Jan 2012
    Location: usa
    Search Comp PM
    I used a python script to edit the metadata of a mp4 file binary data:
    Code:
    data = data.replace(b'someword',b'newword')
    ...the video would NOT play, but if do just (replace a word with the same word):
    Code:
    data.replace(b'someword',b'someword')
    ...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.

    Thanks.
    Quote Quote  
  2. Member
    Join Date: Sep 2007
    Location: Canada
    Search Comp PM
    what words did you replace? maybe you inadvertently replaced critical data ?
    Quote Quote  
  3. Member
    Join Date: Jan 2012
    Location: usa
    Search Comp PM
    Originally Posted by poisondeathray View Post
    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.exe
    Last edited by vodpod; 27th Jan 2012 at 19:15.
    Quote Quote  
  4. Member
    Join Date: Sep 2007
    Location: Canada
    Search Comp PM
    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
    Does the metadata comment show up with mediainfo (view=>text) ?

    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.
    I don't know enough about mp4 structure, but if the same text string was replaced in other sections that could cause it not to play


    If you provided information on what "someword" was, that might be a better clue
    Quote Quote  
  5. Member
    Join Date: Jan 2012
    Location: usa
    Search Comp PM
    @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
    Quote Quote  
  6. Member
    Join Date: Sep 2007
    Location: Canada
    Search Comp PM
    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
    Quote Quote  
  7. Member
    Join Date: Jan 2012
    Location: usa
    Search Comp PM
    @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
    Quote Quote  
  8. Member
    Join Date: Sep 2007
    Location: Canada
    Search Comp PM
    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
    Quote Quote  
  9. Member
    Join Date: Sep 2007
    Location: Canada
    Search Comp PM
    Apple used to have an old style DRM that you could get rid of be re-muxing it into a new container e.g. mp4box or mkvmerge . It's worth a shot . Sometimes even remuxing it discards the metadata
    Quote Quote  
  10. Member
    Join Date: Jan 2012
    Location: usa
    Search Comp PM
    Is there a tool to check for DRM?
    Quote Quote  
  11. Member
    Join Date: Sep 2007
    Location: Canada
    Search Comp PM
    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
    Quote Quote  
  12. Is there a tool to check for DRM?
    Not any that I am aware of...
    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.
    Quote Quote  
  13. Member
    Join Date: Jul 2009
    Location: Spain
    Search Comp PM
    Originally Posted by poisondeathray View Post
    Did you use the same #spaces/characters ?
    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
    Note that PDR added 3 spaces after "PDR" to match "Warner".
    Quote Quote  
  14. Member
    Join Date: Jan 2012
    Location: usa
    Search Comp PM
    Originally Posted by Gavino View Post
    Note that PDR added 3 spaces after "PDR" to match "Warner".
    oh, snap! that was it! I completely missed the part PDR mentioned #spaces/characters. I just passed that part thinking "well of course you think i'm an idiot?" without actually understanding what he meant.

    Thanks PDR! & thanks Gavino for making me re-cognize
    Last edited by vodpod; 29th Jan 2012 at 00:19.
    Quote Quote  



Similar Threads