Search code examples
videometadatavideo-processingconvertersmediainfo

How to create video with incorrect mediainfo?


I need to create some correct videos with incorrect mediainfo for testing. For example, halved bitrate or framerate, resolution 1920x1000 instead of 1920x1080. How can I edit mediainfo?

I tried:

  • VLC media player - it only allows to edit "author", "year", etc.
  • OpenShot Video Editor - it allows to create video with any resolution, but i can't create 1920x1080 video with mediainfo height = 1000
  • ffmpeg - it allows to set mediainfo with -metadata key or from file, but it not works for resolution
  • HexEditor - I tried to find "1080" in binary format and replace with "1000" but it didn't help

Are there any other options to do this?


Solution

  • There are two types of metadata, arbitrary and non arbitrary.

    Arbitrary metadata such as author, year, etc are editable because they are ignored by the decoding engine. Other metadata such as revolution or bitrate are static and defined by the media itself. These are read only and can only be changed by changing the underlying vide stream. i.e. transcoding.

    If your video is h.264, you could theoretically parse the SPS, modify the the resolution (the resolution is encoded in exp-golomb in macroblocks minus padding, its not encoded as pixels). The value would be difficult to find in a hex editor because it is variable length, and not byte aligned. You can read iso 14496-10 to know more. But doing that would make the video appear corrupted and likely undecodable.

    If your video is not h264, you will need to research that codec, every codec is different.